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

Load Position by ID or Model #6

Open
teone opened this issue Oct 7, 2013 · 0 comments
Open

Load Position by ID or Model #6

teone opened this issue Oct 7, 2013 · 0 comments

Comments

@teone
Copy link

teone commented Oct 7, 2013

Now to use the decrease the quantity of an Item I had to make this cycle:

$positions = Yii::app()->shoppingCart->getPositions();
                foreach($positions as $position) {
                    if ($position->id == $id){
                        $total = $position->getQuantity();
                        Yii::app()->shoppingCart->update($position,$total-1); //1 item with id=1, quantity=2.
                         $price = $position->getSumPrice();
                    } 
                }

Is this right?
If it is a

Yii::app()->shoppingCart->getPosition($book);

to load directly one resource without cycle trought all could be usefull.. Or maybe I just didn't find the right method to do this...

Kindly waiting for a feedback :) Thanks for your great Job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant