how can get Bestsellers or Most Popular products?
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
how can get Bestsellers or Most Popular products?
i have a home page and want to show top 10 bestsellers products and top 10 most popular products in this page or sidebar of another pages?
What should I do?
What should I do?
Re: how can get Bestsellers or Most Popular products?
Add the "catalog/lists" component to your controller action that is rendering the home page: https://aimeos.org/docs/Laravel/Create_new_pages
Please read https://aimeos.org/docs/Laravel/Adapt_pages too.
Add your top seller products to the "home" category (the root category node). In the action for the home page, configure the default category ID of your "home" category (https://aimeos.org/docs/Configuration/C ... id-default):
Please read https://aimeos.org/docs/Laravel/Adapt_pages too.
Add your top seller products to the "home" category (the root category node). In the action for the home page, configure the default category ID of your "home" category (https://aimeos.org/docs/Configuration/C ... id-default):
Code: Select all
$context = $this->app->make('\Aimeos\Shop\Base\Context')->get();
$context->getConfig()->set( 'client/html/catalog/lists/catid-default', 123 );
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: how can get Bestsellers or Most Popular products?
Thank you, but you did not understand my question correctlyaimeos wrote:Add the "catalog/lists" component to your controller action that is rendering the home page: https://aimeos.org/docs/Laravel/Create_new_pages
Please read https://aimeos.org/docs/Laravel/Adapt_pages too.
Add your top seller products to the "home" category (the root category node). In the action for the home page, configure the default category ID of your "home" category (https://aimeos.org/docs/Configuration/C ... id-default):Code: Select all
$context = $this->app->make('\Aimeos\Shop\Base\Context')->get(); $context->getConfig()->set( 'client/html/catalog/lists/catid-default', 123 );
I want to get a list of the top 10 products that have the most sales
In other words, I want to get a list of 10 products, bought by customers more than other products
Also, consider that the products may be in different categories, but it does not matter which category they are to get the list
Or if we want to specify that the products with the most sales are in this category, we specify that if they are in category 1 or 2 or 3 or any category id that i set.
i want to get this list with product controller as an array
please help me and if you can code it for me...
Re: how can get Bestsellers or Most Popular products?
If you want to evalute the top seller products dynamically, you first have to find out which products are sold most:
We always suggest to do this once a day in a job controller instead and populate a special category with that products!
Code: Select all
$manager = \Aimeos\MShop\Factory::createManager( $context, 'order/base/product' );
$filter = $manager->createSearch();
$result = $manager->aggregate( $filter, 'order.base.product.productid', 'order.base.product.quantity', 'sum' );
// find the products which are sold most in $result (product ID is the key, count is the value)
$cntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'product' );
$items = $cntl->getProductItems( <ids>, ['text', 'price', 'media'] );
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: how can get Bestsellers or Most Popular products?
@aimeosaimeos wrote: ↑13 Nov 2017, 15:55 If you want to evalute the top seller products dynamically, you first have to find out which products are sold most:We always suggest to do this once a day in a job controller instead and populate a special category with that products!Code: Select all
$manager = \Aimeos\MShop\Factory::createManager( $context, 'order/base/product' ); $filter = $manager->createSearch(); $result = $manager->aggregate( $filter, 'order.base.product.productid', 'order.base.product.quantity', 'sum' ); // find the products which are sold most in $result (product ID is the key, count is the value) $cntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'product' ); $items = $cntl->getProductItems( <ids>, ['text', 'price', 'media'] );
hi, because of i get Factory class and getProductItems not found,
please put updated above code (or new solution) that work in version 2020.04.
Re: how can get Bestsellers or Most Popular products?
For 2020.x use:
Code: Select all
$manager = \Aimeos\MShop::create( $context, 'order/base/product' );
$result = $manager->aggregate( $manager->filter(), 'order.base.product.productid', 'order.base.product.quantity', 'sum' );
// find the products which are sold most in $result (product ID is the key, count is the value)
$cntl = \Aimeos\Controller\Frontend::create( $context, 'product' );
$items = $cntl->uses( ['text', 'price', 'media'] )->product( <ids> )->search();
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: how can get Bestsellers or Most Popular products?
i use this code but get this errors:aimeos wrote: ↑08 Sep 2020, 15:14 For 2020.x use:Code: Select all
$manager = \Aimeos\MShop::create( $context, 'order/base/product' ); $result = $manager->aggregate( $manager->filter(), 'order.base.product.productid', 'order.base.product.quantity', 'sum' ); // find the products which are sold most in $result (product ID is the key, count is the value) $cntl = \Aimeos\Controller\Frontend::create( $context, 'product' ); $items = $cntl->use( ['text', 'price', 'media'] )->product( <ids> )->search();
ArgumentCountError
Too few arguments to function Aimeos\MW\Common\Manager\Base::filter(), 0 passed and exactly 1 expected
when i change $manager->filter() to $manager->createSearch() get another error:
Aimeos\Controller\Frontend\Exception
Unable to call method "use"
What change should I make?
Re: how can get Bestsellers or Most Popular products?
Please note that this works in 2020.07+ and older versions like 2020.04 are not supported any more.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: how can get Bestsellers or Most Popular products?
Sorry, it must be "uses()" and you can use "$manager->createSearch()" for 2020.04 even if it's highly recommended to update to 2020.07.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star