【问题标题】:Display product available sizes on product miniature Prestashop 1.7在产品微型 Prestashop 1.7 上显示产品可用尺寸
【发布时间】:2020-07-08 09:03:56
【问题描述】:

我想知道如何在 Prestashop 1.7 中的产品模型上显示可用的产品尺寸。

变量 $product.size 给出了一个数组,所以我尝试以某种方式使用

<ul>
{foreach from=$product key=?? item=??}
    <li>{$product.size}</li>
{/foreach}
</ul>

但不起作用。确切地说,它可能返回 20 个空

  • 文件位于 your_theme/templates/catalog/_partials/miniatures/product.tpl

    有人可以帮我吗?

    先谢谢了

  • 【问题讨论】:

      标签: task-parallel-library prestashop smarty product


      【解决方案1】:

      不幸的是,在 1.7 中,您不能只显示与产品相关的所有属性,而无需进行额外修改。默认情况下,您只能访问“默认”属性。

      有许多额外的模块可以做到这一点,您可以通过在官方和第三方市场上查找“产品列表上的 PrestaShop 属性”来搜索它们。

      如果您想考虑自己进行修改,我建议您查看Product::getProductsProperties 方法,其中有一个代码,用于获取有关列表中显示的产品的所有信息。

      【讨论】:

        【解决方案2】:

        在产品微型 Prestashop 1.7 上显示默认属性 文件位于:your_theme/templates/catalog/_partials/miniatures/product.tpl

        {*------Display default attributes in product list-----*}
        {if isset($product.attributes) && !empty($product.attributes)}
            <span class="default-attributes">
                {foreach from=$product.attributes item=attribute}             
                     {$attribute.group} : {$attribute.name}
                    {/if}
                {/foreach}
            </span>
        {/if}
        

        【讨论】:

          猜你喜欢
          • 2015-08-08
          • 1970-01-01
          • 1970-01-01
          • 2021-12-17
          • 2021-12-10
          • 1970-01-01
          • 1970-01-01
          • 2017-09-26
          • 1970-01-01
          相关资源
          最近更新 更多