senso321 Posted January 30, 2014 Share Posted January 30, 2014 (edited) Dear all, i got a very interesting question for you all. How am I able to add a product from a custom moduel page to shopping cart?All my products info comes from a database where they are linked with ID-s. Im able to get all the information regarding the product with simple database and php calls, but how am i able to pass the product info into shopping cart so my client can make a purasche ? There is no information available regarding this question. Also i have checked classes/cart.php and controllers/front/cartcontroller.php for such functions, but there seems to be nothing like that to achieve my goal. Help me please BR's Edited January 30, 2014 by senso321 (see edit history) Link to comment Share on other sites More sharing options...
senso321 Posted January 30, 2014 Author Share Posted January 30, 2014 This is almost like a habit with my topics. Here is the solution $Cart = $this->context->cart; $Cart->updateQty($quantity, $id_product, $id_product_attribute = null, $id_customization = false, $operator = 'up', $id_address_delivery = 0, $shop = null, $auto_add_cart_rule = true); BR's 1 Link to comment Share on other sites More sharing options...
dirsubmit Posted February 21, 2014 Share Posted February 21, 2014 This is almost like a habit with my topics. Here is the solution $Cart = $this->context->cart; $Cart->updateQty($quantity, $id_product, $id_product_attribute = null, $id_customization = false, $operator = 'up', $id_address_delivery = 0, $shop = null, $auto_add_cart_rule = true); BR's Hi, I'm trying to do the same thing and came across your post. Can you elaborate more on how to do this? is the above code what's needed to grab the product information and throw it in the cart? Can you show a more full example please? Thanks! Link to comment Share on other sites More sharing options...
senso321 Posted February 21, 2014 Author Share Posted February 21, 2014 What do you want to know. $Cart = $this->context->cart; This line get's the cart context from cookies ( all the info relevant to cart - it's id and so on )And the 2nd line $Cart->updateQty($quantity, $id_product, $id_product_attribute = null, $id_customization = false, $operator = 'up', $id_address_delivery = 0, $shop = null, $auto_add_cart_rule = true); Uses updateQty function located in classes/cart.php . As we are developing by OOP then we can use it to simply pass the product info to cart. You have to provide quantity - $quantity, product id - $id_product and attribute combinaion ( if you are using combinations ) - $id_product_attribute.Im personally using it within a ajax file within a foreach loop to pass all the related products ( when certain conditions are met ) to the cart.BR's Link to comment Share on other sites More sharing options...
Med6 Posted May 2, 2014 Share Posted May 2, 2014 DO you have any idea how to get the cart of a client? Link to comment Share on other sites More sharing options...
vekia Posted May 2, 2014 Share Posted May 2, 2014 $cart = new Cart($id); where $id is a cart of your client. 1 Link to comment Share on other sites More sharing options...
beginner1 Posted December 23, 2017 Share Posted December 23, 2017 On 1/30/2014 at 6:12 PM, senso321 said: This is almost like a habit with my topics. Here is the solution $Cart = $this->context->cart; $Cart->updateQty($quantity, $id_product, $id_product_attribute = null, $id_customization = false, $operator = 'up', $id_address_delivery = 0, $shop = null, $auto_add_cart_rule = true); BR's How are you handling the product sizes? like there can be a small, medium or large product. Where are you giving those ids? 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