【问题标题】:SMARTY foreach array (sort order)SMARTY foreach 数组(排序顺序)
【发布时间】:2012-11-11 22:29:53
【问题描述】:

我运行使用 SMARTY 的 Prestashop 1.5。显示数量折扣时,它们不会按逻辑顺序显示。

我想按这个顺序排列它们:

然后是前 1 个单位
然后 2 个单位
然后 3 个单位
然后 4 个单位
5 个单位

而不是按照我添加它们的顺序,现在就是这种情况。有人可以帮忙吗?

兄弟,
托比亚斯

我尝试过 |@array_reverse 但它似乎不起作用...

当前代码:
................................
{如果 $quantity_discounts}
{foreach from=$quantity_discounts item='quantity_discount' name='quantity_discounts'}

xxxxx

{/foreach}
{/如果}

【问题讨论】:

    标签: arrays foreach smarty


    【解决方案1】:

    在类/specificprice.php 第 293 行:
    变化:

    ORDER BY `id_product_attribute` DESC, `from_quantity` DESC, `id_specific_price_rule` ASC, `score` DESC
    

    进入:

    ORDER BY `id_product_attribute` DESC, `from_quantity` ASC, `id_specific_price_rule` ASC, `score` DESC
    

    【讨论】:

    • 您应该复制文件并将其放在 override/classes/ 文件夹中并在那里进行更改
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-08
    • 1970-01-01
    • 1970-01-01
    • 2022-12-16
    • 2020-03-11
    • 2012-01-13
    相关资源
    最近更新 更多