How will you get first and last item from the collection in magento?
Answer Posted / Meenu Tiwary
To get the first item from a collection, you can use: $collection->getFirstItem(). To get the last item, you can use: endIterator() and rewind(), then getCurrent(): $lastItem = reset($collection->getItterator()); $collection->rewind(); echo $collection->getCurrent()
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers