Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize cart totals retrieving from menu builder #900

Merged
merged 1 commit into from
Jan 24, 2014

Conversation

winzou
Copy link
Contributor

@winzou winzou commented Jan 23, 2014

As part of our ongoing process of optimization.
$cartProvider->getCart() is actually creating the cart if not exist. That's a long process, and useless as we just want some figures from it. If the cart doesn't exist, then it's 0.

@winzou
Copy link
Contributor Author

winzou commented Jan 24, 2014

@pjedrzejewski weird, Travis is failing but I don't see any scenario or spec failing...?

pjedrzejewski pushed a commit that referenced this pull request Jan 24, 2014
Optimize cart totals retrieving from menu builder
@pjedrzejewski pjedrzejewski merged commit 42209df into Sylius:master Jan 24, 2014
@pjedrzejewski
Copy link
Member

Some crazy stuff, the build looks ok. Thanks Alexandre! 👍

@winzou winzou deleted the frontend/menu branch January 24, 2014 08:41
@kayue
Copy link
Contributor

kayue commented Jan 29, 2014

@winzou Bug found. hasCart() is null until getCart() is called.

https://github.com/Sylius/Sylius/blob/master/src/Sylius/Bundle/CartBundle/Provider/CartProvider.php#L97-L101

Should we try to get and set current cart in constructor?

        $cartIdentifier = $this->storage->getCurrentCartIdentifier();

        if ($cartIdentifier && $cart = $this->getCartByIdentifier($cartIdentifier)) {
            return $this->cart = $cart;
        }

@stloyd
Copy link
Contributor

stloyd commented Jan 29, 2014

@kayue Good catch, I'm trying to find solution for this now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Minor issues and PRs improving the current solutions (optimizations, typo fixes, etc.).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants