SMARTY foreach数组(排序顺序)

时间:2012-11-11 22:29:53

标签: arrays foreach smarty

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

我想按顺序排列:

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

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

BR,
托拜厄斯

我已尝试使用| @array_reverse,但它似乎无法正常工作......

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

XXXXX

{/ foreach}的
{/如果}

1 个答案:

答案 0 :(得分:1)

在Classes / 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