warrenerjm Posted August 15, 2006 Share Posted August 15, 2006 if you're familiar with php it's certainly a possibility, but it is my understanding the bulk of the contribution has been entirely rewritten... so it may not even be compatible with 1.6 :huh: Nop. Not that familiar with php!! I'll try & think of some alternative ways. Thanks for your reply eww. Julie Quote Link to comment Share on other sites More sharing options...
Guest Posted August 15, 2006 Share Posted August 15, 2006 Hi there, I installed de points/rewards v2.0 but now i don't get any shop on my web. I installed and chanched all files like in the install.txt written but now i do get nothing (www.bartosbroodjes.nl/osCommerce/index.php) I tryed to reinstall the piont/rewards but then i can't run the installer.php. What did i do wrong? Quote Link to comment Share on other sites More sharing options...
Phocea Posted August 16, 2006 Share Posted August 16, 2006 Ok finally made a fix so the payment method is set to null if there is enough point to cover the full order, this avoid to have to still go throught a payment gateway even so the order is free... IMPORTANT NOTE You will also need to make the modification as explained in my last 2 posts for this to work. the previous code change was required to allow the points required for an order to be calculated correctly if you have other deduction taking place before the point and reward order_total module. It also fix negative amount order if you have enough points to cover the order total amount. Credit goes to the Coupon and Gift Voucher contribution author since I haev simply mimic the logic they used. So if you have the contibution installed you will recognise a lot of the code below: In checkout_confirmation.php after require(DIR_WS_CLASSES . 'payment.php'); Add if ($point_covers) $payment=''; // Points and Rewards Then, look for the line starting with: if ( ( is_array($payment_modules->modules) && (sizeof($payment_modules->modules) > 1) && !is_object($$payment) ) and add this condition: && (!$point_covers) If you have already made the change on this line with && (!$customer_shopping_points_spending) you can change this bit only with && (!$point_covers) In checkout_payment.php After // avoid hack attempts during the checkout procedure by checking the internal cartID if (isset($cart->cartID) && tep_session_is_registered('cartID')) { if ($cart->cartID != $cartID) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); } } Add if(tep_session_is_registered('point_covers')) tep_session_unregister('point_covers'); // Points and Rewards In checkout_process.php After // load selected payment module require(DIR_WS_CLASSES . 'payment.php'); Add if ($point_covers) $payment=''; //Points and Rewards Then after tep_session_unregister('comments'); Add if(tep_session_is_registered('point_covers')) tep_session_unregister('point_covers'); // Point and Rewards In modules/functions/redemption.php After function calculate_required_points($amount, $cust_shop_points) { (if you do not find this line of code then read the IMPORTANT NOTE at the top of this post) Add global $order, $point_covers; After $max_allowed = $cust_shop_points > $max_allowed ? $max_allowed : $cust_shop_points; Add if ($order->info['total'] - $max_allowed <= 0 ) { if(!tep_session_is_registered('point_covers')) tep_session_register('point_covers'); $point_covers = true; } else { if(tep_session_is_registered('point_covers')) tep_session_unregister('point_covers'); } Thats it, i think idid not forget anything. If you run into trouble let me know ... as soon as this is prooved bug free I will repackage it in the main release stream of Points and Rewards, unlesss deep-silver wants to do it !! Quote Link to comment Share on other sites More sharing options...
aapinen Posted August 16, 2006 Share Posted August 16, 2006 Has anyne tried that does this work with Fast Easy Checkout? Quote Link to comment Share on other sites More sharing options...
♥texmaxx Posted August 16, 2006 Share Posted August 16, 2006 Greg, had a nice vacation? Thanks TexMaxx .. this put me on the right track to finally fix this. Your solution was only part complete and worked if you did not have a discount coupon of any sort .However if you have CCGV installed or any other order_total module installed, the points are not calculated properly. Thanks for that!And thanks for the paymentfix! I will add this right now. Well, I was puzzling arround with this mod the last few days and it slowly comes to an end. As you may have realized, mixed carts (specials and "normal" products) are customerunfriendly ignored if your settings not allow paying or specials or get points on specials purchase. I have ccgv installed and it calculates allright now... So I did the following: catalog/includes/redemptions.php changed functions: // check to see if to add pending points for specials. function get_award_discounted($order) { if (USE_POINTS_FOR_SPECIALS == 'false') { for ($i=0; $i<sizeof($order->products); $i++) { $id = $order->products[$i]['id']; $product['specials_new_products_price'] = tep_get_products_special_price($id); if (!tep_not_null($product['specials_new_products_price'])) { return true; } } return false; } else { return true; } } // products discounted restriction if enabled. function get_points_rules_discounted($order) { if (REDEMPTION_DISCOUNTED == 'true') { for ($i=0; $i<sizeof($order->products); $i++) { $id = $order->products[$i]['id']; $product['specials_new_products_price'] = tep_get_products_special_price($id); if (tep_not_null($product['specials_new_products_price'])) { return false; } } return true; } else { return true; } } // products pending points to add. function get_points_toadd($order) { if ($order->info['total'] > 0) { if ((USE_POINTS_FOR_SHIPPING == 'false') && (USE_POINTS_FOR_TAX == 'false')) $points_toadd = $order->info['total'] - $order->info['shipping_cost'] - $order->info['tax']; else if ((USE_POINTS_FOR_SHIPPING == 'false') && (USE_POINTS_FOR_TAX == 'true')) $points_toadd = $order->info['total'] - $order->info['shipping_cost']; else if ((USE_POINTS_FOR_SHIPPING == 'true') && (USE_POINTS_FOR_TAX == 'false')) $points_toadd = $order->info['total'] - $order->info['tax']; else $points_toadd = $order->info['total']; } if (tep_not_null(HIDDEN_POINTS)) { for ($i=0; $i<sizeof($order->products); $i++) { $p_ids = split("[,]", HIDDEN_POINTS); for ($ii = 0; $ii < count($p_ids); $ii++) { if ($order->products[$i]['id'] == $p_ids[$ii]) { if (USE_POINTS_FOR_TAX == 'true') { $points_toadd = $points_toadd - (tep_add_tax($order->products[$i]['final_price'],$order->products[$i]['tax'])*$order->products[$i]['qty']); } else { $points_toadd = $points_toadd - ($order->products[$i]['final_price']*$order->products[$i]['qty']); } } } } } if (USE_POINTS_FOR_SPECIALS == 'false') { for ($i=0; $i<sizeof($order->products); $i++) { $id = $order->products[$i]['id']; $product['specials_new_products_price'] = tep_get_products_special_price($id); if (tep_not_null($product['specials_new_products_price'])) { if (USE_POINTS_FOR_TAX == 'true') { $points_toadd = $points_toadd - (tep_add_tax($order->products[$i]['final_price'],$order->products[$i]['tax'])*$order->products[$i]['qty']); } else { $points_toadd = $points_toadd - ($order->products[$i]['final_price']*$order->products[$i]['qty']); } } } } return $points_toadd; } // awards restriction if enabled. function get_redemption_awards($customer_shopping_points_spending) { global $order; if (USE_POINTS_FOR_REDEEMED == 'false') { if ( !$customer_shopping_points_spending || ((get_points_toadd($order)*POINTS_PER_AMOUNT_PURCHASE) - ($customer_shopping_points_spending*POINTS_PER_AMOUNT_PURCHASE*REDEEM_POINT_V ALUE)) ) { return true; } return false; } else { return true; } } // display points on checkout_payment and provide checkbox. function points_selection() { global $cart, $currencies, $order; if (tep_session_is_registered('customer_shopping_points_spending')) tep_session_unregister('customer_shopping_points_spending'); if ((($customer_shopping_points = tep_get_shopping_points()) && $customer_shopping_points > 0) && ((get_redemption_rules($order) == true) && ((get_points_rules_discounted($order) == true) || (get_cart_mixed($order) == true)))) { if ($customer_shopping_points >= POINTS_LIMIT_VALUE){ if ((POINTS_MIN_AMOUNT == '') || ($cart->show_total() >= POINTS_MIN_AMOUNT) ){ $max_points = $order->info['total']/REDEEM_POINT_VALUE; //> POINTS_MAX_VALUE ? POINTS_MAX_VALUE : $order->info['total']/REDEEM_POINT_VALUE; // print_r($max_points.'<br>'); // texmaxx FIX mixed carts and Support for SPPC 4.x (exclude specials from redemption) BOF if (REDEMPTION_DISCOUNTED == 'true') { $special_points = 0; for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { // print_r($order->products[$i]['qty']); $id = $order->products[$i]['id']; $product['specials_new_products_price'] = tep_get_products_special_price($id); if (tep_not_null($product['specials_new_products_price'])) { if (USE_POINTS_FOR_TAX == 'true') { $special_points = $special_points + ((tep_add_tax($product['specials_new_products_price'],$order->products[$i]['tax'])*$order->products[$i]['qty'])/REDEEM_POINT_VALUE); $max_points = $max_points - ((tep_add_tax($product['specials_new_products_price'],$order->products[$i]['tax'])*$order->products[$i]['qty'])/REDEEM_POINT_VALUE); } else { $special_points = $special_points + (($product['specials_new_products_price']*$order->products[$i]['qty'])/REDEEM_POINT_VALUE); $max_points = $max_points - (($product['specials_new_products_price']*$order->products[$i]['qty'])/REDEEM_POINT_VALUE); } } } } $max_points = $max_points > POINTS_MAX_VALUE ? POINTS_MAX_VALUE : $max_points; // texmaxx FIX mixed carts and Support for SPPC 4.x (exclude specials from redemption) EOF // print_r($max_points.'<br>'); $max_points = $customer_shopping_points > $max_points ? $max_points : $customer_shopping_points; // print_r($max_points.'<br>'); // print_r(tep_calc_shopping_pvalue($max_points)); if (number_format($order->info['total'],4) > number_format(tep_calc_shopping_pvalue($max_points),4)) { $note = '<br>' . TEXT_REDEEM_SYSTEM_NOTE; } else { $note = '<br>' . TEXT_REDEEM_SYSTEM_ENOUGH_POINTS; } $customer_shopping_points_spending = $max_points; // print_r($customer_shopping_points_spending); ?> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="main"><b><?php echo TABLE_HEADING_REDEEM_SYSTEM . '<br>'; printf(TEXT_REDEEM_SYSTEM_START, number_format($customer_shopping_points,POINTS_DECIMAL_PLACES), $currencies->format(tep_calc_shopping_pvalue($customer_shopping_points))); ?></b></td> </tr> </table></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main" colspan="2"><?php echo TEXT_REDEEM_SYSTEM_NEXT; $points_without_redeem = get_points_toadd($order)*POINTS_PER_AMOUNT_PURCHASE; if ($points_without_redeem > 0) { printf(POINTS_YOU_GET_WITHOUT_REDEEM, number_format($points_without_redeem,POINTS_DECIMAL_PLACES), $currencies->format(tep_calc_shopping_pvalue($points_without_redeem))); } $points_you_get = (get_points_toadd($order)*POINTS_PER_AMOUNT_PURCHASE) - ($customer_shopping_points_spending * POINTS_PER_AMOUNT_PURCHASE * REDEEM_POINT_VALUE); /* print_r('<br>'.POINTS_PER_AMOUNT_PURCHASE.'<br>'); print_r(REDEEM_POINT_VALUE.'<br>'); print_r(get_points_toadd($order)* POINTS_PER_AMOUNT_PURCHASE.'<br>'); print_r($customer_shopping_points_spending * POINTS_PER_AMOUNT_PURCHASE * REDEEM_POINT_VALUE.'<br>'); print_r($points_you_get); */ if ($points_you_get > 0) { printf(POINTS_YOU_GET, number_format($points_you_get,POINTS_DECIMAL_PLACES), $currencies->format(tep_calc_shopping_pvalue(number_format($points_you_get,4)))); } else { echo POINTS_YOU_NOT_GET . ' ' . POINTS_ON_POINTS; } if (USE_POINTS_FOR_REDEEMED == 'false' && $points_you_get > 0) { echo POINTS_ON_POINTS; } printf(TEXT_REDEEM_SYSTEM_INFORMATION, number_format($max_points,POINTS_DECIMAL_PLACES), $currencies->format(tep_calc_shopping_pvalue($max_points))); printf($note,$currencies->format($order->info['total']),$currencies->format(tep_calc_shopping_pvalue($max_points))); ?></td> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> <?php // texmaxx FIX mixed carts and Support for SPPC 4.x (exclude specials from redemption) BOF if ($special_points > 0) {// texmaxx FIX mixed carts and Support for SPPC 4.x (exclude specials from redemption) BOF ?> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="smalltext" colspan="2"><?php printf(TEXT_NO_SPECIAL_POINTS, $currencies->format(tep_calc_shopping_pvalue($special_points)), number_format($special_points,POINTS_DECIMAL_PLACES)); ?></td> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> <?php } // texmaxx FIX mixed carts and Support for SPPC 4.x (exclude specials from redemption) EOF ?> <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)"> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main" valign="bottom" width="10"><?php echo tep_draw_checkbox_field('customer_shopping_points_spending', $customer_shopping_points_spending); ?><?php/* echo tep_draw_checkbox_field('customer_shopping_points_spending', $customer_shopping_points_spending,'','onclick="submitFunction()"'); */?></td> <td valign="top" class="main"> <?php printf(TEXT_REDEEM_SYSTEM_SPENDING, number_format($max_points,POINTS_DECIMAL_PLACES)); ?></td> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table></td> </tr> </table></td> </tr> <?php } // endif ((POINTS_MIN_AMOUNT == '') || ($cart->show_total() >= POINTS_MIN_AMOUNT) ){ } else { // endif ($customer_shopping_points >= POINTS_LIMIT_VALUE){ ?> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="main"><b><?php echo TABLE_HEADING_REDEEM; ?></b></td> </tr> </table></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main" colspan="2"><?php printf(POINTS_MINIMUM_AMOUNT_NOT_REACHED,POINTS_LIMIT_VALUE); ?></td> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table></td> </tr> </table></td> </tr> <?php } } else { ?> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="main"><b><?php echo TABLE_HEADING_REDEEM; ?></b></td> </tr> </table></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main" colspan="2"><?php echo TEXT_REDEEM_SYSTEM_NEXT; $points_without_redeem = get_points_toadd($order)*POINTS_PER_AMOUNT_PURCHASE; if ($points_without_redeem > 0) { printf(POINTS_YOU_GET_REDEEM, number_format($points_without_redeem,POINTS_DECIMAL_PLACES), $currencies->format(tep_calc_shopping_pvalue($points_without_redeem))); } else { echo NO_POINTS; } ?></td> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> <?php if ($special_points > 0) {// texmaxx FIX mixed carts and Support for SPPC 4.x (exclude specials from redemption) BOF ?> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="smalltext" colspan="2"><?php printf(TEXT_NO_SPECIAL_POINTS, $currencies->format(tep_calc_shopping_pvalue($special_points)), number_format($special_points,POINTS_DECIMAL_PLACES)); ?></td> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> <?php }// texmaxx FIX mixed carts and Support for SPPC 4.x (exclude specials from redemption) EOF ?> </table></td> </tr> </table></td> </tr> <?php } } new functions in redemptions.php function hidden_points_mixed($order) { if (tep_not_null(HIDDEN_POINTS)) { for ($i=0; $i<sizeof($order->products); $i++) { $p_ids = split("[,]", HIDDEN_POINTS); for ($ii = 0; $ii < count($p_ids); $ii++) { if ($order->products[$i]['id'] <> $p_ids[$ii]) { return true; } } } return false; } } // products discounted and normal products in cart? function get_cart_mixed($order) { if (sizeof($order->products)>1) { $special = false; $normal = false; for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { $id = $order->products[$i]['id']; $product['specials_new_products_price'] = tep_get_products_special_price($id); if (tep_not_null($product['specials_new_products_price'])) { $special = true; } else { $normal = true; } } if ($special == true && $normal == true) { return true; } else { return false; } return false; } } my language file has totally changed... catalog/includes/languages/english/checkout_payment.php // Points/Rewards Module V2.00 BOF define('TABLE_HEADING_REDEEM_SYSTEM', 'Shopping Points Redemptions '); define('TABLE_HEADING_REDEEM', 'Shopping Points'); define('TABLE_HEADING_REFERRAL', 'Referral System'); define('TEXT_REDEEM_SYSTEM_START', '<font color="blue"><b>Your credit balance: %s points with a value of %s.</b></font>'); define('TEXT_REDEEM_SYSTEM_NEXT', '<b>For this order you will get </b>'); define('POINTS_YOU_GET_WITHOUT_REDEEM', '<br><font color="blue"><b>%s points with a value of %s, if you do not redeem your credit.</b></font>'); define('POINTS_YOU_GET', '<br><font color="blue"><b>%s points with a value of %s, if you redeem your credit.</b></font> '); define('POINTS_YOU_NOT_GET', '<br><font color="blue"><b>No points, if you redeem your credit.</b></font> '); define('NO_POINTS', '<b>no points.</b> '); define('POINTS_MINIMUM_AMOUNT_NOT_REACHED', 'You have not reached the minimum amount of <b>%s points</b> needed to be able to redeem them.'); define('POINTS_YOU_GET_REDEEM', '<font color="blue"><b>%s points with a value of %s.</b></font> '); define('TEXT_REDEEM_SYSTEM_INFORMATION','<br>You can redeem <b>%s points</b> with a value of <b>%s</b>'); define('TEXT_REDEEM_SYSTEM_NOTE', '<font color="#ff0000"><b>Total Purchase <b>%s</b> is greater than the allowed pointsvalue of <b>%s</b>, you will also need to choose a payment method!</b></font>'); define('TEXT_REDEEM_SYSTEM_ENOUGH_POINTS', '<font color="blue"><b>Your total order can be paid with points!</font><br>Please choose "Check/Money Order" or "Cash Payment" as Payment Method!</b>'); define('TEXT_REFERRAL_REFERRED', 'If you were referred to us by a friend please enter their email address here.'); define('TEXT_NO_SPECIAL_POINTS', 'Specials with a value of <b>%s</b> (%s points) cannot be paid with points.'); define('POINTS_ON_POINTS', '(Purchase made by redeeming points are excluded.)'); define('TEXT_REDEEM_SYSTEM_SPENDING', '<b><-- Tick here to use %s Points allowed for this order.</b>'); // Points/Rewards Module V2.00 EOF catalog/checkout_payment.php <!-- Points/Rewards Module V2.00 Redeemption box bof --> <?php /* print_r(get_award_discounted($order).'<br>'); print_r(get_redemption_rules($order).'<br>'); print_r(get_points_rules_discounted($order).'<br>'); print_r(hidden_points_mixed($order).'<br>'); print_r(strpos(HIDDEN_POINTS_GROUPS,$customer_group_id).'hier'); */ if ( (USE_POINTS_SYSTEM == 'true' && USE_REDEEM_SYSTEM == 'true' && strpos(HIDDEN_POINTS_GROUPS,$customer_group_id)===false) && (hidden_points_mixed($order) == 'true' || get_award_discounted($order) == 'true' ) ) { echo points_selection(); if (tep_not_null(USE_REFERRAL_SYSTEM)) { echo referral_input(); } } ?> <!-- Points/Rewards Module V2.00 Redeemption box eof --> Fields to add to database: INSERT INTO `configuration` ( `configuration_id` , `configuration_title` , `configuration_key` , `configuration_value` , `configuration_description` , `configuration_group_id` , `sort_order` , `last_modified` , `date_added` , `use_function` , `set_function` ) VALUES ( '', 'Hide customergroups', 'HIDDEN_POINTS_GROUPS', '', 'Hide customergroups from points system.<br>Enter group_id and separate them by , <br>(leave empty to allow all)', '22', '17', 'now()', 'now()', NULL , NULL) INSERT INTO `configuration` ( `configuration_id` , `configuration_title` , `configuration_key` , `configuration_value` , `configuration_description` , `configuration_group_id` , `sort_order` , `last_modified` , `date_added` , `use_function` , `set_function` ) VALUES ( '', 'Exclude products from points system', 'HIDDEN_POINTS', '', 'To exclude products from points system, enter the products_ids and separate them by , <br>(leave empty to allow all)', '22', '17', 'now()', 'now()', NULL , NULL) I have installed SPPC 4.1 as well so it might be that you have to takeout the parts for that. I can mention them if needed... Quote Link to comment Share on other sites More sharing options...
Phocea Posted August 16, 2006 Share Posted August 16, 2006 So your fix if for the all mod to work properly with mix cart ? If i understand correctly there is a bug where if you dont allow to pay for specials with points then as soon as there is one in the cart the order cannot be paid with points or give you points ? Can you clarifiy what your change is fixing exactly ? Quote Link to comment Share on other sites More sharing options...
♥texmaxx Posted August 16, 2006 Share Posted August 16, 2006 Greg So your fix if for the all mod to work properly with mix cart ?If i understand correctly there is a bug where if you dont allow to pay for specials with points then as soon as there is one in the cart the order cannot be paid with points or give you points ? Can you clarifiy what your change is fixing exactly ? exactly. Settings: REDEMPTION_DISCOUNTED == true // not allowed to pay specials with points Problem: When you got 1 special together with other not discounted products in cart, the whole cart is ignored and cannot be paid with points. This is fixed. USE_POINTS_FOR_SPECIALS == false // no points on specials Problem: When you got 1 special together with other not discounted products in cart, the whole cart is ignored and got no points. Fixed. USE_POINTS_FOR_REDEEMED == false // no points on purchases with points Problem: When you paid with points, you got no points on the whole cart. Fixed. If your cart is bigger than the pointsvalue, you get points on what you paid with your dollars... Extentions: HIDDEN_POINTS == 1,2,3 // hide product_id 1,2,3 from pointssytem (example) Problem: I don't want to give points on my giftvouchers, so I exclude them. Customers get points when they purchase with vouchers. It would be double points otherwise and with a voucher you can buy a voucher buy a voucher....and your points grow and grow. HIDDEN_POINTS_GROUPS == 1 // for SPPC v.4.x exclude customergroups from pointssystem If you have Separate pricing per customer installed, you can hide the pointssystem from the groups you specify here. I forgot the checkout_process in my previous post: #### Points/Rewards Module V2.00 balance customer points BOF #### if ( (USE_POINTS_SYSTEM == 'true' && USE_REDEEM_SYSTEM == 'true' && strpos(HIDDEN_POINTS_GROUPS,$customer_group_id)===false) && (hidden_points_mixed($order) == 'true' || get_award_discounted($order) == 'true' ) ) { // customer pending points added if (($order->info['total'] > 0) && (get_award_discounted($order) == true)) { $points_toadd = get_points_toadd($order); $points_comment = 'TEXT_DEFAULT_COMMENT'; $points_type = 'SP'; if ((get_redemption_awards($customer_shopping_points_spending) == true) && ($points_toadd >0)) { tep_add_pending_points($customer_id, $insert_id, $points_toadd, $points_comment, $points_type); } } // customer referral points added if ((tep_session_is_registered('customer_referral')) && (tep_not_null(USE_REFERRAL_SYSTEM))) { $points_toadd = USE_REFERRAL_SYSTEM; $points_comment = 'TEXT_DEFAULT_REFERRAL'; $points_type = 'RF'; tep_add_pending_points($customer_referral, $insert_id, $points_toadd, $points_comment, $points_type); } // customer shoppping points account balanced if ($customer_shopping_points_spending) { tep_redeemed_points($customer_id, $insert_id, $customer_shopping_points_spending); } } #### Points/Rewards Module V2.00 balance customer points EOF ####*/ Quote Link to comment Share on other sites More sharing options...
♥texmaxx Posted August 16, 2006 Share Posted August 16, 2006 // awards restriction if enabled. function get_redemption_awards($customer_shopping_points_spending) { global $order; if (USE_POINTS_FOR_REDEEMED == 'false') { if ( !$customer_shopping_points_spending || ((get_points_toadd($order)*POINTS_PER_AMOUNT_PURCHASE) - ($customer_shopping_points_spending*POINTS_PER_AMOUNT_PURCHASE*REDEEM_POINT_V ALUE)) ) { return true; } return false; } else { return true; } } This function was wrong sorry! Take this one: function get_redemption_awards($customer_shopping_points_spending) { global $order; if (USE_POINTS_FOR_REDEEMED == 'false') { if ( !$customer_shopping_points_spending ) { return true; } return false; } else { return true; } } Quote Link to comment Share on other sites More sharing options...
mike1985 Posted August 17, 2006 Share Posted August 17, 2006 Can anyone pelase tell me why i am getting a negative tottal instead of 0.00 if all points are being used? :blush: this happens when i only click on the shopping points redemtions, or when i click paypal payment option and the shopping points redemtions check box and when used with check/money order payment option basically i get a negative tottal amount when i use the points redemtion alone or with any of the payment methods... so my guess is, it has something to do with the Points Redemtion... i have paypal_ipn 3.1.5 just installed yesterday updated with the reward point program fix. and Reward Point program V2.0 Image: thanks :) Quote Link to comment Share on other sites More sharing options...
Phocea Posted August 17, 2006 Share Posted August 17, 2006 Texmaxx, Ok just wanted to make sure Iunderstood the problem. I will install your fix and i think that the one I made to recalculate the points and not have negative amount will need to include your changes also .. kind of a merge of the 2 fixes !! Mike, read up the thread, the fix for your problem is there ..or wait a few day for an upcoming release that should include all latest bug fix given on this forum Quote Link to comment Share on other sites More sharing options...
♥texmaxx Posted August 17, 2006 Share Posted August 17, 2006 Dear Greg I will install your fix and i think that the one I made to recalculate the points and not have negative amount will need to include your changes also .. kind of a merge of the 2 fixes !!Would be very kind of you to merge that into a new release! It was late last night, therefor this function needs to be replaced again (sorry) : function get_redemption_awards($customer_shopping_points_spending) { global $order; if (USE_POINTS_FOR_REDEEMED == 'false') { if ( !$customer_shopping_points_spending || ((get_points_toadd($order) * POINTS_PER_AMOUNT_PURCHASE) - ($customer_shopping_points_spending * POINTS_PER_AMOUNT_PURCHASE * REDEEM_POINT_VALUE)) > 0 ) { return true; } return false; } else { return true; } } Quote Link to comment Share on other sites More sharing options...
Phocea Posted August 17, 2006 Share Posted August 17, 2006 Will do ASAP. Looking at the bug and your code, it is possible that I change a few things, to the same effect. I think it might be a bit more logical, in the method where the points required are calculated, to calculate it product per product, excluding the one that are in the exclude list, or the one like specials that follow special rules. Then obviously do the same for the points acquired method ... doing this could lay down the basis for another functionality where a point ratio can be set at product level, with a default of 1. Then when calculating points earned we use this ratio. This would enable us to set particular product at 0 ration (gift voucher for example), or make some promotional offer with double or triple points with a given product !! but one step at a time, the bugs discussed above must be tackled down first !!! Talking of which I made a mistake for the disabling of payment when enuzgh points value cover the order total: The new calculate_required_points function should be as follow: // Calculate the number of points needed to cover an amount function calculate_required_points($amount, $cust_shop_points) { global $order, $payment, $point_covers; $max_allowed = $amount/REDEEM_POINT_VALUE > POINTS_MAX_VALUE ? POINTS_MAX_VALUE : $amount/REDEEM_POINT_VALUE; $max_allowed = $cust_shop_points > $max_allowed ? $max_allowed : $cust_shop_points; if ($order->info['total'] - tep_calc_shopping_pvalue($max_allowed) <= 0 ) { if(!tep_session_is_registered('point_covers')) tep_session_register('point_covers'); } else { if(tep_session_is_registered('point_covers')) tep_session_unregister('point_covers'); } return $max_allowed; } Quote Link to comment Share on other sites More sharing options...
mike1985 Posted August 17, 2006 Share Posted August 17, 2006 when (Award points for order with redeemed points) is set to true, and (Award points for shipping) is set to false, it still calculates the shipping costs and adds it to the extra cash that was spent other than the points used, at the end if everything is calculated the shipping points where actually added and not excluded from the final paid price. Quote Link to comment Share on other sites More sharing options...
Phocea Posted August 17, 2006 Share Posted August 17, 2006 TexxMaxx must be a bad influence ... here is the correct function (copy pasted the wrong version !!) // Calculate the number of points needed to cover an amount function calculate_required_points($amount, $cust_shop_points) { global $order, $payment, $point_covers, $customer_shopping_points_spending; $max_allowed = $amount/REDEEM_POINT_VALUE > POINTS_MAX_VALUE ? POINTS_MAX_VALUE : $amount/REDEEM_POINT_VALUE; $max_allowed = $cust_shop_points > $max_allowed ? $max_allowed : $cust_shop_points; if (tep_session_is_registered('customer_shopping_points_spending')) { if ($order->info['total'] - tep_calc_shopping_pvalue($max_allowed) <= 0 ) { if(!tep_session_is_registered('point_covers')) tep_session_register('point_covers'); $point_covers = true; $payment=''; } else { if(tep_session_is_registered('point_covers')) tep_session_unregister('point_covers'); } } return $max_allowed; } Payment still appear on the confirmation page, to avoid this we would need to do bigger changes with a pre_confirmation_check function like CCGV is doing it ... the test in checkout_process will take care of removing the payment on the final order. when (Award points for order with redeemed points) is set to true, and (Award points for shipping) is set to false, it still calculates the shipping costs and adds it to the extra cash that was spent other than the points used, at the end if everything is calculated the shipping points where actually added and not excluded from the final paid price. Check your install and settings again, I just tested this and I do not get the problem. My order was as follow: Subtotal: 50.90 Points Redeemed: -38.55 Postage: 3.20 Total: 15.55 I give away 20 points per 1 unit of currency spent and for that order, 247 points were awarded, which is correct ( 15.55-3.20 = 12.35 * 20 = 247 ) Quote Link to comment Share on other sites More sharing options...
mike1985 Posted August 17, 2006 Share Posted August 17, 2006 That?s strange, when I tested mine 3 times, it always included the shipping charge, will look over it a bit more... Anyone find a solution to this? it has been bothering me since i had Points rewards V1.6 Ben, I have a question regarding the handling of specials. Afaik when REDEMPTION_DISCOUNTED is set to false, one should _not_ be able to _pay_ with points for items discounted. USE_POINTS_FOR_SPECIALS is set to false, no points are given on discounted items. Now, if I have a cart with only discounted items, no points are given. fine. If I have a mixed cart, points are given on all items, even the discounted ones... I can pay with points allways, the REDEMPTION_DISCOUNTED does not work. Did I screw up something? G?tz Thanks Quote Link to comment Share on other sites More sharing options...
mike1985 Posted August 17, 2006 Share Posted August 17, 2006 The first problem seems to have disappeared lol, I have checked everything over again, and it?s working fine now somehow... :blush: anyways What I am struggling on is the specials at this moment, when making a purchase the specials product price is added with the reset even if the setting is turned off. Same thing goes when redeeming points, if it is turned on and there is a special item among other regular items in your cart you cannot redeem your points the block does not show up at all. Does anyone have a fix for the specials that does not include the CCGV since I do not have that contrib. installed? thanks.. also thank you for this great contrib to whom ever helped on putting it together and making it. It is a wonderful contrib... :) Quote Link to comment Share on other sites More sharing options...
♥texmaxx Posted August 17, 2006 Share Posted August 17, 2006 Mike Does anyone have a fix for the specials that does not include the CCGV since I do not have that contrib. installed?the fix above will work for you. Quote Link to comment Share on other sites More sharing options...
♥texmaxx Posted August 17, 2006 Share Posted August 17, 2006 Greg TexxMaxx must be a bad influence ...Well, nobody is perfect ;) I agree that it could be rewritten some parts to give this a cleaner code and maybe another functionality. My version works so far in all combinations with regular items, vouchers and specials. I calculate everything in function get_points_toadd($order) so I have changed this now: catalog/checkout_confirmation added at the end of the points section: $points_to_add_registered = get_points_toadd($order) - ($customer_shopping_points_spending * REDEEM_POINT_VALUE); if ( $points_to_add_registered > 0 ) tep_session_register('points_to_add_registered'); ######## Points/Rewards Module V2.00 EOF #################*/ catalog/checkout_process changed the first section where the points are given #### Points/Rewards Module V2.00 balance customer points BOF #### if ( USE_POINTS_SYSTEM == 'true' && USE_REDEEM_SYSTEM == 'true' && strpos(HIDDEN_POINTS_GROUPS,$customer_group_id)===false ) { // customer pending points added if ( tep_session_is_registered('points_to_add_registered') ) { $points_comment = 'TEXT_DEFAULT_COMMENT'; $points_type = 'SP'; tep_add_pending_points($customer_id, $insert_id, $points_to_add_registered, $points_comment, $points_type); tep_session_unregister('points_to_add_registered'); } Quote Link to comment Share on other sites More sharing options...
mike1985 Posted August 18, 2006 Share Posted August 18, 2006 hmm this is strange, after fixing the specials problem and negative tottal cart amount, customers points do not show anymore in the shopping cart box located on the top right, and in the account.php page. BUT when a customer clicks on the (View my Points Balance and Points received.) they can see there points in the table, but they cannot use there points during check out no matter what... :blink: so i backed up the files i changed and the points still do not show as above :huh: Quote Link to comment Share on other sites More sharing options...
Phocea Posted August 18, 2006 Share Posted August 18, 2006 (edited) GregWell, nobody is perfect ;) I agree that it could be rewritten some parts to give this a cleaner code and maybe another functionality. My version works so far in all combinations with regular items, vouchers and specials. I calculate everything in function get_points_toadd($order) so I have changed this now: Yeah i am certain the code works, I was just scared of the implication in merging both ... and also while writing test cases came up with another potential problem if you do not want to give points specials, or be able to pay for discounted products with points Imagine a cart like this: Product 1: 15.00 (Full Price) Product 2: 5.00 (Reduced Special Price) Total : 20.00 Coupon : -2.00 (CCGV Coupon -10%) Points : -13.00 Now what should be the max points allowed to be used on this order ? The coupon basically make the Product 1 and 2 price reduced by a furter 10% !! In this case should Product 1 assimilated to a specials then ? Then we would need to specifically check if a % coupon is being used and disable the redemption of points ... If we dont disable it, what should max points be on this order: 13.00 ( Product 1 Price - Full Coupon Reduction) ? 11.70 ( Product 1 Price - 10%) ? In the same example, if you allow to gain points on order where you redeem points, what should the number of points rewarded be based on: 15.00 ( Full Product 1 Price) ? 11.70 ( Product 1 Price - 10%) ? Edited August 18, 2006 by Phocea Quote Link to comment Share on other sites More sharing options...
♥texmaxx Posted August 18, 2006 Share Posted August 18, 2006 Greg Imagine a cart like this: Product 1: 15.00 (Full Price) Product 2: 5.00 (Reduced Special Price) Total : 20.00 Coupon : -2.00 (CCGV Coupon -10%) Points : -13.00 Well, it should be 18 points if specials are pointgiven, otherwise 13.5I don't use percentcoupons yet, no experience. I have decided to put the pointsmodule before the coupons. Now what should be the max points allowed to be used on this order ? The coupon basically make the Product 1 and 2 price reduced by a furter 10% !!In this case should Product 1 assimilated to a specials then ? Then we would need to specifically check if a % coupon is being used and disable the redemption of points ... If we dont disable it, what should max points be on this order: 13.00 ( Product 1 Price - Full Coupon Reduction) ? 11.70 ( Product 1 Price - 10%) ? In the same example, if you allow to gain points on order where you redeem points, what should the number of points rewarded be based on: 15.00 ( Full Product 1 Price) ? 11.70 ( Product 1 Price - 10%) ? I'm not sure if I followed you right, but I would say 24.7 and 26.7 points if POINTS_PER_AMOUNT_PURCHASE == 1. Quote Link to comment Share on other sites More sharing options...
♥texmaxx Posted August 18, 2006 Share Posted August 18, 2006 Greg ignore my previous post, I wasn't able to edit it... Imagine a cart like this: Product 1: 15.00 (Full Price) Product 2: 5.00 (Reduced Special Price) Total : 20.00 Coupon : -2.00 (CCGV Coupon -10%) Points : -13.00 Well, it should be 18 points if specials are pointgiven, otherwise 13.5I don't use percentcoupons yet, no experience. I have decided to put the pointsmodule before the coupons. Now what should be the max points allowed to be used on this order ? The coupon basically make the Product 1 and 2 price reduced by a furter 10% !!In this case should Product 1 assimilated to a specials then ? Then we would need to specifically check if a % coupon is being used and disable the redemption of points ... If we dont disable it, what should max points be on this order: 13.00 ( Product 1 Price - Full Coupon Reduction) ? 11.70 ( Product 1 Price - 10%) ? In the same example, if you allow to gain points on order where you redeem points, what should the number of points rewarded be based on: 15.00 ( Full Product 1 Price) ? 11.70 ( Product 1 Price - 10%) ? If I followed you right I would saycart 1: (REDEEM_POINT_VALUE == 1) 24.7 max_points. cart 2: (POINTS_PER_AMOUNT_PURCHASE == 1) 26.7 points reward. Quote Link to comment Share on other sites More sharing options...
Phocea Posted August 18, 2006 Share Posted August 18, 2006 Imagine a cart like this: CODE Product 1: 15.00 (Full Price) Product 2: 5.00 (Reduced Special Price) Total : 20.00 Coupon : -2.00 (CCGV Coupon -10%) What should max points calculated upon, on this order: 13.00 ( Product 1 Price - Full Coupon Reduction) ? 13.50 ( Product 1 Price - 10%) ? or as you stated it, if we give points for specials [*]18.00 ( Order Total - 10%) In the same example, if you allow to gain points on order where you redeem points, what should the number of points rewarded be based on: 15.00 ( Full Product 1 Price) ? 13.50 ( Product 1 Price - 10%) ? The number I give here are the amount on which points should be calculated, not the actual number of points since this depend on the POINTS_PER_AMOUNT_PURCHASE variable. Quote Link to comment Share on other sites More sharing options...
♥texmaxx Posted August 18, 2006 Share Posted August 18, 2006 What should max points calculated upon, on this order:13.00 ( Product 1 Price - Full Coupon Reduction) ? 13.50 ( Product 1 Price - 10%) ? 26.5 points if you don't give points on the purchase of the voucher.It depends on your setting of the sort_order of the module CCGV In the same example, if you allow to gain points on order where you redeem points, what should the number of points rewarded be based on:15.00 ( Full Product 1 Price) ? 13.50 ( Product 1 Price - 10%) ? 28.5 points I would prefer to discuss this by the total as this mod is calculating on $order->info['total'] Quote Link to comment Share on other sites More sharing options...
aapinen Posted August 18, 2006 Share Posted August 18, 2006 (edited) I have perfectly cleas osc ms2 and I copy all the files from (modified_files/new_files) the v.2.0 to my catalog directory and ran the SQL-quary. Everthing else seems to work but I cant get the points to the checkout_confirmation.php. I have points but if I use them it wont discount the final checkout. Is there some simple trick to get this thing work? wouldnt like to read all the 57 pages for that. And definetily wont install to my liveshop if I cant get it work even in my own server. Edited August 18, 2006 by aapinen Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.