InsideDarkWeb.com

How to cache a product collection in Magento 2?

Currently i load a product collection under certain categories, for example:

$collection->addCategoriesFilter(array('in' => array('2','4')));
$collection
            ->addMinimalPrice()
            ->addFinalPrice();
        $collection->addFieldToFilter('e.attribute_set_id', $attributeSetId);
        $collection->getSelect()->where('e.attribute_set_id = "'.$attributeSetId.'" AND final_price > 0');

the problem with this collection, that it will query like 3000++ product data, can i cache this collection ?

Magento Asked on October 2, 2021

0 Answers

Add your own answers!

Related Questions

WYSIWYG media directory contents removed

1  Asked on November 12, 2020 by tyler-v

       

Magento 2 hacked with script in hacked

4  Asked on October 25, 2020 by casey

 

Magento 2 How to check Price Type?

1  Asked on October 21, 2020 by jackson

   

Magento 2 : How to insert Price inclusive Tax?

3  Asked on October 11, 2020 by anastasia-di-paulo

   

How to create and use REST API for mobile app?

1  Asked on September 23, 2020 by gowri-shankar

   

Add option to product in the cart progrmatically in magento 2

2  Asked on September 12, 2020 by anantchopra2007

 

Magento 2 Access-Control-Allow-Origin

2  Asked on September 9, 2020 by borche-glafche

   

Magento 2: what is the catalog_attributes.xml file?

2  Asked on September 7, 2020 by raphael-at-digital-pianism

       

magento 2 – modify db_schema.xml field length

1  Asked on September 4, 2020 by sairaj-gadekar

 

Magento 2.3.2 Upgrade to 2.4

2  Asked on September 4, 2020 by hatim

 

Ask a Question

Get help from others!

© 2021 InsideDarkWeb.com. All rights reserved.