Okay, disregard the last--I found the version for Zencart. But I don't see how I can use it to allow set prices for a quantity purchase.
Printable View
Okay, disregard the last--I found the version for Zencart. But I don't see how I can use it to allow set prices for a quantity purchase.
There's one for ZenCart too. Please contact me through my site.
Hi Scott, probably my english is the bummer, but i can not find how to achieve this:
i have different prices for quantity, but not all items have the same price.
so idealy i would like to see my discounts as a sliding scale discount.
is that possible also?
if not, do you have a sollution :D
You would probably be better off with the built-in quantity discounts then, which allows per-item configuration of the discount.
I've had the embarrassing situation that my Zen Cart made obvious calculation errors in some situations, specifically when Quantity Discounts worked in combination with a discount coupon. I finally tracked down what seems like a bug (at least it worked as such for me). In includes/modules/order_total/ot_quantity_discount.php, function process() subtracts the discount from and adjusts the tax amounts in the global $order array. However, $order stores both a subarray of the separate taxes ($order->info['tax_groups']) and a total sum of those taxes ($order->info['tax']). In function process() the subarray is adjusted, but the total sum isn't. This can be fixed by adding a line...
...just after the line with the same adjustment to the subarray $order->info['tax_groups']. I hope this may help a few others avoid what I've just been through. :smile: Thanks a lot for this module btw - the user exits are brilliant for me, making it easy to set up customized discounts that couldn't be done via the admin interface.PHP Code:
$order->info['tax'] -= $od_amount[$key];
Thanks for posting this. What are your settings for admin-modules-order total-Quantity Discounts, and do you have multiple levels of tax? I'm just curious about why I haven't seen this before.
Later update: note that shopowners who recalculate tax should set the sort order for native discounting modules *above* (i.e. lower than) my modules. Otherwise they will need to make the changes described in https://www.thatsoftwareguy.com/zenc...resorting.html.
Include Tax: False
Re-calculate Tax: Standard
Sort Order: 200 (between Sub-Total and Discount Coupon)
Only one tax in my case (EU VAT). The ot_tax module only uses the subarray $order->info['tax_groups'], so the problem isn't seen in basic use. Perhaps combining Quantity Discounts with coupons is rare, but given how much this module has been used I'm also surprised this issue hasn't surfaced before.
I am installing 1.5.5e and need Quantity Discount for 3, 6, and 12 items. I only have 3 products to sell. The discount works great on each product. I also need to give discount on mixed. If customer buy's 3 different products they still would get a discount. Can the built-in quantity discount mod provide mix product discount? If so how do you set it up?
Use the Quantity Discount mod and set Discount Basis = Total Items in Cart in admin-modules-order total-quantity discounts.
I have a problem with Quantity Discounts and Edit Orders. When I purchase an item eligible for quantity discounts on the store-side, everything is fine. But when I edit that order in the admin, everything is correct except the order total. It is too low by the tax on the quantity discount amount. I have been discussing this issue on the Edit Orders support forum, beginning with post #1195, but I'm stuck. Has anyone successfully integrated these two plugins successfully? Any hints would be gratefully appreciated. ZC v155e, Quantity Discounts v1.12.1, Edit Orders v4.3.1.
Link to approximate location in EO thread: https://www.zen-cart.com/showthread....Thread/page123
I can repro this issue.
My store is set to display inclusive of tax. When I have a discount applied, the quantity total deductions and sub total after discounts are showing exclusive of tax.
I traced this down to classes/order.php line 293
In v1.5.5 this has been changed from
$taxCountryId = $taxZoneId = -1;
to
$taxCountryId = $taxZoneId = 0;
when it is -1 by default, the deductions and subtotal correctly show to include tax.
Is there any fix for this, apart from removing the updated code introduced in 1.5.5 ?
You may have found a bug. Could be the code should be more like
but I'm not sure.Code:if (DISPLAY_PRICE_WITH_TAX) {
$taxCountryId = $taxZoneId = -1;
} else {
$taxCountryId = $taxZoneId = 0;
}
Would you please put a post in https://www.zen-cart.com/forumdispla...40-Bug-Reports ?
(I would do it but they are likely going to want to ask you about various settings you have.)
PHP7 updates complete - see new version in the Plugins area.
Great plugin. I am also using the Dual Pricing plugin and was hoping someone can give me guidance to bypass quantity discounts for wholesale customers.
Thanks
My guidance would be, "buy a customized install from my store." :)
Hello there,
Is there a function statement to exclude items from the one time discount module, if they are already on special?
Thanks in Advance!
You should ask that question on the one time discount module support thread (or create one if it doesn't exist). This is the support thread for Quantity Discounts, which is a different module.
Sorry, I incorrectly referred to One Time Discount but it should be The Quantity Discount Module. Question should read:
Is there a function statement to exclude items from the quantity discounts module, if they are already on special?
Cheers!
There is not.
Thanks for the prompt reply and all your contributions.
Cheers!!!
Hope this is an acceptable post. I love this plugin and have been using it for many years successfully. Very easy to install.
I am currently updating the website to the newest ZenCart Version 1.5.7 and currently have the php at php7.3
I keep getting this error message:
PHP Deprecated: The each() function is deprecated.
The line this is referring to is from includes/modules/order_total/ot_quantity_discount.php
while (list($keypos, $listpos) = each($key_list)) {
Is there a change I can make to this line to fix the error message?
Let me know if more information is needed.
LOL I thought I had shaken all those out. Guess not.
Updated in the Plugins Library.
1.5.7
PHP 7.3.21
MySQL 5.7.31
OPC
News Box Manager
Sitemap XML
Quick Updates
Edit Orders
Base Item Price =$5 Looking to have the following for the category so that the discount is for any Suncatcher (ID #27)
Attachment 19151
In ot_quantity_discount.php, set toSettings in admin areCode:// Add categories with special discounting policies to this list. // Note that 99999, 99998 and 99997 are just given as examples.
// Note that the Discounting Units you specified in Admin
// (percentage, currency, currency/item) are also used here.
function apply_special_category_discount($category, $count, &$disc_amount) {
switch ($category) {
case 27:
if ($count > 2) {
$disc_amount = 4.5000;
}
if ($count > 5) {
$disc_amount = 4.2500;
}
if ($count > 8) {
$disc_amount = 4.0000;
}
break;
}
}
Attachment 19152
Discounts do not appear.
Could it be that I have all items by theme using the multilink?
When you say "discounts do not appear" you mean they don't show up on the checkout payment page?
If so, the issue is that the products in question do not have a master category id of 27. Check your database.
All items are master ID 27
I see now that the discount is showing (incorrectly) at checkout. I was hoping it would give the chart as shown in the first image rather than wait to show up at the "last minute".
Also, the settings do not reflect unit cost. e.g., any combination of suncatchers, $5 base price, add 12 to the cart. I need the price to drop to $4 each. With the current settings, the result is not $4 each but a $4 total discount.
The chart you are showing is from the native Quantity Discounts feature, not my Quantity Discounts plugin.
You can build something similar - look at the help on my site for Quantity Discounts, and search for "Marketing Text." You can also get Discount Preview to show the discount in the cart.
As for the calculation, you would have to multiply the $count variable by the unit price reduction to get the discount you want.
if ($count > 8) {
$disc_amount = 1 * $count;
}
etc.
Getting the following warning!
[20-Nov-2020 16:28:05 America/Chicago] PHP Warning: Use of undefined constant MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_TITLE - assumed 'MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_TITLE' (this will throw an Error in a future version of PHP) in /home/haremark/public_html/includes/modules/order_total/ot_quantity_discount.php on line 89
[20-Nov-2020 16:28:05 America/Chicago] Request URI: /index.php?main_page=shopping_cart, IP address: 204.95.11.126
#1 ot_quantity_discount->__construct() called at [/home/haremark/public_html/includes/modules/haredo/inc_qd.php:5]
#2 include_once(/home/haremark/public_html/includes/modules/haredo/inc_qd.php) called at [/home/haremark/public_html/includes/templates/haredo/templates/tpl_shopping_cart_default.php:175]
#3 require(/home/haremark/public_html/includes/templates/haredo/templates/tpl_shopping_cart_default.php) called at [/home/haremark/public_html/includes/templates/haredo/common/tpl_main_page.php:171]
#4 require(/home/haremark/public_html/includes/templates/haredo/common/tpl_main_page.php) called at [/home/haremark/public_html/index.php:97]
[20-Nov-2020 16:28:05 America/Chicago] PHP Warning: Use of undefined constant MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_DESCRIPTION - assumed 'MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_DESCRIPTION' (this will throw an Error in a future version of PHP) in /home/haremark/public_html/includes/modules/order_total/ot_quantity_discount.php on line 90
[20-Nov-2020 16:28:05 America/Chicago] Request URI: /index.php?main_page=shopping_cart, IP address: 204.95.11.126
#1 ot_quantity_discount->calculate_deductions() called at [/home/haremark/public_html/includes/modules/haredo/inc_qd.php:7]
[20-Nov-2020 16:28:05 America/Chicago] PHP Warning: Use of undefined constant YOUR_CURRENT_QUANTITY_DISCOUNT - assumed 'YOUR_CURRENT_QUANTITY_DISCOUNT' (this will throw an Error in a future version of PHP) in /home/haremark/public_html/includes/modules/order_total/ot_quantity_discount.php on line 238
[20-Nov-2020 16:28:05 America/Chicago] Request URI: /index.php?main_page=shopping_cart, IP address: 204.95.11.126
#1 ot_quantity_discount->calculate_deductions() called at [/home/haremark/public_html/includes/modules/haredo/inc_qd.php:7]
[20-Nov-2020 16:28:05 America/Chicago] PHP Warning: Use of undefined constant PER_ITEM_OFF - assumed 'PER_ITEM_OFF' (this will throw an Error in a future version of PHP) in /home/haremark/public_html/includes/modules/order_total/ot_quantity_discount.php on line 345
[20-Nov-2020 16:28:05 America/Chicago] Request URI: /index.php?main_page=shopping_cart, IP address: 204.95.11.126
#1 ot_quantity_discount->calculate_deductions() called at [/home/haremark/public_html/includes/modules/haredo/inc_qd.php:7]
[20-Nov-2020 16:28:05 America/Chicago] PHP Warning: Use of undefined constant ITEMS - assumed 'ITEMS' (this will throw an Error in a future version of PHP) in /home/haremark/public_html/includes/modules/order_total/ot_quantity_discount.php on line 345
[20-Nov-2020 16:28:05 America/Chicago] Request URI: /index.php?main_page=shopping_cart, IP address: 204.95.11.126
#1 ot_quantity_discount->calculate_deductions() called at [/home/haremark/public_html/includes/modules/haredo/inc_qd.php:7]
[20-Nov-2020 16:28:05 America/Chicago] PHP Warning: Use of undefined constant TOTAL_DISCOUNT - assumed 'TOTAL_DISCOUNT' (this will throw an Error in a future version of PHP) in /home/haremark/public_html/includes/modules/order_total/ot_quantity_discount.php on line 352
You are running old copies of Quantity Discounts and/or Discount Preview. You need to update both.
Quantity Discount: running latest Zen CartŪ Versions v1.5.4, v1.5.5, v1.5.6, v1.5.7
Preview subtotal: Paid module, Version 1.13
Zen Cart Version: 156c
PHP Version: 7.2.34 (Zend: 3.2.0)
Getting the following Warning below:
PHP Code:
[20-Nov-2020 23:04:26 America/Chicago] Request URI: /index.php?main_page=shopping_cart, IP address: 216.177.186.199
#1 ot_quantity_discount->__construct() called at [/home/haremark/public_html/includes/modules/haredo/inc_qd.php:5]
#2 include_once(/home/haremark/public_html/includes/modules/haredo/inc_qd.php) called at [/home/haremark/public_html/includes/templates/haredo/templates/tpl_shopping_cart_default.php:175]
#3 require(/home/haremark/public_html/includes/templates/haredo/templates/tpl_shopping_cart_default.php) called at [/home/haremark/public_html/includes/templates/haredo/common/tpl_main_page.php:171]
#4 require(/home/haremark/public_html/includes/templates/haredo/common/tpl_main_page.php) called at [/home/haremark/public_html/index.php:97]
[20-Nov-2020 23:04:26 America/Chicago] PHP Warning: Use of undefined constant MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_TITLE - assumed 'MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_TITLE' (this will throw an Error in a future version of PHP) in /home/haremark/public_html/includes/modules/order_total/ot_quantity_discount.php on line 89
[20-Nov-2020 23:04:26 America/Chicago] Request URI: /index.php?main_page=shopping_cart, IP address: 216.177.186.199
#1 ot_quantity_discount->__construct() called at [/home/haremark/public_html/includes/modules/haredo/inc_qd.php:5]
#2 include_once(/home/haremark/public_html/includes/modules/haredo/inc_qd.php) called at [/home/haremark/public_html/includes/templates/haredo/templates/tpl_shopping_cart_default.php:175]
#3 require(/home/haremark/public_html/includes/templates/haredo/templates/tpl_shopping_cart_default.php) called at [/home/haremark/public_html/includes/templates/haredo/common/tpl_main_page.php:171]
#4 require(/home/haremark/public_html/includes/templates/haredo/common/tpl_main_page.php) called at [/home/haremark/public_html/index.php:97]
[20-Nov-2020 23:04:26 America/Chicago] PHP Warning: Use of undefined constant MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_DESCRIPTION - assumed 'MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_DESCRIPTION' (this will throw an Error in a future version of PHP) in /home/haremark/public_html/includes/modules/order_total/ot_quantity_discount.php on line 90
[20-Nov-2020 23:04:26 America/Chicago] Request URI: /index.php?main_page=shopping_cart, IP address: 216.177.186.199
#1 ot_quantity_discount->calculate_deductions() called at [/home/haremark/public_html/includes/modules/haredo/inc_qd.php:7]
#2 include_once(/home/haremark/public_html/includes/modules/haredo/inc_qd.php) called at [/home/haremark/public_html/includes/templates/haredo/templates/tpl_shopping_cart_default.php:175]
#3 require(/home/haremark/public_html/includes/templates/haredo/templates/tpl_shopping_cart_default.php) called at [/home/haremark/public_html/includes/templates/haredo/common/tpl_main_page.php:171]
#4 require(/home/haremark/public_html/includes/templates/haredo/common/tpl_main_page.php) called at [/home/haremark/public_html/index.php:97]
[20-Nov-2020 23:04:26 America/Chicago] PHP Warning: Use of undefined constant YOUR_CURRENT_QUANTITY_DISCOUNT - assumed 'YOUR_CURRENT_QUANTITY_DISCOUNT' (this will throw an Error in a future version of PHP) in /home/haremark/public_html/includes/modules/order_total/ot_quantity_discount.php on line 238
[20-Nov-2020 23:04:26 America/Chicago] Request URI: /index.php?main_page=shopping_cart, IP address: 216.177.186.199
#1 ot_quantity_discount->calculate_deductions() called at [/home/haremark/public_html/includes/modules/haredo/inc_qd.php:7]
#2 include_once(/home/haremark/public_html/includes/modules/haredo/inc_qd.php) called at [/home/haremark/public_html/includes/templates/haredo/templates/tpl_shopping_cart_default.php:175]
#3 require(/home/haremark/public_html/includes/templates/haredo/templates/tpl_shopping_cart_default.php) called at [/home/haremark/public_html/includes/templates/haredo/common/tpl_main_page.php:171]
#4 require(/home/haremark/public_html/includes/templates/haredo/common/tpl_main_page.php) called at [/home/haremark/public_html/index.php:97]
[20-Nov-2020 23:04:26 America/Chicago] PHP Warning: Use of undefined constant PER_ITEM_OFF - assumed 'PER_ITEM_OFF' (this will throw an Error in a future version of PHP) in /home/haremark/public_html/includes/modules/order_total/ot_quantity_discount.php on line 345
[20-Nov-2020 23:04:26 America/Chicago] Request URI: /index.php?main_page=shopping_cart, IP address: 216.177.186.199
#1 ot_quantity_discount->calculate_deductions() called at [/home/haremark/public_html/includes/modules/haredo/inc_qd.php:7]
#2 include_once(/home/haremark/public_html/includes/modules/haredo/inc_qd.php) called at [/home/haremark/public_html/includes/templates/haredo/templates/tpl_shopping_cart_default.php:175]
#3 require(/home/haremark/public_html/includes/templates/haredo/templates/tpl_shopping_cart_default.php) called at [/home/haremark/public_html/includes/templates/haredo/common/tpl_main_page.php:171]
#4 require(/home/haremark/public_html/includes/templates/haredo/common/tpl_main_page.php) called at [/home/haremark/public_html/index.php:97]
[20-Nov-2020 23:04:26 America/Chicago] PHP Warning: Use of undefined constant ITEMS - assumed 'ITEMS' (this will throw an Error in a future version of PHP) in /home/haremark/public_html/includes/modules/order_total/ot_quantity_discount.php on line 345
[20-Nov-2020 23:04:26 America/Chicago] Request URI: /index.php?main_page=shopping_cart, IP address: 216.177.186.199
#1 ot_quantity_discount->calculate_deductions() called at [/home/haremark/public_html/includes/modules/haredo/inc_qd.php:7]
#2 include_once(/home/haremark/public_html/includes/modules/haredo/inc_qd.php) called at [/home/haremark/public_html/includes/templates/haredo/templates/tpl_shopping_cart_default.php:175]
#3 require(/home/haremark/public_html/includes/templates/haredo/templates/tpl_shopping_cart_default.php) called at [/home/haremark/public_html/includes/templates/haredo/common/tpl_main_page.php:171]
#4 require(/home/haremark/public_html/includes/templates/haredo/common/tpl_main_page.php) called at [/home/haremark/public_html/index.php:97]
[20-Nov-2020 23:04:26 America/Chicago] PHP Warning: Use of undefined constant TOTAL_DISCOUNT - assumed 'TOTAL_DISCOUNT' (this will throw an Error in a future version of PHP) in /home/haremark/public_html/includes/modules/order_total/ot_quantity_discount.php on line 352
All those constants are defined in ./includes/languages/english/modules/order_total/ot_quantity_discount.php.
- have you changed this file?
- have you created a new language and not copied in an updated version of this file?
Thank you Scott,
The preview_subtotal was the FIX !!
Mark
Hi Scott,
I have these errors in 157 using your updated plugin code and also after I compare the modifications for my site.
Can you help?
[01-Dec-2020 09:42:06 America/New_York] PHP Notice: Undefined offset: 68 in /Users/macminiserver/Sites/websites/MC2020/includes/modules/order_total/ot_quantity_discount.php on line 207
[01-Dec-2020 09:42:06 America/New_York] PHP Notice: Undefined offset: 68 in /Users/macminiserver/Sites/websites/MC2020/includes/modules/order_total/ot_quantity_discount.php on line 208
[01-Dec-2020 09:42:06 America/New_York] PHP Notice: Undefined index: 11001649:caff8fa231126a9775e9fcbad8c09ab1 in /Users/macminiserver/Sites/websites/MC2020/includes/modules/order_total/ot_quantity_discount.php on line 212
[01-Dec-2020 09:42:06 America/New_York] PHP Notice: Undefined index: 11001649:caff8fa231126a9775e9fcbad8c09ab1 in /Users/macminiserver/Sites/websites/MC2020/includes/modules/order_total/ot_quantity_discount.php on line 213
[01-Dec-2020 09:42:06 America/New_York] PHP Notice: Undefined variable: ccnum in /Users/macminiserver/Sites/websites/MC2020/includes/modules/payment/paypaldp.php on line 330
[01-Dec-2020 09:42:06 America/New_York] PHP Notice: Undefined variable: ccnum in /Users/macminiserver/Sites/websites/MC2020/includes/modules/payment/paypaldp.php on line 330
[01-Dec-2020 09:42:06 America/New_York] PHP Notice: Undefined offset: 68 in /Users/macminiserver/Sites/websites/MC2020/includes/modules/order_total/ot_quantity_discount.php on line 207
[01-Dec-2020 09:42:06 America/New_York] PHP Notice: Undefined offset: 68 in /Users/macminiserver/Sites/websites/MC2020/includes/modules/order_total/ot_quantity_discount.php on line 208
[01-Dec-2020 09:42:06 America/New_York] PHP Notice: Undefined index: 11001649:caff8fa231126a9775e9fcbad8c09ab1 in /Users/macminiserver/Sites/websites/MC2020/includes/modules/order_total/ot_quantity_discount.php on line 212
[01-Dec-2020 09:42:06 America/New_York] PHP Notice: Undefined index: 11001649:caff8fa231126a9775e9fcbad8c09ab1 in /Users/macminiserver/Sites/websites/MC2020/includes/modules/order_total/ot_quantity_discount.php on line 213
[01-Dec-2020 09:42:06 America/New_York] PHP Notice: Undefined variable: ccnum in /Users/macminiserver/Sites/websites/MC2020/includes/modules/payment/paypaldp.php on line 330
Turn off notices. These are low priority issues that don't really affect your site.
Hi Scott,
As a loyal user of quantity discounts I want give you a heads-up about a warning I found in the logs.
I'm using v1.5.7c on PHP 7.4.15 and presume it's neglectable for now because "future versions" must be PHP 8.x.xCode:
[08-Mar-2021 09:03:55 Europe/Brussels] Request URI: /index.php?main_page=checkout_process, IP address: *.*.*.*
#1 ot_quantity_discount->__construct() called at [*/www/includes/classes/order_total.php:51]
#2 order_total->__construct() called at [*/www/includes/modules/checkout_process.php:60]
#3 require(*/www/includes/modules/checkout_process.php) called at [*/www/includes/modules/pages/checkout_process/header_php.php:14]
#4 require(*/www/includes/modules/pages/checkout_process/header_php.php) called at [*/www/index.php:35]
--> PHP Warning: Use of undefined constant MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_COUNTING_METHOD - assumed 'MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_COUNTING_METHOD' (this will throw an Error in a future version of PHP) in */www/includes/modules/order_total/ot_quantity_discount.php on line 117.
Also the sale went along just fine.
Is there a "quick fix" for it or does it require "thorough" editing?
a) Go to the Plugins area and be sure you have the latest copy of Quantity Discounts.
b) Go to Admin > Modules > Order Total > Quantity Discounts, note your settings, then do a REMOVE and INSTALL of the module.
The same admin warnings were given when I went to order total page, select the module, remove and confirmed remove.
It's the most recent version: 1.14
In the original file the troubled line in question is on 91
Extra lines because I did edit in some extra custom discounts in line 51
Once reinstalled without changing any files, no more warnings. I guess this falls under: "Did you try rebooting it?"
Thanks!
You updated the module (presumably a while back) but didn't do a REMOVE/INSTALL - which was required because there were new config values added.
That's what caused the warning -that's why I wanted you to do a remove and reinstall.
I'm working on some infrastructure for the modules script to handle things like this better so a remove/reinstall isn't required.
I updated Zen Cart from v1.5.3 starting last January. I missed the requirement of REMOVE/INSTALL going from v1.12.1 to v1.14 Learned something extra again.
Not Zen Cart - Quantity Discounts. But no worries - soon this step will be done automatically, and now you know what to do.
Updated for PHP8.