2009-07-24 82 views
1

我已經在Magento 1.3.2.1安裝的管理部分的產品中添加了一些自定義屬性,並且我給出了其中一些屬性的默認值。問題是,沒有被返回的默認值時,我試圖讓從產品對象的屬性如下:Magento自定義屬性默認值沒有在前端顯示

$_product->getCode() 

按道理,我會想象的默認值被返回,如果沒有一個存儲在產品中,但似乎並非如此(除非我明白地錯過了某些東西)。

以下列表是未返回默認值集的其中一個屬性的所有當前設置。

屬性屬性:

屬性代碼:代碼

範圍:商店查看了店主

目錄輸入類型:文本字段

默認值:值

唯一值:否

值所需:對於店主沒有

輸入驗證:無

適用於:所有產品類型

前端屬性:

快速搜索用途:無

高級搜索中使用:沒有

可比的前端:沒有

使用分層導航:沒有

使用在搜索結果中分層導航:沒有

使用價格規則條件:無

位置:0

允許在前端使用HTML標籤:是

產品V上可見IEW頁上的前端:是

用於產品上市:是

用於產品上市的排序:沒有

感謝您的幫助! Remy

回答

0

它接縫Mage_Core_Model_Abstract類不會檢查__get神奇方法中的屬性。請嘗試使用getData方法代替:

$_product->getData('code'); 
1
 


echo $_product->getMyAttribute() 

echo $_product->getAnotherCustomAttribute() 
For eg Attribute Label : Short Description 
Then you must write code like  
echo $_product->getShortDescription() 
if Attribute Label : Weight Then 
echo $_product->getWeight() 


echo $_product->getAttributeText('attribute_code') 
For eg Attribute Label : Size and Attribute Code : size Then 
echo $_product->getAttributeText('size') 
相關問題