Skip to content

Commit

Permalink
// norms
Browse files Browse the repository at this point in the history
  • Loading branch information
gRoussac committed Oct 17, 2014
1 parent 16242fa commit 893c6a2
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions classes/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -1556,11 +1556,14 @@ public function getGiftWrappingPrice($with_taxes = true, $id_address = null)
{
if ($id_address === null)
$id_address = (int)$this->{Configuration::get('PS_TAX_ADDRESS_TYPE')};
try {
$address[$this->id] = Address::initialize($id_address);
} catch (Exception $e) {
$address[$this->id] = new Address();
$address[$this->id]->id_country = Configuration::get('PS_COUNTRY_DEFAULT');
try
{
$address[$this->id] = Address::initialize($id_address);
}
catch (Exception $e)
{
$address[$this->id] = new Address();
$address[$this->id]->id_country = Configuration::get('PS_COUNTRY_DEFAULT');
}
}

Expand All @@ -1581,11 +1584,12 @@ public function getNbOfPackages()
{
static $nb_packages = array();

if (!isset($nb_packages[$this->id])) {
$nb_packages[$this->id] = 0;
foreach ($this->getPackageList() as $by_address)
$nb_packages[$this->id] += count($by_address);
}
if (!isset($nb_packages[$this->id]))
{
$nb_packages[$this->id] = 0;
foreach ($this->getPackageList() as $by_address)
$nb_packages[$this->id] += count($by_address);
}

return $nb_packages[$this->id];
}
Expand Down Expand Up @@ -1930,7 +1934,7 @@ public function getDeliveryOptionList(Country $default_country = null, $flush =
// No carriers available
if (count($packages) == 1 && count($package['carrier_list']) == 1 && current($package['carrier_list']) == 0)
{
$cache[$this->id] = array();
$cache[$this->id] = array();
return $cache[$this->id];
}

Expand Down Expand Up @@ -2131,7 +2135,7 @@ public function getDeliveryOptionList(Country $default_country = null, $flush =
foreach ($delivery_option_list as &$array)
uasort ($array, array('Cart', 'sortDeliveryOptionList'));

$cache[$this->id] = $delivery_option_list;
$cache[$this->id] = $delivery_option_list;
return $cache[$this->id];
}

Expand Down Expand Up @@ -2287,7 +2291,7 @@ public function isMultiAddressDelivery()
$sql->from('cart_product', 'cp');
$sql->where('id_cart = '.(int)$this->id);

$cache[$this->id] = Db::getInstance()->getValue($sql) > 1;
$cache[$this->id] = Db::getInstance()->getValue($sql) > 1;
}
return $cache[$this->id];
}
Expand Down

0 comments on commit 893c6a2

Please sign in to comment.