Jump to content

primadude

Members
  • Content count

    108
  • Joined

  • Last visited

1 Follower

Profile Information

  • Real Name
    Joseph Primanti
  1. One thing that has been bothering me about this contribution has been the error text in the URL when redeeming a valid coupon or gift voucher. The other thing is the fact that the error coding is also used for successful redemption of coupons and gift vouchers resulting in a success message placed into a red error box on Checkout Payment. I have resolved these two issues. I have added code to resolve the URL redemption text and I have reworked a section of checkout_payment.php so that the Message Stack Class is now used for both errors and successes. The Message Stack Class utilizes a warning icon (yellow triangle with exclamation point) for coupon and voucher errors in the default red/pink message box and a success icon (yellow light bulb exclamation) for coupon and voucher successes in a green message box. The Message Stack Class colors are easily changed at the end of the stylesheet.css. This is an example of a coupon error using the Message Stack Class: This is an example of the error shown in the URL: https://<your_web_site>/catalog/checkout_payment.php?payment_error=ot_coupon&error=Invalid+Coupon+Code&osCsid=c601066506eacc4e208d7c9dda181450 This is an example of a coupon success using the Message Stack Class: This is an example of the success shown in the URL: https://<your_web_site>/catalog/checkout_payment.php?redemption_successful=ot_coupon&success=Congratulations%2C+you+have+redeemed+%243.30.&osCsid=c601066506eacc4e208d7c9dda181450 Here are the code changes: In /catalog/checkout_payment.php find this code: <?php if (isset($HTTP_GET_VARS['payment_error']) && is_object(${$HTTP_GET_VARS['payment_error']}) && ($error = ${$HTTP_GET_VARS['payment_error']}->get_error())) { ?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="main"><b><?php echo tep_output_string_protected($error['title']); ?></b></td> </tr> </table></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBoxNotice"> <tr class="infoBoxNoticeContents"> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main" width="100%" valign="top"><?php echo tep_output_string_protected($error['error']); ?></td> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } ?> Replace it with this code: <!-- BEGIN >>> CCVG v5.15 - Custom Modification - Display Success & Error messages using Message Stack Class --> <?php if (isset($HTTP_GET_VARS['payment_error']) && is_object(${$HTTP_GET_VARS['payment_error']}) && ($error = ${$HTTP_GET_VARS['payment_error']}->get_error())) { ?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="main"><b><?php echo tep_output_string_protected($error['title']); ?></b></td> </tr> </table></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <td class="main" width="100%" valign="top"> <?php $messageStack = new messageStack(); $messageStack->add('general', $error['error'], 'warning'); if ($messageStack->size('general') > 0) echo $messageStack->output('general'); ?> </td> <td class="main" width="100%" valign="top"></td> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } elseif (isset($HTTP_GET_VARS['redemption_successful']) && is_object(${$HTTP_GET_VARS['redemption_successful']}) && ($success = ${$HTTP_GET_VARS['redemption_successful']}->get_success())) { ?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="main"><b><?php echo tep_output_string_protected($success['title']); ?></b></td> </tr> </table></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <td class="main" width="100%" valign="top"> <?php $messageStack = new messageStack(); $messageStack->add('general', $success['success'], 'success'); if ($messageStack->size('general') > 0) echo $messageStack->output('general'); ?> </td> <td class="main" width="100%" valign="top"></td> </tr> </table></td> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } ?> <!-- END <<< CCVG v5.15 - Custom Modification - Display Success & Error messages using Message Stack Class --> In /catalog/includes/modules/order_total/ot_coupon.php find this code: if ( strlen($cc_id)>0 && $coupon_amount==0 ) { $err_msg = ERROR_REDEEMED_AMOUNT.ERROR_REDEEMED_AMOUNT_ZERO; } else { $err_msg = ERROR_REDEEMED_AMOUNT.$coupon_amount_out; } tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode($err_msg), 'SSL')); Replace it with this code: // BEGIN >>> CCVG v5.15 - Custom Modification - Display Success Message and URL text, Use Function get_success if ( strlen($cc_id)>0 && $coupon_amount==0 ) { $msg = ERROR_REDEEMED_AMOUNT.ERROR_REDEEMED_AMOUNT_ZERO; } else { $msg = ERROR_REDEEMED_AMOUNT.$coupon_amount_out; } tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'redemption_successful='.$this->code.'&success=' . urlencode($msg), 'SSL')); //tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode($err_msg), 'SSL')); // END <<< CCVG v5.15 - Custom Modification - Display Success Message and URL text, Use Function get_success In /catalog/includes/modules/order_total/ot_coupon.php AND in /catalog/modules/order_total/ot_gv.php find this code: return $error; } Replace it with this code: return $error; } // BEGIN >>> CCVG v5.15 - Custom Modification - Provide Success Messages // show module successes on checkout_payment page function get_success() { global $HTTP_GET_VARS; $success = array('title' => MODULE_ORDER_TOTAL_COUPON_TEXT_ERROR, 'success' => stripslashes(urldecode($HTTP_GET_VARS['success']))); return $success; } // END <<< CCVG v5.15 - Custom Modification - Provide Success Messages In /catalog/modules/order_total/ot_gv.php find this code: tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode(ERROR_REDEEMED_AMOUNT. $currencies->format($gv_amount)), 'SSL')); Replace it with this code: // BEGIN >>> CCVG v5.15 - Custom Modification - Display Success Message and URL text, Use Function get_success tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'redemption_successful='.$this->code.'&success=' . urlencode(ERROR_REDEEMED_AMOUNT. $currencies->format($gv_amount)), 'SSL')); // END <<< CCVG v5.15 - Custom Modification - Display Success Message and URL text, Use Function get_success } If you decide to make this change, please post your results so we can all benefit and maybe it will make it into Ian's upcoming stable re-package contribution. Joe
  2. I think if you use the latest contribution you will have fairly good luck (personal opinon). Just make sure to backup the database and all files first and do all this on a development site and test test test. Joe
  3. Cartel, This happens when you have selected the Free Shipping checkbox. Percent seems to work only when Free Shipping is deselected. Not if this was by design or not. Joe
  4. Leslie, yes I noticed that quirk when you edit a coupon, it puts in some default values that you need to reset if you re-save the coupon... Joe
  5. You are going to need to find and use your PHPMyAdmin to load the SQL tables. This has to be done for most contributions to function. In the instructions, it does assume you should know how to do this. It states: In the bottom level directory (The same one this document is in) you will find a file ending with .sql. This contains the database definitions for tables that are required by the contribution. These definitions need to be added to the Database that you use for your osCommerce catalog. How you achieve this depends on your installation. The easiest method is to use phpMyAdmin to upload and add the .sql file. The CCVG contribution has a file called "order_total_gv.sql". Use the instructions I posted earlier. Just copy/paste this information into the SQL query window and click GO to update your database. Make sure to do a database backup first before this to be safe. Joe
  6. For the second issue, try entering the coupon code twice and see if it goes through the second time. If so, then this is how I fixed this issue: 2x Error Fix For the cosmetic text that is displayed, it is easy to change the text. This is what I changed it to: in Catalog/Includes/languages/english/modules/order_total/ot_coupon.php: define('ERROR_REDEEMED_AMOUNT_ZERO', 'a valid coupon number. HOWEVER: This coupon has restrictions that have been exceeded. No reduction will be applied, please see the coupon restrictions that were sent within your offer email***'); Can you explain more clearly what your first issue is? Is this happening in Admin or on the Checkout Payment page? Joe
  7. Great Leslie, I am glad it is working so far. Let us all know how it goes... Joe
  8. Leslie, is TreeView functioning OK but jusdt not redeeming or is Treeview iteslf not working? Did you download the Treeview 1.2 contribution and install the java script, image files and check the bit of php code required? I am not sure what error you are getting...It is working for me so I should be able to help. Joe
  9. Leslie, thanks for checking. Since I baselined at CCVG v5.15 this change obviously happened afterwards and I did not see a post on this. So the question is, does your CCGV 5.15a2 Part 1 and 2 code have a problem redeeming when you use Valid Catrgories or Valid Products listed or has my fix helped. I know it helped in CCVG v5.15... Joe
  10. Hi Josh, That is a loaded question :-" . I am sure everyone here will have a different opinion. When I decided to load this contribution about a month ago, v5.15 was the latest version but I had been reading that it also had problems. I read that v5.13 was considered stable at the time so, I started with v5.13 and found a ton of bugs. Then I upgraded to v5.15 and it fixed a lot of issues but I have still been fixing bugs with v5.15 for the last three weeks. This is the most difficult contribution I have implemented yet but I am finally seeing light at the end of the tunnel. I do not believe there is a fully working version that anyone could install even onto a stock OSC site yet. You will have to make an educated guess and plan on fixing bugs afterwards. The problem is that there are so many variables to test that it takes a lot of time to set up and test each potential situation that a customer would experience. I hope I didn't ruin it for you...It can be done, it is worth it, and I think there are a lot of sites with CCVG working. Just plan on spending some time on it... Joe
  11. Leslie, Hmmm...I went and checked the code that was in the original CCVG v5.15 Contribution and this is a snippet of code directly from ot_coupon.php showing it matches my code: if ($get_result['coupon_type'] == 'P') { /* Fixes to Gift Voucher module 5.03 ================================= Submitted by Rob Cote, robc@traininghott.com original code: $od_amount = round($amount*10)/10*$c_deduct/100; $pr_c = $order->products[$i]['final_price']*$order->products[$i]['qty']; $pod_amount = round($pr_c*10)/10*$c_deduct/100; */ //$pr_c = $order->products[$i]['final_price']*$order->products[$i]['qty']; $pr_c = $this->product_price($pr_ids[$ii]); //Fred 2003-10-28, fix for the row above, otherwise the discount is calc based on price excl VAT! $pod_amount = round($pr_c*10)/10*$c_deduct/100; $od_amount = $od_amount + $pod_amount; } else { $od_amount = $c_deduct; } } Can you tell me what version of CCVG you started with and check that original version ot_coupon.php? I am interested in seeing if the code changed before or after CCVG v5.15. Joe PS. That spelling error is in CCVG v5.15 too...Thanks.
  12. It is because I somehow made an error. Sorry about that. You are correct. Here is the fix corrected: Find this code: $gv_query=tep_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . $customer_id . "'"); $gv_result=tep_db_fetch_array($gv_query); $gv_payment_amount = $gv_result['amount']; // if ($order->info['total'] - $total_deductions <= 0 ) { if ($order->info['total'] - $gv_payment_amount <= 0 ) { Replace it with this code: $gv_query=tep_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . $customer_id . "'"); $gv_result=tep_db_fetch_array($gv_query); $gv_payment_amount = $gv_result['amount']; // if ($order->info['total'] - $total_deductions <= 0 ) { if ( (tep_round($order->info['total'], $currencies->currencies[$currency]['decimal_places']) - tep_round($ot_coupon->pre_confirmation_check($order->info['subtotal']), $currencies->currencies[$currency]['decimal_places'])) - tep_round($gv_payment_amount, $currencies->currencies[$currency]['decimal_places']) <= 0 ) {
  13. I believe what you may have missed here is to execute the SQL commands to add the CCVG tables to your database. You will need to launch your PHPMyAdmin, select your OSC database, Select the SQL tab, paste the SQL commands into the query window and click go Joe
  14. During my continuing my testing of CCVG v5.15 and I have found yet another bug. This bug speficially affects CCVG with the "Credit Class and Gift Voucher 'Easier to Understand' Payment Addon" v1.2 contribution installed. I believe this affects all versions of CCVG. In fact, it likely affects CCCVG without this add-on contribution. As we know CCVG provides the opportunity to provide Gift Vouchers and Discount Coupons. I have found a bug when both a Gift Voucher and a Coupon are applied at the same time to an order. This likely affects anyone using CCVG in this scenario. Here are the specifics: The problem: When a Gift Voucher total is more than the Grand Total (sub-total + tax + shipping) but is less than the Grand Total - Coupon amount and the Gift Voucher Tick Box is checked to cover the entire Grand Total the following payment error is produced: Please select a payment method for your order. If a credit card had already been selected before the Tick box was checked to cover the total amount, this error is produced: Credit Card Error! The first four digits of the number entered are: . If that number is correct, we do not accept that type of credit card. If it is wrong, please try again. The customer is unable to pay for the item and the order cannot be placed. Example: Sub-Total: $59.98 Shipping: $5.50 Tax: $2.34 Discount Coupons (1234): -$6.00 Total: $61.82 Gift Voucher Amount: $65.00 I found the problem to be located where the $credit_covers variable is set in /catalog/includes/classes/order_total.php in "Function Pre_Confirmation_Check". I resolved the problem as follows. Note: this fix addresses CCVG with the Easier 2 Understand Pament Add-on v1.2 Contribution installed: Find this code: global $payment, $order, $credit_covers, $customer_id; Replace it with this code: global $payment, $order, $credit_covers, $customer_id, $gv_payment_amount, $ot_coupon, $currency, $currencies; Find this code: $gv_query=tep_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . $customer_id . "'"); $gv_result=tep_db_fetch_array($gv_query); $gv_payment_amount = $gv_result['amount']; if ($order->info['total'] - $total_deductions <= 0 ) { Replace it with this code: $gv_query=tep_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . $customer_id . "'"); $gv_result=tep_db_fetch_array($gv_query); $gv_payment_amount = $gv_result['amount']; if ( (tep_round($order->info['total'], $currencies->currencies[$currency]['decimal_places']) - tep_round($ot_coupon->pre_confirmation_check($order->info['subtotal']), $currencies->currencies[$currency]['decimal_places'])) - tep_round($gv_payment_amount, $currencies->currencies[$currency]['decimal_places']) <= 0 ) { What was happening here is that the $credit_covers variable is set to true when the Gift Voucher is greater than the grand total. However, when there was a coupon applied, the grand total was less but this was not taken into account. So the change I made here was to make this calculation to set the $credit_covers variable: This is what it was doing: Order Total - Gift Voucher This is what is is doing now: (Order Total - Coupon) - Gift Voucher Joe
  15. Keith, I just remembered something. In /includes/modules/order_total/ot_coupon.php, in the CCVG code there is a statement as follows: /* you will need to uncomment this if your tax order total module is AFTER shipping eg you have all of your tax, including tax from shipping module, in your tax total. It seems that this could be your scenario here and that you would need to uncomment code to allow for shipping tax to pass through. Joe
×