- Posts: 18
- Thank you received: 0
Adding product to cart overrides existing product
- MaartenVdp
-
Topic Author
- Offline
Less
More
12 years 5 months ago #159383
by MaartenVdp
Adding product to cart overrides existing product was created by MaartenVdp
I created a plugin that does the following:
when you click "add to cart" button, it starts an editor where you can edit photos.
After your edit, a pdf file is created an put on the server (it can be printed afterwards).
My hikashop product is configured like this:
the product (product_id : x ) is created and a characteristic is linked to it (the dimension).
User workflow (without defect):
A user enters the product (x) page and selects the desired dimension.
A product with characteristic_id c1 is created and added to the cart.
The user wants to order a second edited photo and orders product x again, but now for another dimension (c2).
The cart contains now 2 records, one for product x with dimension c1 and one for product x with dimension c2.
Both containing an url to a different pdf file.
User workflow (with defect):
A user enters the product (x) page and selects the desired dimension.
A product with characteristic_id c1 is created and added to the cart.
The user wants to order a second edited photo and orders product x again, and now for the same dimension (c1).
The cart contains now 1 record, containing only the data of the last order.
==> should contain 2 records for the same product, with another pdf file linked.
How can I configure hikashop to behave like this?
when you click "add to cart" button, it starts an editor where you can edit photos.
After your edit, a pdf file is created an put on the server (it can be printed afterwards).
My hikashop product is configured like this:
the product (product_id : x ) is created and a characteristic is linked to it (the dimension).
User workflow (without defect):
A user enters the product (x) page and selects the desired dimension.
A product with characteristic_id c1 is created and added to the cart.
The user wants to order a second edited photo and orders product x again, but now for another dimension (c2).
The cart contains now 2 records, one for product x with dimension c1 and one for product x with dimension c2.
Both containing an url to a different pdf file.
User workflow (with defect):
A user enters the product (x) page and selects the desired dimension.
A product with characteristic_id c1 is created and added to the cart.
The user wants to order a second edited photo and orders product x again, and now for the same dimension (c1).
The cart contains now 1 record, containing only the data of the last order.
==> should contain 2 records for the same product, with another pdf file linked.
How can I configure hikashop to behave like this?
Please Log in or Create an account to join the conversation.
12 years 5 months ago #159390
by nicolas
Replied by nicolas on topic Adding product to cart overrides existing product
Hi,
The problem is not a HikaShop configuration issue but comes from the way your plugin is done.
Creating new products for different dimensions/files is actually not necessary.
You could simply use the same product for all of them.
What you should do is create custom item fields (menu Display>Custom fields in the Business edition) in order to store the user data (dimension and file link) when the product is added to the cart.
With products with custom item fields, the cart system automatically generates several rows of the same product in the cart if the custom fields data is different.
Here is a thread with valuable information on the add to cart with custom item fields when you want to push your data in them:
www.hikashop.com/forum/2-general-talk-ab...-product-fields.html
And if you need to have a different price for different values of the custom item fields, that's also possible with a custom price override plugin. You can see a simple example of that with our donation plugin:
demo.hikashop.com/index.php?option=com_h...show&cid=214&lang=en
The problem is not a HikaShop configuration issue but comes from the way your plugin is done.
Creating new products for different dimensions/files is actually not necessary.
You could simply use the same product for all of them.
What you should do is create custom item fields (menu Display>Custom fields in the Business edition) in order to store the user data (dimension and file link) when the product is added to the cart.
With products with custom item fields, the cart system automatically generates several rows of the same product in the cart if the custom fields data is different.
Here is a thread with valuable information on the add to cart with custom item fields when you want to push your data in them:
www.hikashop.com/forum/2-general-talk-ab...-product-fields.html
And if you need to have a different price for different values of the custom item fields, that's also possible with a custom price override plugin. You can see a simple example of that with our donation plugin:
demo.hikashop.com/index.php?option=com_h...show&cid=214&lang=en
Please Log in or Create an account to join the conversation.
Time to create page: 0.049 seconds