high-quality-php-coding Posted May 11, 2010 Share Posted May 11, 2010 Discount code module allows you to assign a discount code to a product, category (for each product of this category) and total order. You can specify a fixed discount rate or a percentage of the total order, set expiration date and minimum order amount for a discount code. Quote Link to comment Share on other sites More sharing options...
kdupuis Posted May 12, 2010 Share Posted May 12, 2010 Hi,  I downloaded the Discount Code contribution and really like it. There is one problem with calculating taxes. When I have a discount code set up for 10% on a category. It does not calculate the tax portion properly.  Example:  Subtotal: $590.00 Discount: $59.00 5% Tax: $29.50 Total: $560.50  The tax amount should be 26.55 and the Total should be $557.55  Here is the ot_tax.php as requested:    <?php /* $Id: ot_tax.php 1739 2007-12-20 00:52:16Z hpdl $  osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com  Copyright © 2003 osCommerce  Released under the GNU General Public License */  class ot_tax { var $title, $output;  function ot_tax() { $this->code = 'ot_tax'; $this->title = MODULE_ORDER_TOTAL_TAX_TITLE; $this->description = MODULE_ORDER_TOTAL_TAX_DESCRIPTION; $this->enabled = ((MODULE_ORDER_TOTAL_TAX_STATUS == 'true') ? true : false); $this->sort_order = MODULE_ORDER_TOTAL_TAX_SORT_ORDER;  $this->output = array(); }  function process() { global $order, $currencies;  reset($order->info['tax_groups']); while (list($key, $value) = each($order->info['tax_groups'])) { if ($value > 0) { $this->output[] = array('title' => $key . ':', 'text' => $currencies->format($value, true, $order->info['currency'], $order->info['currency_value']), 'value' => $value); } } }  function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_TAX_STATUS'"); $this->_check = tep_db_num_rows($check_query); }  return $this->_check; }  function keys() { return array('MODULE_ORDER_TOTAL_TAX_STATUS', 'MODULE_ORDER_TOTAL_TAX_SORT_ORDER'); }  function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Tax', 'MODULE_ORDER_TOTAL_TAX_STATUS', 'true', 'Do you want to display the order tax value?', '6', '1','tep_cfg_select_option(array(\'true\', \'false\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_ORDER_TOTAL_TAX_SORT_ORDER', '3', 'Sort order of display.', '6', '2', now())"); }  function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } } ?> Quote Link to comment Share on other sites More sharing options...
james_uk Posted May 13, 2010 Share Posted May 13, 2010 Hi, I've chosen osCommerce because of this module (no other open source shopping cart system features a per-product discount). Potentially great module so thanks in advance but it does not work for me yet. Â I installed the module to the instructions exactly and activated it. I have entered a discount code against a product and run through the purchase of that product. The discount line is not appearing in the 'Order Confirmation' screen of the checkout process and the total is not affected by the discount. Â Is anybody else having an issue with this module? Any advice appreciated... Quote Link to comment Share on other sites More sharing options...
james_uk Posted May 13, 2010 Share Posted May 13, 2010 Okay, self-solved, for the moment. I played around with the 'sort order' of the 'Order Total Modules' section of the module administration. I positioned this module as no.4 and re-positioned the total as no. 5 Quote Link to comment Share on other sites More sharing options...
robweidman Posted May 13, 2010 Share Posted May 13, 2010 I too like the concept of the module. However, my site utilizes the one-page checkout, as do many others. Can anyone offer advice as to where to place the appropriate code on the checkout_shipping and/or checkout_confirmation pages? Thanks. cantex123 1 Quote Link to comment Share on other sites More sharing options...
cantex123 Posted May 19, 2010 Share Posted May 19, 2010 I too like the concept of the module. However, my site utilizes the one-page checkout, as do many others. Can anyone offer advice as to where to place the appropriate code on the checkout_shipping and/or checkout_confirmation pages? Thanks. Â Â I installed the module to the instructions exactly and activated it. I have entered a discount code against a product and run through the purchase of that product. The discount line is not appearing in the 'Order Confirmation' screen of the checkout process and the total is not affected by the discount. i change the sort order too, but still not working. Â Help anyone, Â Thanks in advanced. Quote Link to comment Share on other sites More sharing options...
Dettels Posted May 27, 2010 Share Posted May 27, 2010 Hello This time my experience: Discount on category -> tax calculation works with version 2.4. Discounts on individual products -> tax calculation does not work Fixed amount as a discount (eg 5 €) on total -> tax calculation does not work Display value after coupon: ---> There is always value without tax In short, the part is not usable.  Greetings Quote Link to comment Share on other sites More sharing options...
GraphicsGuy Posted August 24, 2010 Share Posted August 24, 2010 I just installed it and by adjusting the sort order it works. But I did notice that it does not seem to work with percentage discounts. (unless I am missing something) For example I can enter 1.00 and it deducts $1 properly and it shows up everywhere it should. But if I enter 10% as the discount, it accepts it in the admin panel, accepts the code at checkout but doesn't make any entries on the summary, invoice or email and doesn't deduct from the total. Quote Rule #1: Without exception, backup your database and files before making any changes to your files or database. Rule #2: Make sure there are no exceptions to Rule #1. Link to comment Share on other sites More sharing options...
rhubarb Posted August 24, 2010 Share Posted August 24, 2010 In admin > Vouchers/Coupons > Coupon Admin there's a 'Coupon Description' which has a note along side that says "A description of the coupon for the customer", but where does the customer see this appear? Quote Link to comment Share on other sites More sharing options...
GraphicsGuy Posted August 24, 2010 Share Posted August 24, 2010 In admin > Vouchers/Coupons > Coupon Admin there's a 'Coupon Description' which has a note along side that says "A description of the coupon for the customer", but where does the customer see this appear? Â That sounds like a different (similar) contribution. Perhaps CCGV (Credit Class Gift Voucher). The Discount Code contrib's admin panel section is titled Discount Codes and I don't see any place to enter coupon description. Quote Rule #1: Without exception, backup your database and files before making any changes to your files or database. Rule #2: Make sure there are no exceptions to Rule #1. Link to comment Share on other sites More sharing options...
nacid Posted August 25, 2010 Share Posted August 25, 2010 how do I apply the code and see it without going to checkout_confirmation page? Â NN Quote Link to comment Share on other sites More sharing options...
GraphicsGuy Posted August 25, 2010 Share Posted August 25, 2010 how do I apply the code and see it without going to checkout_confirmation page? Â NN Â As far as I can tell, this contrib doesn't have that ability. It is pretty simple code and bare bones functions. That is actually why I am using it. I have quite a few mods in my store and adding this one avoided some of the complications the other more robust ones were. Â If you wanted to add that feature to this, it shouldn't be too complicated for a osc experienced coder to create a java script to display it on page and update the total and then put an "apply" button next to the code entry box that would trigger the javascript. Quote Rule #1: Without exception, backup your database and files before making any changes to your files or database. Rule #2: Make sure there are no exceptions to Rule #1. Link to comment Share on other sites More sharing options...
nacid Posted August 25, 2010 Share Posted August 25, 2010 As far as I can tell, this contrib doesn't have that ability. It is pretty simple code and bare bones functions. That is actually why I am using it. I have quite a few mods in my store and adding this one avoided some of the complications the other more robust ones were. Â If you wanted to add that feature to this, it shouldn't be too complicated for a osc experienced coder to create a java script to display it on page and update the total and then put an "apply" button next to the code entry box that would trigger the javascript. Â thanks for the prompt reply. code is working fine. just you are not able to see the discount unless put credit card details and go to the next page. Quote Link to comment Share on other sites More sharing options...
nacid Posted August 25, 2010 Share Posted August 25, 2010 As far as I can tell, this contrib doesn't have that ability. It is pretty simple code and bare bones functions. That is actually why I am using it. I have quite a few mods in my store and adding this one avoided some of the complications the other more robust ones were. Â If you wanted to add that feature to this, it shouldn't be too complicated for a osc experienced coder to create a java script to display it on page and update the total and then put an "apply" button next to the code entry box that would trigger the javascript. Â Â Any idea why it's not working with PayPal IPN v2.3.4.6 payment module? Â Paypal get the total without the discount. Â Thanks Quote Link to comment Share on other sites More sharing options...
GraphicsGuy Posted August 25, 2010 Share Posted August 25, 2010 Any idea why it's not working with PayPal IPN v2.3.4.6 payment module?  Paypal get the total without the discount.  Thanks  I haven't tested mine on PayPal. Just guessing here, but maybe the PayPal IPN module takes the subtotal, shipping and tax amounts and calculates its own total. In which case the IPN module would have to be modified.  Or the simple workaround would be to change the sort order in the admin->modules->Order Total page so that the Discount Code module is ahead of the subtotal. (that is assuming that the reason for the PayPal problem is that it is calculating its own final total.  Of course you would have to check your local sales tax laws before changing when the sales tax is calculated. Some jurisdictions require discounts to be deducted after tax is computed so that the customer is paying sales tax on the full amount. In determining that you may have to consider how you will be using the discount. If it is promotional discount or coupon, I think most jurisdictions will allow pretax deducting of the discount. But if it is described as a rebate almost all jurisdictions require it to be deducted after tax computation. Quote Rule #1: Without exception, backup your database and files before making any changes to your files or database. Rule #2: Make sure there are no exceptions to Rule #1. Link to comment Share on other sites More sharing options...
rickharr Posted August 31, 2010 Share Posted August 31, 2010 (edited) Opps wrong add on support thread Rick H Edited August 31, 2010 by rickharr Quote Link to comment Share on other sites More sharing options...
GraphicsGuy Posted August 31, 2010 Share Posted August 31, 2010 I got curious and clicked the contribution author's profile. I hate to say it but it kind of looks like this contribution has been orphaned. The author "high-quality-php-coding" registered May 10 and posted the contribution. On May 11th set up this support thread. On May 16th posted an update to the contribution. And hasn't returned to this forum since May 17th in spite of issues posted on the thread. Â It's a shame. It is a nice simple approach to coupon codes with a neat clean admin screen. Quote Rule #1: Without exception, backup your database and files before making any changes to your files or database. Rule #2: Make sure there are no exceptions to Rule #1. Link to comment Share on other sites More sharing options...
Shadow-Lord Posted September 24, 2010 Share Posted September 24, 2010 Hi, Â Great Addon. Â There is one problem, the discount isn't been carried on to PayPal. Is there any fix for this please. Â Thanks. Quote Link to comment Share on other sites More sharing options...
kevinb456 Posted September 25, 2010 Share Posted September 25, 2010 It seems the creator is still actively working on this mod - just not avid forum goers like us :) check out http://high-quality-php-coding.com/discount_code_module_for_oscommerce.html where there are updates 2.3, 2.4 and 2.5 which together add some very nice additions and tax fixes (not sure if they work 100% i haven't tested). Â I'm getting my shop setup for 1st october and this is one of the last hurdles (getting it to work with paypal IPN 2.3.4.6) - so hopefully I'll find a solution... I'll keep you all updated of course. Â Otherwise this is a very well constructed mod and I likey likey! Quote Link to comment Share on other sites More sharing options...
kevinb456 Posted September 25, 2010 Share Posted September 25, 2010 (edited) I've found the solution to making this mod work with Paypal IPN 2.3.4.6 :thumbsup: This may also work with other paypal mods and other discount mods, but you need to check the variable names to be certain. This is only for use with the Paypal IPN module set to 'aggregate' mode, not 'per item' (although it would work with a bit of modification).   Open \catalog\includes\modules\payment\paypal_ipn.php  Find the code:  if(MOVE_TAX_TO_TOTAL_AMOUNT == 'True') { $parameters['amount'] = number_format(($subtotal + $order->info['tax']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency)); } else { // default $parameters['amount'] = number_format($subtotal * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency)); $parameters['tax'] = number_format($order->info['tax'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency)); }  (make sure this is correct, there's another 'IF' block that looks very similar in a different loop) Add the following code directly after:  if (isset($order_total['ot_discount'])) { $parameters['discount_amount'] = number_format(($order_total['ot_discount']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency)); }   Done!  The discount will now be included in the paypal payment page, and its event under a special 'discount' heading so your customer can see how much they're saving!   EDIT: I guess you could also set the variable 'discount_amount_cart' instead of 'discount_amount' (see https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_Appx_websitestandard_htmlvariables), but this seems to work so I haven't played around too much. 'discount_amount_cart' is infact for the whole cart so this may work better for aggregate mode. Edited September 25, 2010 by kevinb456 Quote Link to comment Share on other sites More sharing options...
move_man Posted October 6, 2010 Share Posted October 6, 2010 Hy,  is it possible that you einbaust in the module nor the new customers will automatically receive discounts? or there is a discount code discount allows new customers only? or the first time the customer order  Thanks Marvin Quote Link to comment Share on other sites More sharing options...
Tesoro Design Posted October 6, 2010 Share Posted October 6, 2010 I have tried searching the forums and have seen that people are having the same issue, I know that they have resolved it because they have moved on to different issues that would only result if they resolved it. I am new to OS Commerce and php. I know html and css, but I need help badly here. Â My Issue: I installed everything, followed the directions perfectly, checked 4 times everything. I can even create coupons but when you checkout, there is nowhere to enter the discount code. I am assuming that the reason is because in the directions, it asks you to go to Modules > Order Total > Discount Coupons, but there is no Discount Coupons option in the Order Total area. Â Any help with this would be greatly appreciated. Â Thanks in Advance, Â Simon Quote Link to comment Share on other sites More sharing options...
GraphicsGuy Posted October 6, 2010 Share Posted October 6, 2010 I have tried searching the forums and have seen that people are having the same issue, I know that they have resolved it because they have moved on to different issues that would only result if they resolved it. I am new to OS Commerce and php. I know html and css, but I need help badly here.  My Issue: I installed everything, followed the directions perfectly, checked 4 times everything. I can even create coupons but when you checkout, there is nowhere to enter the discount code. I am assuming that the reason is because in the directions, it asks you to go to Modules > Order Total > Discount Coupons, but there is no Discount Coupons option in the Order Total area.  Any help with this would be greatly appreciated.  Thanks in Advance,  Simon  My first thought would be to check to make sure the file:  .../catalog/includes/modules/ot_discount.php  uploaded correctly. If it is missing or got fouled during upload I think it would cause that effect. And if it didn't, I would check the other files that get uploaded to make sure they are ok while you are at it.  Second possibility - make sure you are looking for the right thing in the admin panel. If it is the "Discount Code" contrib that you installed and not the "Discount Coupon" one, then when you go to modules>order total in the admin panel, one of the items on the main part of the screen should be "Discount Code". Select it by clicking once on it. After the page reloads, click the "Install" button. After that completes, set the sort order.  If you installed the "Discount Coupon" contrib, that is a whole other bear and different support thread. Quote Rule #1: Without exception, backup your database and files before making any changes to your files or database. Rule #2: Make sure there are no exceptions to Rule #1. Link to comment Share on other sites More sharing options...
GraphicsGuy Posted October 6, 2010 Share Posted October 6, 2010 Hy,  is it possible that you einbaust in the module nor the new customers will automatically receive discounts? or there is a discount code discount allows new customers only? or the first time the customer order  Thanks Marvin  Doesn't look like there is feature like that. But here is how I would approach it:  Use the new version from the author's website mentioned a few posts above. It has the added feature of letting you limit the number of times per customer it can be used, for example one time per customer. Set up a discount code for use as a new customer discount. Add the new customer discount code and a sentence or two of explanation to the new account setup page. Either make the code real easy to remember or else encourage them to write it down. My way would be to make it real easy since the customer can only use it once anyway. hth      Quote Rule #1: Without exception, backup your database and files before making any changes to your files or database. Rule #2: Make sure there are no exceptions to Rule #1. Link to comment Share on other sites More sharing options...
Tesoro Design Posted October 6, 2010 Share Posted October 6, 2010 My first thought would be to check to make sure the file:  .../catalog/includes/modules/ot_discount.php  uploaded correctly. If it is missing or got fouled during upload I think it would cause that effect. And if it didn't, I would check the other files that get uploaded to make sure they are ok while you are at it.  Second possibility - make sure you are looking for the right thing in the admin panel. If it is the "Discount Code" contrib that you installed and not the "Discount Coupon" one, then when you go to modules>order total in the admin panel, one of the items on the main part of the screen should be "Discount Code". Select it by clicking once on it. After the page reloads, click the "Install" button. After that completes, set the sort order.  If you installed the "Discount Coupon" contrib, that is a whole other bear and different support thread.  I did do the Discount Coupons, is there another thread for that here? 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.