[-] Core: Cache of Cart::getPackageList is now per cart

This commit is contained in:
Rémi Gaillard
2013-04-04 14:35:14 +02:00
parent df4e3a0000
commit a77111dc62
+4 -4
View File
@@ -1591,9 +1591,9 @@ class CartCore extends ObjectModel
*/ */
public function getPackageList($flush = false) public function getPackageList($flush = false)
{ {
static $cache = false; static $cache = array();
if ($cache !== false && !$flush) if (isset($cache[(int)$this->id]) && $cache[(int)$this->id] !== false && !$flush)
return $cache; return $cache[(int)$this->id];
$product_list = $this->getProducts(); $product_list = $this->getProducts();
// Step 1 : Get product informations (warehouse_list and carrier_list), count warehouse // Step 1 : Get product informations (warehouse_list and carrier_list), count warehouse
@@ -1821,7 +1821,7 @@ class CartCore extends ObjectModel
); );
} }
} }
$cache = $final_package_list; $cache[(int)$this->id] = $final_package_list;
return $final_package_list; return $final_package_list;
} }