0
我創建了一個自定義的是/在Magento的類別沒有屬性:Magento的 - 獲取類別的首頁,如果自定義屬性等於是
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttribute('catalog_category', 'in_slider', array(
'group' => 'General Information',
'input' => 'select',
'type' => 'int',
'source' => 'eav/entity_attribute_source_boolean',
'label' => 'Nella Slide dei Brand',
'required' => 0,
'unique' => 0,
'sort_order' => 3,
'user_defined' => 1,
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
));
現在我需要得到所有類別的圖像和名稱具有該屬性的類別等於是並顯示在主頁中。我在主頁找不到任何代碼,所以我不明白從哪裏開始。
IHAVE嘗試了以下內容:
foreach ($this->getStoreCategories() as $_category):
$cur_category = Mage::getModel('catalog/category')->load($_category->getId());
if($cur_category->getinSlider()) : // Check if the featured category is enabled
<h1>Test</h1>
但我覺得我很遠。
謝謝!我在'//你的邏輯在這裏'附近添加了一個h1來測試,但是它只是輸出空白 – filippo90
@ filippo90你有屬性in_slider類別嗎? – Kul
是的,它出現在類別一般信息選項卡中。我已經在問題中添加了代碼($ setup-> addAttribute('catalog_category','in_slider',array) – filippo90