I want to remove last item from product collection
$collection = Mage::getModel('catalog/product')->getCollection();
But I have to avoid any 'loop' solutions.
collection;magento-1
I want to remove last item from product collection
$collection = Mage::getModel('catalog/product')->getCollection();
But I have to avoid any 'loop' solutions.
Best Answer
Without context, I cannot say if this is a good idea, but if you have a loaded collection and want to remove the last item from the collection (not delete it), you can do this:
This works because internally the items are stored in an array with their id as key.