It is possible to do some collection in checkout/cart ? I tried this one but it doesn't work . My objectif is to get all items cart then filter them by attribute.
$_cart = Mage::getModel('checkout/cart')->getCollection()
->addAttributeToSelect('*')
->addAttributeToFilter('attribute', 'value')
->setPageSize(100);
foreach ($_cart as $item) {
echo $item->getPrice();
}
or
$items= Mage::getSingleton('checkout/cart')->getQuote()->getItemsCollection();
// I dont know if it is possible to add a filter on it.
$items= Mage::getSingleton('checkout/cart')->getQuote()->getItemsCollection();var_dump($items);– PЯINCƎ Jul 02 '17 at 09:59getAllIds()is correct - otherwise it would not work. – sv3n Jul 22 '17 at 00:13var_dump($items)returns nothing or your$items->debug()? i will post a new question about the foreach – PЯINCƎ Jul 22 '17 at 19:47foreachthat doesn't work. – PЯINCƎ Jul 22 '17 at 21:34foreachworks as it should. It iterates over all 3 items, because collections IS already loaded. I think there is no better solution.getAllIdsjust runs one additionalfetchColquery on entity_id column that has a small footprint, so dont worry about performance. – sv3n Jul 24 '17 at 22:37Mage::getModel('checkout/cart')->getCollection()? – PЯINCƎ Jul 24 '17 at 22:39lib/Xhprof/Profiler.php on line 9 //line 9 = xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);but i just did create this class inlib/Xhprof/Profiler.phpand i used it directly in some page like this: ` / some code ` I have nothing installed in server side – PЯINCƎ Jul 25 '17 at 00:325000points ^^ – PЯINCƎ Aug 01 '17 at 09:10