Slider Pro giving error (same ID already exists)
I did a data migration from M1.14.0.1 to M2.3.0
When I try to enable the Best Sellers Product Slider (Slider Pro) it gives me the following error.
Error filtering template: Item (Magento\Catalog\Model\Product\Interceptor) with the same ID "954" already exists.
I am unable to track down where this "duplicate" is occurring. I checked database tables to see if there is a duplicate product or category, but found nothing.
When I disable the product, the error updates to tell me that the next "Best Seller" product is duplicate. I assume it would tell me the same error for all products under that category.
I was thinking that maybe the extension is maybe pulling in the duplicate. Possibly it is not being strict enough on Store Views or something of that nature?
Anyone know what tables the extension might be using so I can check to see if I can spot the problem?
-
Official comment
We're actually aware of this issue happening in certain cases, and the dev team is looking into it. We'll be including a fix for it in the next version release.
In the meantime, however, try seeing if any of the Parent Products for Best Selling Child Products are disabled, and if there are, try enabling them, as this is a potential cause.
Comment actions -
Another developer on my team seems to have tracked down the issue.
The sales_bestsellers_aggregated_yearly table contains multiple years of best seller data. Your plugin is not reading from the table on a yearly basis and instead grabs all products regardless of year. Thus there are multiple entries for the same product because it was a best seller in 2019, 2018, 2017, etc.
/app/code/WeltPixel/OwlCarouselSlider/Block/Slider/Products.php
A quick fix was to add a group by clause to the sql query as follows
$_collection->getSelect()
->join(['bestsellers' => $_collection->getTable('sales_bestsellers_aggregated_yearly')],
'e.entity_id = bestsellers.product_id AND bestsellers.store_id = '.$this->getStoreId(),
['qty_ordered','rating_pos','period'])
->group('bestsellers.product_id')
->order('rating_pos')
;
Can you please confirm this is a defect in your extension?
Will try and look into your Support suggestion about disabled parents
Please sign in to leave a comment.
Comments
3 comments