一段简单实用的代码获得magento中普通商品的自定义选项的值与信息。代码如下:
$product = Mage::getModel(‘catalog/product’)->load(174);$options = $product->getOptions();//magento1.5版本$options = Mage::helper(‘core’)->decorateArray($_prodcut->getOptions());//其他版本$i = 1;echo "";foreach ($product->getOptions() as $o) {echo "Custom Option:" . $i . "";echo "Custom Option TYPE: " . $o->getType() . "";echo "Custom Option TITLE: " . $o->getTitle() . "";echo "Custom Option ID: ". $o->getId() ."";// Getting Values if it has option values, case of select,dropdown,radio,multiselect$values = $o->getValues();foreach ($values as $v) {print_r($v->getData());}$i++;}