前端中的Magento 1.7类别属性
我已经为Magento中的类别创建了一个自定义属性;但奇怪的是,我没能抓住它的前端。从昨天开始,我就一直在努力寻找解决办法,但毫无结果 我在不同的论坛上看到过多个帖子,包括SO。我尝试了多种解决方案。例如:前端中的Magento 1.7类别属性,magento,attributes,magento-1.7,categories,frontend,Magento,Attributes,Magento 1.7,Categories,Frontend,我已经为Magento中的类别创建了一个自定义属性;但奇怪的是,我没能抓住它的前端。从昨天开始,我就一直在努力寻找解决办法,但毫无结果 我在不同的论坛上看到过多个帖子,包括SO。我尝试了多种解决方案。例如: Mage::registry('current_category')->getAttributes() 以及以下各项: Mage::getSingleton('catalog/layer')->getCurrentCategory()->getAttributes()
Mage::registry('current_category')->getAttributes()
以及以下各项:
Mage::getSingleton('catalog/layer')->getCurrentCategory()->getAttributes()
Mage::registry('current_category')->debug()
我相信它也有同样的作用。问题是,它们都返回以下错误,我似乎无法理解:
致命错误:调用未定义的方法
图像\目录\模型\资源\类别\平面::中的loadAllAttributes()
X:..\project\app\code\core\Mage\Catalog\Model\Category.php在线
289
此外,尝试var_dump getData()不会返回此属性,即使它(该属性)确实存在于后端的“管理类别”下,并且可以修改和保存它,并保持刷新页面时上次保存的方式。我还尝试了多种解决方案,建议使用循环遍历所有类别并获取属性;但这也不起作用
打印以下内容:
Mage::getSingleton('catalog/layer')->getCurrentCategory()->getAttributes()
Mage::registry('current_category')->debug()
正如另一个线程所建议的,它没有返回我创建的属性,但返回了默认属性
我已经检查了多个站点,以确保在创建属性的过程中没有遗漏任何关键的内容,到目前为止,我还没有找到任何遗漏的内容
创建属性时;使用以下参数时:
$this->addAttribute('catalog_category', 'used_by', array(
'group' => 'General',
'input' => 'textarea',
'type' => 'text',
'label' => 'Used by',
'backend' => '',
'visible' => true,
'required' => false,
'wysiwyg_enabled' => true,
'visible_on_front' => true,
'is_html_allowed_on_front' => true,
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
));
我的问题是:
如果打开平面目录,则Magento中的集合页将使用平面表格 如果添加了任何附加属性,则该属性将不会出现在平面表格中 索引是更新平面表的方法
所以,当您为新创建的属性重新索引列时,添加了属性并填充了数据 之后你重新索引了吗?您是否在平面目录模式下运行?顺便说一句,平面目录很受欢迎。谢谢!重新索引是个问题!如果你喜欢,写一个答案,我会把它标记为解决方案。哈哈,吸取教训。。