donxbje866688 2012-07-03 19:09
浏览 56
已采纳

Magento在Navigation.php中调用自定义类别属性

(Magento Version 1.6)

I'm trying to display a custom category attribute I created to use in Navigation.php. The attribute is working fine if I use it in a place like app/design/frontend/default/MYTEMPLATE/catalog/category/view.phtml or page.phtml. I'm able to change in the backend no sweat as well.

I'm trying to display this new attribute in app/code/core/Mage/Catalog/Block/Navigation.php. I've copied this file to app/code/local/Mage/Catalog/Block/Navigation.php and I'm doing my edits on this file.

Here is the code I'm trying to accomplish this with:

// Add Class if Category is a CMS Page 
    if (($level == 0) && ($category->getData('cms_category') == 1)) {
        $classes[] = 'cms-page';
    }

If anyone has a better way to go about this I'm not married to this solution.

  • 写回答

1条回答 默认 最新

  • duangang4940 2012-07-03 19:16
    关注

    You might have to instantiate a category model.

    $categoryComplete = Mage::getModel('catalog/category')->load($category->getId());
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 求图像处理的matlab方案
  • ¥50 winform中使用edge的Kiosk模式
  • ¥15 关于#python#的问题:功能监听网页
  • ¥15 怎么让wx群机器人发送音乐
  • ¥15 fesafe材料库问题
  • ¥35 beats蓝牙耳机怎么查看日志
  • ¥15 Fluent齿轮搅油
  • ¥15 八爪鱼爬数据为什么自己停了
  • ¥15 交替优化波束形成和ris反射角使保密速率最大化
  • ¥15 树莓派与pix飞控通信