【问题标题】:Use if else in magento homepage content在 magento 主页内容中使用 if else
【发布时间】:2012-07-24 09:30:42
【问题描述】:

我正在尝试显示一个网格视图,其中包含按类别过滤的主页上显示的销售项目。

我试图将 php if/else 块放在管理员 CMS 部分的主页内容中,但它不起作用。 CMS 中的任何 PHP 代码都会被自动注释!

还有其他方法可以按类别过滤主页销售/特色产品吗?我正在使用 Magento 1.7.x

我已将以下代码添加到有效的主页中:

{{block type="catalog/product_special" template="catalog/product/list1.phtml"}}

我只想在用户单击主页本身(而不是主菜单)上的类别链接时使用类别过滤上述代码的结果

谢谢 请问有人吗?

【问题讨论】:

    标签: magento if-statement customization


    【解决方案1】:

    试试这个来自 cms 的 if/else 语法(严格使用客户组参考作为示例)...

    {{if customer.group_id==4}} Print true {{else}} Print false {{/if}}
    

    【讨论】:

    • 不起作用。 if/else 块像普通文本一样显示,但 {{block type="catalog/product_special" template="catalog/product/list1.phtml"}} 显示其输出
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-05
    • 1970-01-01
    • 2012-10-15
    • 2013-06-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多