0
我有一個包含許多屬性和屬性集的Magento網站。每個類別都有自己的設置,客戶希望類別和產品視圖根據所屬類別顯示不同的屬性。通過添加屬性來擴展屬性
這很容易在switch/if語句中執行,但我不如果可能的話,想要硬編碼。
我的想法是爲所謂的屬性添加一個新屬性。 'display_on_frontend',然後我可以在循環中使用它來查看是否應顯示屬性。這有可能做到嗎?
在我最初想使用的前端產品視圖頁上有一個屬性已被稱爲「可見」,但是當我獲取該屬性時,它在數據中不可用。
下面是我使用獲得的產品視圖屬性代碼
$_attributes = Mage::getModel('catalog/product_attribute_api')->items($_product->getAttributeSetId());
foreach ($_attributes as $_attribute) :
$attributeFull = Mage::getResourceModel('eav/entity_attribute_collection')
->setCodeFilter($_attribute['code'])
->getFirstItem();
endforeach;
的返回的代碼示例響應
[_data:protected] => Array
(
[attribute_id] => 139
[entity_type_id] => 4
[attribute_code] => safe_working_load_range_tonnes
[attribute_model] =>
[backend_model] =>
[backend_type] => int
[backend_table] =>
[frontend_model] =>
[frontend_input] => select
[frontend_label] => Safe Working Load (Tonnes)
[frontend_class] =>
[source_model] => eav/entity_attribute_source_table
[is_required] => 0
[is_user_defined] => 1
[default_value] =>
[is_unique] => 0
[note] =>
)
有沒有人對如何擴展任何建議該屬性還是以合理的方式解決問題?
謝謝
嗨麥克,感謝回答。對不起,如果我沒有正確解釋自己,但我需要在屬性上創建一個新的屬性,而不是新的屬性本身。沒關係,由於缺乏時間我走了一條不同的,儘管硬編碼的路徑,但如果有人知道我會有興趣聽到,如果有可能...... – Paul 2012-04-02 18:44:48