产品是否在magento中有自定义选项?
如何检查产品是否在magento中有自定义选项产品是否在magento中有自定义选项?,magento,Magento,如何检查产品是否在magento中有自定义选项 Mage::setIsDeveloperMode(true); Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID)); $product = Mage::getModel('catalog/product')->load($sku, 'sku'); $code
Mage::setIsDeveloperMode(true);
Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));
$product = Mage::getModel('catalog/product')->load($sku, 'sku');
$code = $product->getAttribute()->getAttributeCode();
就这么简单。最后,
$hasOptions
应该是true
或false
Magento中有一个错误,hasOptions
或hasCustomOptions
每次都会返回false
。关于这个问题:
$product = Mage::getModel('catalog/product')->load($sku, 'sku');
$hasOptions = $product->hasCustomOptions();