Counting of the sold goods in each SKU.
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!
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
- ЕвгенияСемихова(ИПСемиховаЕ.А.)
- Posts: 70
- Joined: 11 Jan 2025, 09:45
Counting of the sold goods in each SKU.
At my old site was count of selling items.

Q: have Aimeos this functional? Place in database? Or necessary to add a new record to the database and make a separate query?
How will this be done more correctly, taking into account further Aimeos updates?

Q: have Aimeos this functional? Place in database? Or necessary to add a new record to the database and make a separate query?
How will this be done more correctly, taking into account further Aimeos updates?
Debian 12, PHP 8.3, Server 1 = Aimeos 2024.10.13, Server 2 = ES 8.17.1
life is full of many new and interesting things
life is full of many new and interesting things
Re: Counting of the sold goods in each SKU.
This isn't available yet in Aimeos and you have to create an own project specific Aimeos extension:
https://aimeos.org/docs/latest/developer/extensions/
Then, implement a HTML client decorator for the catalog/detail component:
https://aimeos.org/docs/latest/frontend ... omponents/
In the data() method of the decorator, add:
Finally, overwrite the catalog/detail template in your own extension and output the "productsOrdered" value:
https://aimeos.org/docs/latest/frontend ... templates/
This is save for updating because you don't change any code in the vendor directory which would be overwritten each time the package is updated.
https://aimeos.org/docs/latest/developer/extensions/
Then, implement a HTML client decorator for the catalog/detail component:
https://aimeos.org/docs/latest/frontend ... omponents/
In the data() method of the decorator, add:
Code: Select all
$manager = \Aimeos\MShop::create( $this->context, 'order' );
$filter = $manager->filter()->add( 'order.product.productid', '==', $this->get( 'detailProductItem' )?->getId() );
$view->productsOrdered = $manager->aggregate( $filter, 'order.product.productid', 'order.product.quantity'', 'sum' )->first();
https://aimeos.org/docs/latest/frontend ... templates/
This is save for updating because you don't change any code in the vendor directory which would be overwritten each time the package is updated.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,
