我需要显示可配置选项,我有这个代码
$productOptions = $item->getProduct()->getTypeInstance(true)->getOrderOptions($item->getProduct());
if($productOptions){
if(isset($productOptions['options'])){
foreach($productOptions['options'] as $_option){
$productser = $_option['option_id'].','.$_option['option_value'];
}
}
$superAttrString ='';
if(isset($productOptions['info_buyRequest']['super_attribute'])){
foreach($productOptions['info_buyRequest']['super_attribute'] as $key => $_superAttr){
$superAttrString .= '&super_attribute'.'['.$key.']='.$_superAttr;
}
}
if($superAttrString):
$superAttrString.'&qty=1';
endif;
}
$html .='<span class="label">Configurable Options: # '.$superAttrString.'</span>
现在$ superAttrString变量的结果是
&安培; super_attribute [92] = 3及super_attribute [135] = 5 我如何制作标签而不是ID&#39>
非常感谢
答案 0 :(得分:0)
我觉得这样的事情应该在你的foreach中发挥作用:
foreach($productOptions['info_buyRequest']['super_attribute'] as $key => $_superAttr){
$attr = Mage::getModel('catalog/resource_eav_attribute')->load($key);
$label = $attr->getSource()->getOptionText($_superAttr);
$superAttrString .= '&super_attribute'.'['.$attr->getAttributeCode().']=' . $label;
}