2013-01-11 94 views
1

我花了數小時試圖弄清楚,但失敗了。我需要爲Magento中的'製造商'屬性提取標籤和值。但我需要獲取管理字段中的說明 - 不是專門針對商店的說明。Magento - 具體產品的管理員屬性名稱

我發現許多方法如何獲得特定商店,也可以提取該屬性的所有選項,但無法獲得當前文章從產品頁+管理員值+管理員標籤(否從哪個商店訪問它)。

任何人都可以提供幫助嗎?

這給所有值+標籤的數組,而不是一個具體的文章:

<pre><code> 
$attribute = $_product->getResource()->getAttribute('manufacturer'); 
foreach ($attribute->getSource()->getAllOptions(true, true) as $option){ 
$attributeArray[$option['value']] = $option['label']; 
} 
</code></pre> 

回答

2

剛剛獲得產品製造商的價值和你的這樣的選項陣列獲取標籤:

$manufacturerOfProduct = $product->getManufacturer(); 
$attribute = $_product->getResource()->getAttribute('manufacturer'); 
foreach ($attribute->getSource()->getAllOptions(true, true) as $option){ 
    $attributeArray[$option['value']] = $option['label']; 
} 
var_dump("Product manufacturer value is ".$manufacturerOfProduct." and label is ".$attributeArray[$manufacturerOfProduct]); 
+0

非常感謝您的幫助!現在工作很好! – Swip

+0

謝謝!完美的作品! – grindking