0

Magento2 Admin Panel > Products > Categories >

Select Any category > "Products in category"

When i try to load more products from select dropdown, some random products are showing in resultenter image description here

magento-visual-merchandiser/Block/Adminhtml/Category/Merchandiser/Tile.php

protected function _prepareCollection()
    {

        $this->_products->setCacheKey($this->getPositionCacheKey());

        $collection = $this->_products->getCollectionForGrid(
            (int) $this->getRequest()->getParam('id', 0)
        );

        $collection = $this->_products->applyCachedChanges($collection);

        $collection->clear();
        $this->setCollection($collection);

        $this->_preparePage();

        $idx = ($collection->getCurPage() * $collection->getPageSize()) - $collection->getPageSize();

        foreach ($collection as $item) {
            $item->setPosition($idx);
            $idx++;
        }

        $this->_products->savePositions($collection);
        return $this;
    }

I have try to debug and found that there is some issue with this script:

$this->_products->setCacheKey($this->getPositionCacheKey());

When i comment this script after that list view is working properly but grid view still have issue.

Thanks in advance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.