Jump to content

Add same products separately in cart


adamsilva01

Recommended Posts

Hey guys,

 

I want to add the same product in the cart multiple times, but as if they were different products. Do you know how I could do that programmatically? Basically I want the cart to look something like this:

 

Product 1

Product 2

Product 3

Product 1

Product 2

Product 2 

Link to comment
Share on other sites

The only way I managed to do that was to remove the attribute primary key in all the fields in the table cart_product so as to allow repeated rows with the same values. However, I don't know if that will affect the rest of the shop in any way. And also, when I did that, the shopping cart does not dynamically refresh. Do you know how I can force the refresh?

 

A main problem that appeared to me right now is the delete process. I've managed to add same products separately, but the deleteProduct function deletes based on the id_product and the id_cart. The rows in the database for equal products appear separately, but then it deletes everything that has the same id_product and same id_cart. Any idea on how to bypass this and only delete the product I selected? The only way I could think of was to add another column to the cart_product table like product_position. But then I have to add that column in a lot of places in the code, but I'm not sure exactly where..

Edited by adamsilva01 (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...