【问题标题】:PrestaShop display subcategories from category IDPrestaShop 显示来自类别 ID 的子类别
【发布时间】:2016-12-05 19:31:35
【问题描述】:

我使用 PrestaShop 1.6,我想在特定类别页面上显示图像,并且我希望图像在该类别的子类别中可见。

{if $subcategory->id == 15}
    style="background-position: 70% 72%; background-image: url(../img.jpg);"
{/if}

【问题讨论】:

  • 你好。你到底是什么问题??您的代码看起来不错,除了 url(../img.jpg); 结尾处的 Missin "
  • 不是代码是问题所在。我想将这种风格赋予类别 id == 15 和类别 id == 15 的子类别
  • 你的代码到底有什么问题??

标签: php smarty prestashop prestashop-1.6


【解决方案1】:

你可以这样做:

{if $subcategory->id == 15 || $subcategory->id_parent == 15}
    style="background-position: 70% 72%; background-image: url(../img.jpg);"
{/if}

【讨论】:

  • 您介意对哪些不起作用的内容进行更广泛的介绍,以便我可以改进我的答案吗?我猜不出你在屏幕上看到了什么。
【解决方案2】:

您可以将以下代码添加到您商店的 category.tpl 文件中:

{if $category->id_parent == 15} //For example the category ID is 15
.your_element_selector { 
background-position: 70% 72%; background-image: url(../img.jpg);
}
{/if}

注意:您应该创建一个单独的元素来显示图像。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-01-24
    • 1970-01-01
    • 2021-07-30
    • 2013-10-27
    • 2013-04-03
    • 2012-10-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多