Converting an array to a collection in Magento

前端 未结 4 888
天命终不由人
天命终不由人 2021-01-14 19:08

I have an array object that is an output of a magento fetchall from DB and i want this to be converted to an object of a Collections class so that i can implement pagination

4条回答
  •  醉酒成梦
    2021-01-14 20:01

    If you have an array of ids $product_ids, you can use:

    $collection = Mage::getModel('catalog/product')->getCollection()
            ->addIdFilter($product_ids);
    

提交回复
热议问题