// 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:
@@ -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;
|
||||||
@@ -161,4 +167,4 @@ class CompareProductCore extends ObjectModel
|
|||||||
FROM `'._DB_PREFIX_.'compare`
|
FROM `'._DB_PREFIX_.'compare`
|
||||||
WHERE `id_customer`= '.(int)$id_customer);
|
WHERE `id_customer`= '.(int)$id_customer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user