13thjoker Posted October 30, 2017 Share Posted October 30, 2017 I am trying all sorts of things right now but whats the actual best way? Thanks already, 13th joker Link to comment Share on other sites More sharing options...
13thjoker Posted October 30, 2017 Author Share Posted October 30, 2017 (edited) Update: Works now $context = Context::getContext(); $cart = $context->cart; $cart->updateQty(1, 7); Is this the correct way to do this or is there a more efficient way? Or a better way. Edited October 30, 2017 by 13thjoker I updated since the previous message wasnt of use anymore so i created less mess by updating instead of making a 2nd comment (see edit history) Link to comment Share on other sites More sharing options...
catalin.pop Posted October 31, 2017 Share Posted October 31, 2017 (edited) <?php $context=Context::getContext();//new Cart(); $id_cart=$context->cookie->__get('id_cart'); $products_ids=$_GET['products_ids']; // comma seprated products id example : test.php?products_ids=1,2,3 $products_ids_array=explode(",",$products_ids); if(count($products_ids_array)>0){ $cart=new Cart($id_cart); $cart->id_currency=2; $cart->id_lang=1; foreach($products_ids_array as $key=>$id_product){ $cart->updateQty(1, $id_product); } } ?> Edited October 31, 2017 by catalin.pop (see edit history) Link to comment Share on other sites More sharing options...
13thjoker Posted November 1, 2017 Author Share Posted November 1, 2017 alright thanks. How would we do updateQty(-1, $productid); then? Becaulse i also need to make an action for that. But if i set it to -1 it deletes everything. 0 aswell. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now