[*] BO : Carriers are now sortable by position or price

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9276 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
vChabot
2011-10-12 14:31:36 +00:00
parent d946197b9f
commit c4e28b117d
6 changed files with 174 additions and 112 deletions
+14
View File
@@ -41,6 +41,9 @@ class CarrierCore extends ObjectModel
const SHIPPING_METHOD_PRICE = 2;
const SHIPPING_METHOD_FREE = 3;
const SORT_BY_PRICE = 0;
const SORT_BY_POSITION = 1;
/** @var int Tax id (none = 0) */
public $id_tax_rules_group;
@@ -538,6 +541,17 @@ class CarrierCore extends ObjectModel
}
$results_array[] = $row;
}
// if we have to sort carriers by price
if (Configuration::get('PS_CARRIER_DEFAULT_SORT') == Carrier::SORT_BY_PRICE)
{
foreach ($results_array as $r)
{
$prices[] = $r['price'];
}
array_multisort($prices, SORT_NUMERIC, $results_array);
}
return $results_array;
}