Magento News

 

Retrieving a product’s custom options via PHP

by EricO (Posted Thu, 01 Jul 2010 23:49:53 GMT)
I’d like to get a product’s custom options via PHP, and I’m not entirely sure how. I can load a product this way (assuming $_item is an item object):

Code:
$product = Mage::getModel('catalog/product');
$productId = $product->getIdBySku($_item->getSku());
$product->load($productId); 

I read on a site that this should tell you whether a product has custom options:

Code:
$product->hasCustomOptions() 

However, that is returning false for an item that I know has custom options. I also found this function call, which sounds like it should return options:

Code:
$product->getOptions() 

However, that returns a huge array rather than just custom options.

How can I retrieve just the custom options of a product in Magento via PHP?



http://magento-forum.co.uk/viewtopic.php?f=5&t=330#p1193

Magento Forum

Possibly Related Posts:


 

Leave a Reply