2

I'm trying to migrate a Magento 1.9.3.6 to Magento 2.3 and I found a strange problem. I've got some categories with thousands of products, I can see 64 products in my first page or 16, but if I go to page 2 http://v2.dendago.eus/moda?p=2 it says that there is no product. In any category happens the same. I've re-indexed and cleaned cache multiple times.

Any advice?

  • @job zangitu have you verified the migrated products which are assigned to correct wbesites – Nagaraju K Oct 22 '19 at 8:58
  • If I select to show 64 products, I see 64. Then I change to 16 and go to page 2 and they are missing. It shouldn't be related to the website, is it? – Jon Zangitu Oct 22 '19 at 9:00
  • Got it. I assume something code level issue. do u have any customizations related? – Nagaraju K Oct 22 '19 at 9:04
2

Look at the file vendor\magento\module-elasticsearch\Model\ResourceModel\Fulltext\Collection\SearchResultApplier.php

Find apply() method and replace it with the below function. Magento recently introduced hotfix by adding $this->collection->setPageSize(null); to the SearchResultApplier.php class.

public function apply()
    {
        if (empty($this->searchResult->getItems())) {
            $this->collection->getSelect()->where('NULL');
            return;
        }
        $ids = [];
        foreach ($this->searchResult->getItems() as $item) {
            $ids[] = (int)$item->getId();
        }
        $this->collection->setPageSize(null);
        $this->collection->getSelect()->where('e.entity_id IN (?)', $ids);
        $orderList = join(',', $ids);
        $this->collection->getSelect()->reset(\Magento\Framework\DB\Select::ORDER);
        $this->collection->getSelect()->order("FIELD(e.entity_id,$orderList)");
    }

Add a plugin on above class.

| improve this answer | |
  • 1
    You're goddam right!! Thanks! – Jon Zangitu Oct 22 '19 at 9:46

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.