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)
#4073 by NewUser
27 Mar 2017, 05:10
I need to select the popular products from a list of products. mshop_product is the database table name for the list of products. But here, there is no field marked as popular product or something like that. Is there a way to fetch the popular products from the database table? If so, which is that table and the corresponding table name?
#4079 by gilbertsoft
27 Mar 2017, 14:31
Are you talking about Promotions? If yes, have a look at typo3conf/ext/aimeos/Resources/private/Extensions/ai-client-html/client/html/src/Client/Html/Catalog/Lists/Promo/Standard.php. There you find the filter params in the function setViewParams on the bottom of the code.

The related tables are mshop_catalog, mshop_catalog_list, mshop_catalog_list_type and mshop_product.
#4080 by NewUser
27 Mar 2017, 14:45
I am not talking about promotions. I need to display the popular products. It can be on the basis of the number of buyers. If one particular product is bought by many customers, it is said to be as a popular product. Like that, whether there is any way to fetch such informations??
Currently what I did was, I created another category named popular products and dropped the products into that category. Is that a way for making popular products view in the frontend?
#4087 by gilbertsoft
27 Mar 2017, 17:31
Yes, but depends on your requirements or how and where you want to show the products.

An other solution can be creating a new list type (like the promotions) in mshop_catalog_list_type and show the assigned products in top of the product list like promotions are done or like you need it. Have a look at the files mentioned in the last post and the corresponding templates in typo3conf/ext/aimeos/Resources/Private/Extensions/ai-client-html/client/html/templates/catalog/lists/. So you are able to assign the products to every category you want to and not only showing them in one category.

To get the whole thing automated on sells you have to adapt the fetching of the products in the function setViewParams. Of course then you don't anymore need the new list type to filter the products.
#4090 by aimeos
27 Mar 2017, 21:25
You can do the following:
- Sorting by relevance is just sorting by positions within a category, so you can change the product positions in the categories (manually or automatically)
- Create a new category including all products with positions according the number of sold products (manually or automatically)

To do this automatically, you should create a new job controller that sets the positions accordingly:
https://aimeos.org/docs/Developers/Controller/Implement_job_controller

Retrieving the ordered products and their count is rather easy:
Code: Select all$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base/product' );
$search = $manager->createSearch( true );
$map = $manager->aggregateItems( $search, 'order.base.product.productid' );

To get all products in bunches, please read this article: https://aimeos.org/docs/Developers/Fetch_records_in_bunches