Phoenix 1.0.5.0 PHP 7.3
I have the Maximum Values in Configuration for "Product Quantities In Shopping Cart" set to 1 as 99.99% of my customers buy many different DVDs but just 1 of each but sometimes revisit an item that is in the cart already, click Add to Cart again and inadvertently buy 2 copies.
However I would like the Qty Up/Down arrows to still function in the cart to cater for the very occasional customer who is buying a second copy for a friend etc. The maximum Values setting reverts any Qty changes back to 1
Is this achievable please?
Martin
Cart Maximum Qty Values
-
- Lead Developer
- Posts: 2423
- Joined: Tue Oct 29, 2019 9:37 am
- : Buy Me A Beverage
- Has thanked: 49 times
- Been thanked: 137 times
Re: Cart Maximum Qty Values
I don't think you'll be able to have that as you are pulling in two directions in that tug of war;
pull to the right: limit buy ability to one
pull to the left: allow to buy more than one
Maybe the best way would be to have some type of message that says
"you have already bought this DVD"
That would only work for logged in customers though.
pull to the right: limit buy ability to one
pull to the left: allow to buy more than one
Maybe the best way would be to have some type of message that says
"you have already bought this DVD"
That would only work for logged in customers though.
Gamechanger Addon: Queued Emails, try before you buy.
-
- Lead Developer
- Posts: 2637
- Joined: Tue Nov 05, 2019 6:02 pm
- Has thanked: 4 times
- Been thanked: 181 times
Re: Cart Maximum Qty Values
1. Get rid of the maximum quantity setting (or make it high enough to cover the rare cases).
2. Override the add_product action.
Replacewith The max is just to make sure that if there are already two items in the cart, you don't reduce the number when reaching the cart. Possibly add more logic to change the message when this happens (you already have this in your cart; if you really want to update the quantity, please do so on the cart page). Make a similar change to buy_now if desired. Do not change update_product, which is what is used from the cart page.
I believe that this will give the behavior that you describe or close to it.
2. Override the add_product action.
Replace
Code: Select all
$qty = (!empty($_POST['qty'])) ? (int)$_POST['qty'] : 1;
$_SESSION['cart']->add_cart($_POST['products_id'], $_SESSION['cart']->get_quantity(tep_get_uprid($pid, $attributes))+$qty, $attributes);
Code: Select all
$_SESSION['cart']->add_cart($_POST['products_id'], max(1, $_SESSION['cart']->get_quantity(tep_get_uprid($pid, $attributes))), $attributes);
I believe that this will give the behavior that you describe or close to it.