// Fix uses of $cookie var in CompareProduct

// Fix little issue on Geolocation
[-] FO : Fix issue on compare product when cookie->id_compare value is invalid
This commit is contained in:
aFolletete
2012-05-10 13:32:56 +00:00
parent 7481b3a0ca
commit ee03cd2c99
3 changed files with 9 additions and 3 deletions
+6
View File
@@ -77,6 +77,12 @@ class CompareProductCore extends ObjectModel
*/ */
public static function addCompareProduct($id_compare, $id_product) public static function addCompareProduct($id_compare, $id_product)
{ {
// Check if compare row exists
$id_compare = Db::getInstance()->getValue('
SELECT `id_compare`
FROM `'._DB_PREFIX_.'compare`
WHERE `id_compare` = '.(int)$id_compare);
if (!$id_compare) if (!$id_compare)
{ {
$id_customer = false; $id_customer = false;
+1 -1
View File
@@ -637,8 +637,8 @@ class FrontControllerCore extends Controller
} }
else else
{ {
$hasBeenSet = !isset($this->context->cookie->iso_code_country);
$this->context->cookie->iso_code_country = strtoupper($record->country_code); $this->context->cookie->iso_code_country = strtoupper($record->country_code);
$hasBeenSet = true;
} }
} }
} }
+1 -1
View File
@@ -86,7 +86,7 @@ class CompareControllerCore extends FrontController
if (($product_list = Tools::getValue('compare_product_list')) && ($postProducts = (isset($product_list) ? rtrim($product_list, '|') : ''))) if (($product_list = Tools::getValue('compare_product_list')) && ($postProducts = (isset($product_list) ? rtrim($product_list, '|') : '')))
$ids = array_unique(explode('|', $postProducts)); $ids = array_unique(explode('|', $postProducts));
else if (isset(self::$cookie->id_compare)) else if (isset($this->context->cookie->id_compare))
$ids = CompareProduct::getCompareProducts($this->context->cookie->id_compare); $ids = CompareProduct::getCompareProducts($this->context->cookie->id_compare);
else else
$ids = null; $ids = null;