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