This repository has been archived by the owner. It is now read-only.

Tracking total quantity of cart items #33

Merged
merged 4 commits into from Mar 27, 2013

Conversation

Projects
None yet
2 participants
Contributor

mykehsd commented Mar 27, 2013

Most sites I see out there like to display the total number of units displayed on the site, not just the number of unique cart items. This adds a new field total_quantity to track that value

EventListener/CartListener.php
@@ -113,5 +113,9 @@ private function refreshCart(CartInterface $cart)
{
$cart->calculateTotal();
$cart->setTotalItems($cart->countItems());
+ $totalQuantity = 0;
+ foreach ($cart->getItems() as $item)
+ $totalQuantity += $item->getQuantity();
@pjedrzejewski

pjedrzejewski Mar 27, 2013

Owner

{} should be added here anyway.

Owner

pjedrzejewski commented Mar 27, 2013

It requires a rebase probably, but looks like a good addition! Could you also add proper methods to CartInterface? Thanks!

Contributor

mykehsd commented Mar 27, 2013

Rebased from head and resolved previous changes

Owner

pjedrzejewski commented Mar 27, 2013

Perfect, thanks a lot Myke!

pjedrzejewski added a commit that referenced this pull request Mar 27, 2013

Merge pull request #33 from mykehsd/master
Tracking total quantity of cart items

@pjedrzejewski pjedrzejewski merged commit d44c26b into Sylius:master Mar 27, 2013

1 check was pending

default Scrutinizer: Running Analyses
Details
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.