// Merge -> revision 7875

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7877 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-08-03 16:16:49 +00:00
parent 6f08bcb12e
commit f2b5ee338b
38 changed files with 320 additions and 85 deletions
+19 -4
View File
@@ -27,6 +27,15 @@
class CarrierCore extends ObjectModel
{
/**
* getCarriers method filter
*/
const PS_CARRIERS_ONLY = 1;
const CARRIERS_MODULE = 2;
const CARRIERS_MODULE_NEED_RANGE = 3;
const PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE = 4;
const ALL_CARRIERS = 5;
const SHIPPING_METHOD_DEFAULT = 0;
const SHIPPING_METHOD_WEIGHT = 1;
const SHIPPING_METHOD_PRICE = 2;
@@ -340,7 +349,7 @@ class CarrierCore extends ObjectModel
* @param boolean $active Returns only active carriers when true
* @return array Carriers
*/
public static function getCarriers($id_lang, $active = false, $delete = false, $id_zone = false, $ids_group = NULL, $modules_filters = 1)
public static function getCarriers($id_lang, $active = false, $delete = false, $id_zone = false, $ids_group = NULL, $modules_filters = self::PS_CARRIERS_ONLY)
{
if (!Validate::isBool($active))
die(Tools::displayError());
@@ -351,7 +360,7 @@ class CarrierCore extends ObjectModel
$ids .= (int)($id).', ';
$ids = rtrim($ids, ', ');
if ($ids == '')
return (array());
return array();
}
$sql = 'SELECT c.*, cl.delay
@@ -430,6 +439,12 @@ class CarrierCore extends ObjectModel
return $countries;
}
/**
*
* @param int $id_zone
* @param Array $groups group of the customer
* @return Array
*/
public static function getCarriersForOrder($id_zone, $groups = NULL)
{
$context = Context::getContext();
@@ -441,9 +456,9 @@ class CarrierCore extends ObjectModel
$id_currency = $context->currency->id;
if (is_array($groups) AND !empty($groups))
$result = Carrier::getCarriers($id_lang, true, false, (int)$id_zone, $groups, PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
$result = Carrier::getCarriers($id_lang, true, false, (int)$id_zone, $groups, self::PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
else
$result = Carrier::getCarriers($id_lang, true, false, (int)$id_zone, array(1), PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
$result = Carrier::getCarriers($id_lang, true, false, (int)$id_zone, array(1), self::PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
$resultsArray = array();
foreach ($result AS $k => $row)