Commit e329d6fa by lmf

测试产品详情相关产品推荐

parent 8c9a7850
......@@ -101,6 +101,17 @@ class Related extends AbstractProduct implements IdentityInterface
$this->_itemCollection->load();
if (!count($this->_itemCollection->getItems())){
$collection = $this->_collectionFactory->create();
$collection->addAttributeToSelect('*');
$collection->addCategoriesFilter(['in' => $product->getCategoryIds()]);
$collection->setVisibility($this->_catalogProductVisibility->getVisibleInCatalogIds());
$collection->getSelect()->order('rand()');
$collection->setPageSize(6);
$collection->addStoreFilter($product->getStoreId());
$this->_itemCollection = $collection;
}
foreach ($this->_itemCollection as $product) {
$product->setDoNotUseCategoryId(true);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment