Пример #1
0
 protected function _prepareCollection()
 {
     $collection = $this->categoryFactory->create()->getCollection();
     $collection->addAttributeToSelect('name');
     $collection->addFieldToFilter(array(array('attribute' => 'entity_id', 'in' => array_keys($this->getCategoriesData()))));
     $this->setCollection($collection);
     return parent::_prepareCollection();
 }
Пример #2
0
 protected function _prepareCollection()
 {
     /* @var $collection \Magento\Catalog\Model\Category */
     $collection = $this->categoryFactory->create()->getCollection();
     $collection->addAttributeToSelect('name');
     $collection->addFieldToFilter(array(array('attribute' => 'entity_id', 'in' => array_keys($this->getData('categories_data')))));
     $this->setCollection($collection);
     return parent::_prepareCollection();
 }
Пример #3
0
 protected function _prepareCollection()
 {
     $collection = $this->categoryFactory->create()->getCollection();
     $collection->addAttributeToSelect('name');
     $dbSelect = $collection->getConnection()->select()->from($collection->getResource()->getTable('catalog_category_product'), 'category_id')->where('`product_id` IN(?)', $this->getProductsIds());
     $collection->getSelect()->where('entity_id IN (' . $dbSelect->__toString() . ')');
     $this->setCollection($collection);
     parent::_prepareCollection();
     return $this;
 }