People who code: we want your input. Take the Survey

New answers tagged

0

@Mike Tim Turner any idea how to get your solution to work in Magento 2.4.2?


0

In my case, It's because I use Magento 2.4.2 with Elasticsearch 6, But configure in backend use Elasticsearch 7. I just upgrade Elasticsearch to 7. Now getSize work fine. Hope this helps you.


2

Use insertMultiple function of class Magento\Framework\App\ResourceConnection protected $connection; protected $resource; public function __construct( ... \Magento\Framework\App\ResourceConnection $resource, ... ) { $this->connection = $resource->getConnection(); $this->resource = $resource; } public function insertMultiple($...


0

Ok this was dumb. The error comes from my model's $this->_init(). I actually put my model path instead of the required resourceModel path. Here's the fixed part Model : protected function _construct() { $this->_init('Vendor\Module\Model\ResourceModel\Offer'); }


0

I experienced the same issue with memory leaking. In this sitution following links help for me. I hope you also helpful following links Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes) in Magento customer Create Magento 2.2.2 : Allowed memory size of 792723456 bytes exhausted (tried to allocate 184320 bytes)


0

You can try below code for deleting it foreach ($collection as $key => $brand) { if ($brand->getIsDisabled()) { $collection->removeItemByKey($key); } }


1

please add ->where('tier.website_id = 0');


1

The problem In a Magento collection you are not allowed to have multiple items with the same id. This happens when your result set of the database query returns the same item multiple times, most likely because you join a table which contains the same item twice or more. I would assume that both of these tables contain the same product multiple times: $...


1

You have missed joining product collection with catalog_product_index_price table. Please make changes in your query as follows: public function getProductCollectionTot() { $collection = $this->_productCollectionFactory->create(); $collection->addAttributeToSelect('*'); $collection->getSelect()->join('...


0

Your code not work might because the product collection loaded somewhere, during Toolbar repair collection, you should create a custom filter append to the Layered Navigation. You might check the Layer resolver: vendor/magento/module-catalog/Model/Layer.php:147 $this->prepareProductCollection($collection);


0

You have a problem with plugin as @Arun pointed in the comment. This is core getProductionCollection function: public function getProductCollection() { if (isset($this->_productCollections[$this->getCurrentCategory()->getId()])) { $collection = $this->_productCollections[$this->getCurrentCategory()->getId()]; ...


2

This is due to "order" is a keyword in MySQL and you have used the same word for column name. You should change your table column name to something else. (I see you have used a column order to be ordered in below piece of code) `main_table` ORDER BY order ASC LIMIT 20


Top 50 recent answers are included