[Skip to main content](#vessel-content)

#   Adding product to cart overrides existing product

##

- **[MaartenVdp](/forum/user/31636-maartenvdp "View MaartenVdp's Profile")**
- [![MaartenVdp's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/31636-maartenvdp "View MaartenVdp's Profile") Topic Author
- [ Offline](/forum/user/31636-maartenvdp)

Less More

- Posts: 18
- Thank you received: 0
-
-

12 years 5 months ago [\#159383](#159383) by [MaartenVdp](/forum/user/31636-maartenvdp "View MaartenVdp's Profile")  *[Adding product to cart overrides existing product](/forum/27-checkout/868849-adding-product-to-cart-overrides-existing-product#159383 "I created a plugin that does the following: when you click &quot;add to cart&quot; 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&#95;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&#95;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&#95;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. ==&gt; should contain 2 records for the same product, with another pdf file linked.  How can I configure hikashop to behave like this?")* was created by *[MaartenVdp](/forum/user/31636-maartenvdp "View MaartenVdp's Profile")*

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.
==&gt; 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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg2ODg0OS1hZGRpbmctcHJvZHVjdC10by1jYXJ0LW92ZXJyaWRlcy1leGlzdGluZy1wcm9kdWN0P3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14326
-
-

12 years 5 months ago [\#159390](#159390) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Adding product to cart overrides existing product](/forum/27-checkout/868849-adding-product-to-cart-overrides-existing-product#159390 "I created a plugin that does the following: when you click &quot;add to cart&quot; 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&#95;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&#95;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&#95;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. ==&gt; should contain 2 records for the same product, with another pdf file linked.  How can I configure hikashop to behave like this?")*

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&gt;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](http://www.hikashop.com/forum/2-general-talk-about-hikashop/16216-add-to-cart-link-and-custom-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&amp;cid=214&amp;lang=en](http://demo.hikashop.com/index.php?option=com_hikashop&ctrl=product&task=show&cid=214&lang=en)

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg2ODg0OS1hZGRpbmctcHJvZHVjdC10by1jYXJ0LW92ZXJyaWRlcy1leGlzdGluZy1wcm9kdWN0P3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.052 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
