Basket: add same product

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
heural
Posts: 58
Joined: 09 Jun 2022, 07:55

Basket: add same product

Post by heural » 12 Jul 2022, 07:27

Hi Aimeos-Team!

I want to add a product multiple to basket without add the quantity of the order item, but add a new order item.

The reason are designable products within an external editor.
So far I´ve extended the \Aimeos\MShop\Order\Item\Base\Product\Standard with my own impl. with a new column to save the "designable" parameters from the external editor. (https://aimeos.org/docs/latest/models/extend-managers/)

Now I look into the code Aimeos\MShop\Order\Item\Base\Base::addProduct and ::getSameProduct
and there are "getAttributeItems". Can we add attributes to an order-item during the "addProduct" or is these the original attributes from the product? Now I am confused with the extending the manager/item above.


Thx a lot!
Ralf

heural
Posts: 58
Joined: 09 Jun 2022, 07:55

Re: Basket: add same product

Post by heural » 12 Jul 2022, 08:33

I checked out the compare-Funktion in Aimeos\MShop\Order\Item\Base\Product\Standard and added my new column in my own implementation to the compare-condition and it worked.

User avatar
aimeos
Administrator
Posts: 7895
Joined: 01 Jan 1970, 00:00

Re: Basket: add same product

Post by aimeos » 13 Jul 2022, 06:53

Instead of storing the design parameters in an additional column, you can also store them in a custom product attribute. Then, products in the basket are also not merged together when they have different attribute values.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply