繁体   English   中英

如何在magento 1.9.3中获取自定义选项值?

[英]How to get custom option value in magento 1.9.3?

如何在magento 1.9.3中获取自定义选项值? 我的代码在下面,但没有工作请帮助我

 $helper   = Mage::helper('catalog/product_configuration');
 print_r($helper->getCustomOptions());

使用下面的代码,我认为帮助你

$helper   = Mage::helper('catalog/product_configuration');
$items = Mage::getSingleton('checkout/session')->getQuote()->getAllItems(); 
$wt=0;
foreach($items as $item){  
    $categories_array = $item->getProduct()->getCategoryIds(); 

    $_options = $helper->getCustomOptions($item);
    foreach ($_options as $_option) {
        $value = $this->htmlEscape($_option['value']);
        $weigth=preg_replace("/[^0-9,.]/","", $value);
        echo $wt+= $weigth;
    }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM