From d33548a26ffa462f8e00689fa61e697e2605cd3d Mon Sep 17 00:00:00 2001 From: rMalie Date: Tue, 17 Jan 2012 13:03:32 +0000 Subject: [PATCH] // Retrocompatibility fix on product links --- classes/Link.php | 8 ++++---- classes/Product.php | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/classes/Link.php b/classes/Link.php index ca14b4514..42024db27 100644 --- a/classes/Link.php +++ b/classes/Link.php @@ -87,9 +87,9 @@ class LinkCore if (!is_object($product)) { if (is_array($product) && isset($product['id_product'])) - $product = new Product((int)$product['id_product'], false, $id_lang); - else if(is_numeric($product)) - $product = new Product((int)$product, false, $id_lang); + $product = new Product($product['id_product'], false, $id_lang); + else if (is_numeric($product) || !$product) + $product = new Product($product, false, $id_lang); else throw new PrestaShopException('Invalid product vars'); } @@ -110,7 +110,7 @@ class LinkCore $params['supplier'] = Tools::str2url($product->isFullyLoaded ? $product->supplier_name : Supplier::getNameById($product->id_supplier)); if ($dispatcher->hasKeyword('product_rule', 'price')) - $params['supplier'] = $product->isFullyLoaded ? $product->price : Product::getPriceStatic($product->id, false, NULL, 6, NULL, false, true, 1, false, NULL, NULL, NULL, $product->specificPrice); + $params['supplier'] = $product->isFullyLoaded ? $product->price : Product::getPriceStatic($product->id, false, null, 6, null, false, true, 1, false, null, null, null, $product->specificPrice); if ($dispatcher->hasKeyword('product_rule', 'tags')) $params['tags'] = Tools::str2url($product->getTags($id_lang)); diff --git a/classes/Product.php b/classes/Product.php index cd0588427..29a77cdd2 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -207,6 +207,11 @@ class ProductCore extends ObjectModel public $is_virtual; public $cache_default_attribute; + /** + * @var string If product is populated, this property contain the rewrite link of the default category + */ + public $category; + public static $_taxCalculationMethod = PS_TAX_EXC; protected static $_prices = array(); protected static $_pricesLevel2 = array();