Question

I know product sku's can be fetched using the quote object and a foreach loop

foreach($this->getOnepage()->getQuote()->getAllItems() as $item){
    $sku = $item->getSku();
    $_SKU = $item->getProduct()->getSku(); // or this way
}

but I want to know whether there is any other short and crisp way to do this? I mean without using foreach loop, i.e. a inbuilt function returning an array of product data in the quote.

Was it helpful?

Solution

This snippet returns array of quote items sku

$this->getOnepage()->getQuote()->getItemsCollection()->getColumnValues('sku');
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top