Commit 271bf1d5 by lmf

优化bug

parent fc575724
...@@ -131,9 +131,8 @@ class Upsell extends AbstractProduct implements IdentityInterface ...@@ -131,9 +131,8 @@ class Upsell extends AbstractProduct implements IdentityInterface
if (!count($this->_itemCollection->getItems())){ if (!count($this->_itemCollection->getItems())){
$collection = $this->_collectionFactory->create(); $collection = $this->_collectionFactory->create();
$collection->addAttributeToSelect('*'); $collection->addAttributeToSelect('*');
$collection->addCategoriesFilter(['in' => $product->getCategoryIds()]);
$collection->setVisibility($this->_catalogProductVisibility->getVisibleInCatalogIds()); $collection->setVisibility($this->_catalogProductVisibility->getVisibleInCatalogIds());
$collection->getSelect()->order('id'); $collection->getSelect()->order('rand()');
$collection->setPageSize(10); $collection->setPageSize(10);
$collection->addStoreFilter($product->getStoreId()); $collection->addStoreFilter($product->getStoreId());
$this->_itemCollection = $collection; $this->_itemCollection = $collection;
......
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