2015-12-21 21 views
0

我已經在MagentoMagento的色板後端設置

Admin|Lang1| 

RT |red 

BL |black 

CY |cyan 

等下面的顏色屬性

我的問題是,Magento的只與storeview(語言1)的文字作品。

如果我不想使用顏色色板的管理文本,我該怎麼辦?

回答

0

因爲你在前端使用這個,所以你不容易獲得這些選項。獲取需要使用選項集合並按屬性ID和選項ID篩選選項集合。從您的代碼

獲取選項列表: 獲取選項ID

$productAttributeOptions = $_product->getTypeInstance(true)->getConfigurableAttributesAsArray($_product); 

$attributeOptions = array(); 
$attributeList=array(); 
foreach ($productAttributeOptions as $productAttribute) { 


    foreach ($productAttribute['values'] as $attribute) { 
     $attributeList[$productAttribute['attribute_id']][]=$attribute['value_index']; 

     $attributeOptions[$productAttribute['label']][$attribute['value_index']] = $attribute['store_label']; 
    } 
} 

獲得管理標籤:

然後調用EAV選項集合,然後通過選擇濾波器收集

foreach($attributeList as $key=>$value){ 
    $attributeId=$key; 
    $options=array_unique($value); 
      $collection = Mage::getResourceModel('eav/entity_attribute_option_collection'); 
       $collection->getSelect()->where('main_table.option_id IN (?)',$options); 
       $collection->setPositionOrder('asc'); 
       $collection->setAttributeFilter($attributeId) 
       ->setStoreFilter(0); 
      $collection->load(); 
echo "<pre>"; 
print_r($collection->toOptionArray()); 

} 

0表示店鋪管理員

我希望這會幫助你。

+0

嗨,非常感謝。在哪些文件中我必須這樣做? – Rene

+0

如果您想在產品視圖頁面中使用。比在**應用/設計/前端/包/主題/模板/目錄/產品/ view.phtml ** 我希望這會幫助你。 –