【发布时间】:2010-04-12 22:26:02
【问题描述】:
我为我的产品添加了几个新属性(布尔“是/否”字段)。它们是用于启用/禁用在产品详细信息页面和网格视图上显示价格的变量。
我设法让它在产品信息页面上运行。但是在产品网格页面上,我似乎无法访问这些变量。具体来说,我正在使用的模板是catalog/product/list.phtml。
我尝试将它们添加到 xml 文件中,例如这样的 layout/catalog.xml:
<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
<action method="addAttribute"><name>DisplayPrice</name></action>
<action method="addAttribute"><name>CustomOrder</name></action>
</block>
我正在尝试访问目录/产品/list.phtml中的属性:
<?php echo $_product->getDisplayPriceName()? "Yes" : "No" ; echo $_product->getCustomOrderName()? "Yes" : "No" ;?>
我还在 Mage 配置文件 app/code/core/Catalog/etc/config.xml 中添加了:
<frontend>
<!---- stuff before this -->
<product>
<collection>
<attributes>
<name />
<url_key />
<price />
<special_price />
<custom_order /> <!--new attribute -->
<display_price /> <!--new attribute -->
<special_from_date />
<special_to_date />
<short_description />
<thumbnail />
<small_image />
<image_label />
<thumbnail_label />
<small_image_label />
<tax_class_id />
<status />
<news_from_date />
<news_to_date />
<created_at />
<updated_at />
</attributes>
</collection>
</product>
</frontend>
此时我在黑暗中拍摄。我对 Magento 后端的了解不够多,不知道我还需要去哪里或看什么。任何反馈将不胜感激。
提前致谢。
【问题讨论】:
标签: php zend-framework magento