New answers tagged

0

use below code $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $productCollectionFactory = $objectManager->create('Magento\Catalog\Model\ResourceModel\Product\CollectionFactory'); $collection = $productCollectionFactory->create(); $collection ->addFieldToSelect('*'); // only need sku, price, id, $collection ->...


0

Ok, so after a long time of troubleshooting this, I have finally resolved it. So here is the solution for anyone else who encounters a similar problem. The initial method: protected function _initSelect() { $this->getSelect()->from(['main_table' => $this->getMainTable()]); $this->getSelect() ->joinLeft( ...


0

The product IDs for this one category are coming from elasticsearch based on the page size defined in "Store > Settings > Configuration > Catalog > Catalog > Storefront > Products per Page on Grid Default Value". If you navigate to the next page, Magento requests the next 12 product IDs from Elasticsearch and these will be ...


1

I think i have found the answer but not sure why this worked. public function toOptionArray(){ $collection = $this->collectionFactory->create(); $options = array(); foreach ($collection as $key => $value) { $options[$key] = $value['title']; } return $options; But now the value I selected won't save


1

Try this: namespace [Vendor\Module]\Model\System\Config; use Magento\Cms\Model\ResourceModel\Block\CollectionFactory; use Magento\Framework\Option\ArrayInterface; class CmsBlocks implements ArrayInterface { /** * @var array */ private $options; /** * @var \Magento\Cms\Model\ResourceModel\Block\CollectionFactory */ private $...


0

You cannot inject the Colection into your class __construct. Try inject CollectionFactory: In Constructor: \Magento\Catalog\Model\ResourceModel\Category\CollectionFactory $collectionFactory Block Code: public function getAllCategories($attributVaueArray) { $collection = $this->collectionFactory->create(); return $collection->...


0

Try below code. $block->getAllCategories()->clear(); $getAllCategories = $block->getAllCategories()->load();


Top 50 recent answers are included