Tobias Bindemo
Tobias Bindemo

Reputation: 83

SMARTY foreach array (sort order)

I run Prestashop 1.5 which uses SMARTY. When Quantity discounts are shown, they do not show in logical order.

I would like to arrange them in this order:

first 1 unit then
2 units then
3 units then
4 units then
5 units

Instead of in the order i added them, which is the case now. Can anoyone help?

Br,
Tobias

I have tried with |@array_reverse but it doens't seem to work...

CURRENT CODE:
................................
{if $quantity_discounts}
{foreach from=$quantity_discounts item='quantity_discount' name='quantity_discounts'}

xxxxx

{/foreach}
{/if}

Upvotes: 0

Views: 8466

Answers (1)

user3109132
user3109132

Reputation: 11

In Classes/specificprice.php On line #293:
Change:

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

Into:

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

Upvotes: 1

Related Questions