spear Posted December 18, 2010 Share Posted December 18, 2010 Thank you for this great contrib! How to show the calculated discount in shopping_cart.php just before Sub-total? Quote Link to comment Share on other sites More sharing options...
spear Posted December 18, 2010 Share Posted December 18, 2010 (edited) Please could someone help with a problem I have: the discount is not shown in emails sent to the customer or the store owner. Also the discount is missing in the invoice you see in the OSC admin panel. Edit: I am with osc v.2.2-MS2 Just tested on v.2.3 and there work fine :huh: Edited December 18, 2010 by spear Quote Link to comment Share on other sites More sharing options...
spear Posted December 19, 2010 Share Posted December 19, 2010 Problem solved with emails etc .. :thumbsup: Quote Link to comment Share on other sites More sharing options...
gsaadi Posted January 18, 2011 Share Posted January 18, 2011 Does this version work with OSC 2.3.1 Quote Link to comment Share on other sites More sharing options...
gsaadi Posted January 18, 2011 Share Posted January 18, 2011 does the v2.2 work on 2.3.1 Quote Link to comment Share on other sites More sharing options...
swguy Posted January 19, 2011 Author Share Posted January 19, 2011 Yes. Quote Contributions: Better Together and Quantity Discounts for osCommerce 2.3.x and Phoenix. See my profile for more details. Link to comment Share on other sites More sharing options...
geokar1100 Posted January 24, 2011 Share Posted January 24, 2011 (edited) Hi, I am using 2.3.1 I have installed the files twice and it's still not in the order totals module in admin. Is there something I missed? I installed Quantity Discounts Module for osCommerce 2.2 Version 1.0 --------------- Oops, I didn't see the Install Module button. I'll try that now. Edited January 24, 2011 by geokar1100 Quote Repetition is the key to success; Practice, Practice, Practice. No outside links in signatures allowed. Link to comment Share on other sites More sharing options...
geokar1100 Posted January 26, 2011 Share Posted January 26, 2011 The discounts work exactly like I want. Thanks for a great add-on. However, I use PayPal express with 2.3.1. I have read and re-read your article at http://www.thatsoftwareguy.com/osc_quantity_discounts.html under Payment Modules in osCommerce 2.2 and I can't figure it out. The discount is not showing up for me in PayPal Express. Is there a way to get the discounts to show up for me in 2.3.1? Quote Repetition is the key to success; Practice, Practice, Practice. No outside links in signatures allowed. Link to comment Share on other sites More sharing options...
swguy Posted January 26, 2011 Author Share Posted January 26, 2011 Is there a way to get the discounts to show up [for Paypal Express] in 2.3.1? I haven't done it enough times to write up a bulletproof procedure for the PP changes required to do this. If you want to hire me to do this for you, send me an email. Quote Contributions: Better Together and Quantity Discounts for osCommerce 2.3.x and Phoenix. See my profile for more details. Link to comment Share on other sites More sharing options...
TomShop Posted January 28, 2011 Share Posted January 28, 2011 Hi i have set up shop, need to shift some quantities in one of my categories.. is there any code to enable me in one of my categories to offer my customer say, every different item in that category is valued $2.50. buy 3 for $5, buy 8 for $10 etc? any of you help or expertise would be greatly appreciated, best regards, tom Quote Link to comment Share on other sites More sharing options...
swguy Posted January 29, 2011 Author Share Posted January 29, 2011 You can't group by item price in Quantity Discounts. Quote Contributions: Better Together and Quantity Discounts for osCommerce 2.3.x and Phoenix. See my profile for more details. Link to comment Share on other sites More sharing options...
osh Posted February 10, 2011 Share Posted February 10, 2011 (edited) Good contributions, but I'm having problems here with Taxes. (Sorry for my bad english from France) B) My store is in France and need to show Taxes. My store is calculating the tax on the initial subtotal of the order, if i check in the module " include tax "yes", recalculate "none".Normal But if a check recalculate "standard", then the post-discount subtotal is wrong and the Taxe with. (This is wrong in checkout_confirmation.php but right in shopping_cart.php and the boxes !!! <_< ) How to get the good and same total as in the cart ? and get the good tax, calculated on the price after reduction. Did anyone get a solution? Thank you Edited February 10, 2011 by osh Quote Link to comment Share on other sites More sharing options...
swguy Posted February 20, 2011 Author Share Posted February 20, 2011 My Quantity Discounts contribution works with osCommerce 2.3.1, for those who are considering upgrading. Quote Contributions: Better Together and Quantity Discounts for osCommerce 2.3.x and Phoenix. See my profile for more details. Link to comment Share on other sites More sharing options...
swguy Posted February 24, 2011 Author Share Posted February 24, 2011 A copy of Quantity Discounts has been placed in the osCommerce 2.3.1 download area. There are no code changes from the osCommerce 2.2 version, just a few additions to the installation instructions. Quote Contributions: Better Together and Quantity Discounts for osCommerce 2.3.x and Phoenix. See my profile for more details. Link to comment Share on other sites More sharing options...
GetSirius Posted March 7, 2011 Share Posted March 7, 2011 Wonder if I am misunderstanding this. I want to specify discounts for a product. For example if the customer buys more than 12, I would like to take $35 off the price of each item. So I do this, right? function apply_special_item_discount($id, $count, &$disc_amount) { switch($id) { case 19: if ($count > 12) { $disc_amount = 35; } break; Is this supposed to take $35 off of each item or does it only take $35 off of the order total no matter how many items over 12? I am only seeing $35 off of the order total. Fresh install of osC 2.3.1 thank you! Quote Link to comment Share on other sites More sharing options...
swguy Posted March 7, 2011 Author Share Posted March 7, 2011 You want $disc_amount = 35 * $count; not $disc_amount = 35; (You almost had it!) Quote Contributions: Better Together and Quantity Discounts for osCommerce 2.3.x and Phoenix. See my profile for more details. Link to comment Share on other sites More sharing options...
GetSirius Posted March 7, 2011 Share Posted March 7, 2011 That is what I want! Thank you! Quote Link to comment Share on other sites More sharing options...
GetSirius Posted March 9, 2011 Share Posted March 9, 2011 One more question. I would like to set things up have a higher price for quantity less than 6. Example: Less than 6 items: add $25 design fee 6-12 items: no discount, no design fee 12 - 24 items: $0.50 discount per item 25+ items: $1.00 discount per item This could be done by upping the price by $25, but that would make the item look too expensive. I tried the following but no luck. Can price increase rather than discount be done? case 20: if ($count > 24) { $disc_amount = 1 * $count; } else if ($count > 11) { $disc_amount = 0.5 * $count; } else if ($count < 6) { $disc_amount = -25; } break; Quote Link to comment Share on other sites More sharing options...
swguy Posted March 10, 2011 Author Share Posted March 10, 2011 I'd rather see you doing a fee than a negative Quantity Discount; this just looks too odd. Quote Contributions: Better Together and Quantity Discounts for osCommerce 2.3.x and Phoenix. See my profile for more details. Link to comment Share on other sites More sharing options...
densze Posted March 22, 2011 Share Posted March 22, 2011 I am using a tax module for canadian taxes, that calculate the tax from the products and quantity. It doesn't take into consideration your discount level. In the first section of this canadian tax module, it calculate function get_subtotal($order) by multpliying the products and quantity. Can i simply add the calucated discount onto this $subtotal variable ? what would be the code ? I am using 2.3.1 Here's the tax module <?php /* $Id: ot_tax.php, v1.3 BETA Canada Taxes Order Total Module (including Quebec) by Vincent Demers [email protected] released on 2008/04/13 hpdl Exp $ Update by Jacob (Jack) Gryn to check sort order if shipping comes after taxes, don't tax shipping Update by Vincent Demers to handle tax class on 2009/03/10 osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ function get_subtotal($order) { $sutotal=0; for($i=0; $i < sizeof($order->products); $i++) { //Add only products with taxable class if ($order->products[$i]['tax'] != 0) { $subtotal+=($order->products[$i]['qty']*$order->products[$i]['price']); } } return $subtotal; } 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; //WARNING: This module does not consider tax_class!!! We assume everything is taxable. //We run SQL to get total number of taxes configured for our shipping zone //If we have many taxes rates configured, we will compare tax priorities. //If taxes have different priorities, ot_tax will apply 2nd priority tax_rate over 1rst (ex: for Quebec we have PST over GST), we assume GST has the lowest priority. //If taxes have the same priorities, ot_tax still show taxes on two line but dosen't apply compounded taxes (ie: Ontario) //If we get only one tax result, we assume we are handling only GST or HST (same scenario) $tax_priority_query = tep_db_query("select tax_priority from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za on (tr.tax_zone_id = za.geo_zone_id) left join " . TABLE_GEO_ZONES . " tz on (tz.geo_zone_id = tr.tax_zone_id) where (za.zone_country_id = '" . $order->delivery['country']['id'] . "') and (za.zone_id = '" . $order->delivery['zone_id'] . "') order by tr.tax_priority"); $tax_query_raw="select tax_rates_id, tax_priority, tax_rate, tax_description from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za on (tr.tax_zone_id = za.geo_zone_id) left join " . TABLE_GEO_ZONES . " tz on (tz.geo_zone_id = tr.tax_zone_id) where (za.zone_country_id = '" . $order->delivery['country']['id'] . "') and (za.zone_id = '" . $order->delivery['zone_id'] . "') order by tr.tax_priority"; if (tep_db_num_rows($tax_priority_query)) { if (tep_db_num_rows($tax_priority_query) == 2) { //Show taxes on two lines $i=0; while ($tax = tep_db_fetch_array($tax_priority_query)) { //compare tax_priotiries if ($i == 0) { $tax_priority = $tax['tax_priority']; } else { if ($tax_priority != $tax['tax_priority']) { $compound_tax=true; } else { $compound_tax=false; } } $i++; } //END Compare tax priorities $tax_query = tep_db_query($tax_query_raw); if ($compound_tax) { //ie Quebec $j=0; while ($tax = tep_db_fetch_array($tax_query)) { if ($j == 0) { $gst_description = $tax['tax_description']; $gst_rate = $tax['tax_rate'] / 100; } elseif ($j >= 1) { $pst_description = $tax['tax_description']; $pst_rate = $tax['tax_rate'] / 100; } $j++; } //$subtotal = $order->info['subtotal']; $subtotal=get_subtotal($order); if(MODULE_ORDER_TOTAL_SHIPPING_SORT_ORDER < MODULE_ORDER_TOTAL_TAX_SORT_ORDER) $subtotal += $order->info['shipping_cost']; $gst_total = tep_round($subtotal * $gst_rate, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']); $pst_total = ($subtotal+$gst_total) * $pst_rate; reset($order->info['tax_groups']); while (list($key, $value) = each($order->info['tax_groups'])) { if ($value > 0) { $this->output[] = array('title' => $gst_description.':', 'text' => $currencies->format( $gst_total, true, $order->info['currency'], $order->info['currency_value']), 'value' => $gst_total); $this->output[] = array('title' => $pst_description.':', 'text' => $currencies->format( $pst_total, true, $order->info['currency'], $order->info['currency_value']), 'value' => $pst_total); } } } else { //ie: Ontario $j=0; while ($tax = tep_db_fetch_array($tax_query)) { if ($j == 0) { $gst_description = $tax['tax_description']; $gst_rate = $tax['tax_rate'] / 100; } elseif ($j >= 1) { $pst_description = $tax['tax_description']; $pst_rate = $tax['tax_rate'] / 100; } $j++; } //$subtotal = $order->info['subtotal']; $subtotal=get_subtotal($order); if(MODULE_ORDER_TOTAL_SHIPPING_SORT_ORDER < MODULE_ORDER_TOTAL_TAX_SORT_ORDER) $subtotal += $order->info['shipping_cost']; $gst_total = tep_round($subtotal * $gst_rate, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']); $pst_total = $subtotal * $pst_rate; reset($order->info['tax_groups']); while (list($key, $value) = each($order->info['tax_groups'])) { if ($value > 0) { $this->output[] = array('title' => $gst_description.':', 'text' => $currencies->format( $gst_total, true, $order->info['currency'], $order->info['currency_value']), 'value' => $gst_total); $this->output[] = array('title' => $pst_description.':', 'text' => $currencies->format( $pst_total, true, $order->info['currency'], $order->info['currency_value']), 'value' => $pst_total); } } } } elseif (tep_db_num_rows($tax_priority_query) == 1) { //Only GST or HST applies $tax_query = tep_db_query($tax_query_raw); while ($tax = tep_db_fetch_array($tax_query)) { //$subtotal = $order->info['subtotal']; $subtotal=get_subtotal($order); if(MODULE_ORDER_TOTAL_SHIPPING_SORT_ORDER < MODULE_ORDER_TOTAL_TAX_SORT_ORDER) $subtotal += $order->info['shipping_cost']; $hst_total = $subtotal * ($tax['tax_rate'] / 100); reset($order->info['tax_groups']); while (list($key, $value) = each($order->info['tax_groups'])) { if ($value > 0) { $this->output[] = array('title' => $tax['tax_description'].':', 'text' => $currencies->format( $hst_total, true, $order->info['currency'], $order->info['currency_value']), 'value' => $hst_total); } } } } } //We calculate $order->info with updated tax values. For this to work ot_tax has to be last ot module called, just before ot_total $order->info['tax'] = tep_round($gst_total,$currencies->currencies[DEFAULT_CURRENCY]['decimal_places']) + tep_round($pst_total,$currencies->currencies[DEFAULT_CURRENCY]['decimal_places']) + tep_round($hst_total,$currencies->currencies[DEFAULT_CURRENCY]['decimal_places']); $order->info['total'] = $order->info['subtotal'] + $order->info['tax'] + $order->info['shipping_cost']; } 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...
Guest Posted June 26, 2011 Share Posted June 26, 2011 (edited) Hi, Thank you SWGuy for this great contribution. Works fine, but I have a little question. How can I change the text color (only price numbers or full discount text) in checkout_confirmation.php? I use 2.3.1 regards Pan Edited June 26, 2011 by PanTira Quote Link to comment Share on other sites More sharing options...
swguy Posted June 27, 2011 Author Share Posted June 27, 2011 There isn't a way without changing code; nothing is built in. Quote Contributions: Better Together and Quantity Discounts for osCommerce 2.3.x and Phoenix. See my profile for more details. Link to comment Share on other sites More sharing options...
KimantisGroup Posted June 27, 2011 Share Posted June 27, 2011 Hi, I got your module all setup, it works in the shopping cart (and the receipt) and add the 48% discount if you buy 20 items but it is still charging the full amount on the credit card, I am wondering what could be wrong? Sub-Total: $25.00 Flat Rate (Best Way): $15.00 NB HST TAX 13.0%: $5.20 Quantity Discount: -$25.00 Total: $16.95 and it charged me 47$ on my credit card Please help, I am willing to send a donation for a quick response to fix this Quote Link to comment Share on other sites More sharing options...
swguy Posted June 27, 2011 Author Share Posted June 27, 2011 You probably have to make changes to your payment module. Some code fragments are provided here: http://www.thatsoftwareguy.com/osc_quantity_discounts.html#paymentmodules Quote Contributions: Better Together and Quantity Discounts for osCommerce 2.3.x and Phoenix. See my profile for more details. Link to comment Share on other sites More sharing options...
KimantisGroup Posted June 28, 2011 Share Posted June 28, 2011 I am using 2.3 unfortunately with Moneris PG, and you have no instructions, how much would you charge to fix this? 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.