Grab your First Item in Collections By: Robert Kent

This entry was posted on January 25, 2013 by Maddie

Here is a useful tip for those of you who work with Magento Collections. Have you ever wanted to get just one result when you are performing a collection query? Well there’s a very simple command at the end that will grab your item for you – so you don’t need to perform $collection[0] or any such nonsense.

First of all perform your normal collection query – something like the following: