If this is your first visit, check our documentation. To post, register or login.
Forums / Setting Up Categories, Products, Attributes / quantity display in cart when using attributes quantity

quantity display in cart when using attributes quantity

Started by keneso on 3 Nov 2021, 4:56 PM · Views: 1,069

Results 1 to 5 of 5
3 Nov 2021, 4:56 PM
#1
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

quantity display in cart when using attributes quantity

1.5.7c

Follow-up of
https://www.zen-cart.com/showthread.php?228439-how-to-set-attributes-and-enable-multi-quantity-for-them

I set up as suggested by dbltoe (post #2), and works fine.

"Problem" is that in the cart it displays the attributes quantities under the product column, and in the actual quantity column it displays 1.

Now I copied this snip to the quantity column, and it does display the attributes list (and quantities) in the quantity column as well.

<?php
if ($product['flagShowFixedQuantity']) {
echo $product['showFixedQuantityAmount'] . '' . $product['flagStockCheck'] . '' . $product['showMinUnits'];
} else {
echo $product['quantityField'] . '' . $product['flagStockCheck'] . '' . $product['showMinUnits'];
}
?>

<?php // FZ taken from product column to show in quantity column
echo $product['attributeHiddenField'];
if (isset($product['attributes']) && is_array($product['attributes'])) {
echo '<ul>';
foreach ($product['attributes'] as $option => $value) {
?>
<li>
<?php
echo $value['products_options_name'] . TEXT_OPTION_DIVIDER . nl2br($value['products_options_values_name']);
?>
</li>
<?php
}
echo '</ul>';
}
?>
?>

With the above it displays 1 (for the actual item), and the corresponding values for the given attributes i.e.

1
small - 0
medium -2
large -1

My question:
Is there a simple snip I can add to have only

small - 0
medium -2
large -1

basically an if/elseif/else situation
I tried changing the else with elseif, and adding else for the attributes, but the page goes blank, so obviously I am missing something.

The ideal would be to have quantity fields to update the attributes quantity like you would have with the single product, but maybe another time ... don't want to push my luck, for now just removing the 1 is a step forward. ;)

Thank you

3 Nov 2021, 8:28 PM
#2
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,904
Plugin Contributions:
23

Re: quantity display in cart when using attributes quantity

Perhaps you are overthinking? Look at it as you have sold one set of boxes containing two medium and one large. Seems like the problem would be if it didn't tell you how many of each size.

As it is now, if the customer should order boxes twice, it keeps them separate.

Only drawback I see is if the customer wants to change the quantity of one size. They would have to delete the item and re-add.

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

3 Nov 2021, 10:28 PM
#3
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

Re: quantity display in cart when using attributes quantity

dbltoe:

Perhaps you are overthinking?
Easily ;)

dbltoe:

Look at it as you have sold one set of boxes containing two medium and one large. Seems like the problem would be if it didn't tell you how many of each size.
Trying to look at it from customer perspective, like they look at the quantity, and it says 1, whereas they ordered 3; but like you pointed out, I might be overthinking!

dbltoe:

As it is now, if the customer should order boxes twice, it keeps them separate.
Not sure I understand what you are saying.

dbltoe:

Only drawback I see is if the customer wants to change the quantity of one size. They would have to delete the item and re-add.
Yes, that is indeed the biggest limit.

4 Nov 2021, 10:06 AM
#4
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: quantity display in cart when using attributes quantity

keneso:

Not sure I understand what you are saying.
Right now, if a customer orders the above 0,2,1 quantity, but then goes back and orders a 0,0,1 quantity to bring the total to 0,2,2, the shopping cart will show "two" product. One made of the original 0,2,1 sequence and the other as 0,0,1. If they go back and order an additional 0,0,1 quantity then that product combo would show as a quantity of 2 of the 0,0,1 grouping.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

4 Nov 2021, 10:17 AM
#5
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

Re: quantity display in cart when using attributes quantity

mc12345678:

Right now, if a customer orders the above 0,2,1 quantity, but then goes back and orders a 0,0,1 quantity to bring the total to 0,2,2, the shopping cart will show "two" product. One made of the original 0,2,1 sequence and the other as 0,0,1. If they go back and order an additional 0,0,1 quantity then that product combo would show as a quantity of 2 of the 0,0,1 grouping.

Got it thank you.