From ef0eb49ba97759b748aa5a762f03533fd08c8957 Mon Sep 17 00:00:00 2001 From: vAugagneur Date: Tue, 18 Dec 2012 14:59:34 +0100 Subject: [PATCH] [-] CORE : fixed bug #PSCFV-4754 Image sizes are the same for all shops and themes --- classes/ImageType.php | 43 +++++++++++++------ classes/Language.php | 22 +++++----- controllers/front/BestSalesController.php | 2 +- controllers/front/CategoryController.php | 12 +++--- controllers/front/CompareController.php | 2 +- controllers/front/ManufacturerController.php | 4 +- controllers/front/NewProductsController.php | 2 +- controllers/front/PricesDropController.php | 2 +- controllers/front/ProductController.php | 14 +++--- controllers/front/SearchController.php | 6 +-- controllers/front/StoresController.php | 2 +- controllers/front/SupplierController.php | 4 +- modules/blockbestsellers/blockbestsellers.php | 6 +-- modules/blocklayered/blocklayered.php | 2 +- modules/blocknewproducts/blocknewproducts.php | 2 +- modules/blockspecials/blockspecials.php | 2 +- modules/crossselling/crossselling.php | 4 +- modules/homefeatured/homefeatured.php | 2 +- modules/productcomments/productcomments.php | 4 +- 19 files changed, 80 insertions(+), 57 deletions(-) diff --git a/classes/ImageType.php b/classes/ImageType.php index 2c2d54e0c..cd9fc3f64 100644 --- a/classes/ImageType.php +++ b/classes/ImageType.php @@ -78,6 +78,8 @@ class ImageTypeCore extends ObjectModel * @var array Image types cache */ protected static $images_types_cache = array(); + + protected static $images_types_name_cache = array(); protected $webserviceParameters = array(); @@ -87,20 +89,17 @@ class ImageTypeCore extends ObjectModel * @param string|null Image type * @return array Image type definitions */ - public static function getImagesTypes($type = null, $id_theme = false) + public static function getImagesTypes($type = null) { - if (!isset(self::$images_types_cache[$type.($id_theme ? '-'.$id_theme : '')])) + if (!isset(self::$images_types_cache[$type])) { $where = 'WHERE 1'; - if ($id_theme) - $where .= ' AND id_theme='.(int)$id_theme; if (!empty($type)) $where .= ' AND '.pSQL($type).' = 1 '; $query = 'SELECT * FROM `'._DB_PREFIX_.'image_type`'.$where.' ORDER BY `name` ASC'; self::$images_types_cache[$type] = Db::getInstance()->executeS($query); } - return self::$images_types_cache[$type]; } @@ -116,9 +115,9 @@ class ImageTypeCore extends ObjectModel die(Tools::displayError()); Db::getInstance()->executeS(' - SELECT `id_image_type` - FROM `'._DB_PREFIX_.'image_type` - WHERE `name` = \''.pSQL($typeName).'\''); + SELECT `id_image_type` + FROM `'._DB_PREFIX_.'image_type` + WHERE `name` = \''.pSQL($typeName).'\''); return Db::getInstance()->NumRows(); } @@ -128,9 +127,29 @@ class ImageTypeCore extends ObjectModel * @param string $name * @param string $type */ - public static function getByNameNType($name, $type) + public static function getByNameNType($name, $type = null) { - return Db::getInstance()->getRow('SELECT `id_image_type`, `name`, `width`, `height`, `products`, `categories`, `manufacturers`, `suppliers`, `scenes` FROM `'._DB_PREFIX_.'image_type` WHERE `name` = \''.pSQL($name).'\' AND `'.pSQL($type).'` = 1'); + if (!isset(self::$images_types_name_cache[$name.'_'.$type])) + { + self::$images_types_name_cache[$name.'_'.$type] = Db::getInstance()->getRow(' + SELECT `id_image_type`, `name`, `width`, `height`, `products`, `categories`, `manufacturers`, `suppliers`, `scenes` + FROM `'._DB_PREFIX_.'image_type` + WHERE `name` = \''.pSQL($name).'\' '.(!is_null($type) ? 'AND `'.pSQL($type).'` = 1' : '')); + } + return self::$images_types_name_cache[$name.'_'.$type]; } - -} + + public static function getFormatedName($name) + { + $theme_name = Context::getContext()->shop->theme_name; + $name_without_theme_name = str_replace(array('_'.$theme_name, $theme_name.'_'), '', $name); + //check if the theme name is already in $name if yes only return $name + if (strstr($name, $theme_name) && self::getByNameNType($name)) + return $name; + else if (self::getByNameNType($name_without_theme_name.'_'.$theme_name)) + return $name_without_theme_name.'_'.$theme_name; + else + return $theme_name.'_'.$name_without_theme_name; + } + +} \ No newline at end of file diff --git a/classes/Language.php b/classes/Language.php index 1a4c91a1e..c285ef4bd 100644 --- a/classes/Language.php +++ b/classes/Language.php @@ -516,11 +516,11 @@ class LanguageCore extends ObjectModel // delete images $files_copy = array( '/en.jpg', - '/en-default-thickbox_default.jpg', - '/en-default-home_default.jpg', - '/en-default-large_default.jpg', - '/en-default-medium_default.jpg', - '/en-default-small_default.jpg' + '/en-default-'.ImageType::getFormatedName('thickbox').'.jpg', + '/en-default-'.ImageType::getFormatedName('home').'.jpg', + '/en-default-'.ImageType::getFormatedName('large').'.jpg', + '/en-default-'.ImageType::getFormatedName('medium').'.jpg', + '/en-default-'.ImageType::getFormatedName('small').'.jpg' ); $tos = array(_PS_CAT_IMG_DIR_, _PS_MANU_IMG_DIR_, _PS_PROD_IMG_DIR_, _PS_SUPP_IMG_DIR_); foreach ($tos as $to) @@ -726,12 +726,12 @@ class LanguageCore extends ObjectModel $files_copy = array( '/en.jpg', - '/en-default-thickbox_default.jpg', - '/en-default-home_default.jpg', - '/en-default-large_default.jpg', - '/en-default-medium_default.jpg', - '/en-default-small_default.jpg', - '/en-default-scene_default.jpg' + '/en-default-'.ImageType::getFormatedName('thickbox').'.jpg', + '/en-default-'.ImageType::getFormatedName('home').'.jpg', + '/en-default-'.ImageType::getFormatedName('large').'.jpg', + '/en-default-'.ImageType::getFormatedName('medium').'.jpg', + '/en-default-'.ImageType::getFormatedName('small').'.jpg', + '/en-default-'.ImageType::getFormatedName('scene').'.jpg' ); foreach (array(_PS_CAT_IMG_DIR_, _PS_MANU_IMG_DIR_, _PS_PROD_IMG_DIR_, _PS_SUPP_IMG_DIR_) as $to) foreach ($files_copy as $file) diff --git a/controllers/front/BestSalesController.php b/controllers/front/BestSalesController.php index 170f6c715..344414d16 100644 --- a/controllers/front/BestSalesController.php +++ b/controllers/front/BestSalesController.php @@ -40,7 +40,7 @@ class BestSalesControllerCore extends FrontController 'products' => ProductSale::getBestSales($this->context->language->id, $this->p - 1, $this->n, $this->orderBy, $this->orderWay), 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => $nbProducts, - 'homeSize' => Image::getSize('home_default'), + 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM') )); diff --git a/controllers/front/CategoryController.php b/controllers/front/CategoryController.php index 2d6ec41ed..808ddd075 100644 --- a/controllers/front/CategoryController.php +++ b/controllers/front/CategoryController.php @@ -120,10 +120,10 @@ class CategoryControllerCore extends FrontController 'return_category_name' => Tools::safeOutput($this->category->name), 'path' => Tools::getPath($this->category->id), 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), - 'categorySize' => Image::getSize('category_default'), - 'mediumSize' => Image::getSize('medium_default'), - 'thumbSceneSize' => Image::getSize('m_scene_default'), - 'homeSize' => Image::getSize('home_default'), + 'categorySize' => Image::getSize(ImageType::getFormatedName('category')), + 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), + 'thumbSceneSize' => Image::getSize(ImageType::getFormatedName('m_scene')), + 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'allow_oosp' => (int)Configuration::get('PS_ORDER_OUT_OF_STOCK'), 'comparator_max_item' => (int)Configuration::get('PS_COMPARATOR_MAX_ITEM'), 'suppliers' => Supplier::getSuppliers() @@ -144,9 +144,9 @@ class CategoryControllerCore extends FrontController { foreach ($sceneImageTypes as $sceneImageType) { - if ($sceneImageType['name'] == 'm_scene_default') + if ($sceneImageType['name'] == ImageType::getFormatedName('m_scene')) $thumbSceneImageType = $sceneImageType; - elseif ($sceneImageType['name'] == 'scene_default') + elseif ($sceneImageType['name'] == ImageType::getFormatedName('scene')) $largeSceneImageType = $sceneImageType; } diff --git a/controllers/front/CompareController.php b/controllers/front/CompareController.php index 5a1fb68e6..5be2f39d4 100644 --- a/controllers/front/CompareController.php +++ b/controllers/front/CompareController.php @@ -132,7 +132,7 @@ class CompareControllerCore extends FrontController 'product_features' => $listFeatures, 'products' => $listProducts, 'width' => $width, - 'homeSize' => Image::getSize('home_default') + 'homeSize' => Image::getSize(ImageType::getFormatedName('home')) )); $this->context->smarty->assign('HOOK_EXTRA_PRODUCT_COMPARISON', Hook::exec('displayProductComparison', array('list_ids_product' => $ids))); } diff --git a/controllers/front/ManufacturerController.php b/controllers/front/ManufacturerController.php index 494356a89..b9653d34f 100644 --- a/controllers/front/ManufacturerController.php +++ b/controllers/front/ManufacturerController.php @@ -115,12 +115,12 @@ class ManufacturerControllerCore extends FrontController $this->pagination($nbProducts); foreach ($data as &$item) - $item['image'] = (!file_exists(_PS_MANU_IMG_DIR_.'/'.$item['id_manufacturer'].'-medium_default.jpg')) ? $this->context->language->iso_code.'-default' : $item['id_manufacturer']; + $item['image'] = (!file_exists(_PS_MANU_IMG_DIR_.'/'.$item['id_manufacturer'].'-'.ImageType::getFormatedName('medium').'.jpg')) ? $this->context->language->iso_code.'-default' : $item['id_manufacturer']; $this->context->smarty->assign(array( 'pages_nb' => ceil($nbProducts / (int)($this->n)), 'nbManufacturers' => $nbProducts, - 'mediumSize' => Image::getSize('medium_default'), + 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), 'manufacturers' => $data, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), )); diff --git a/controllers/front/NewProductsController.php b/controllers/front/NewProductsController.php index a42daad46..78439778e 100644 --- a/controllers/front/NewProductsController.php +++ b/controllers/front/NewProductsController.php @@ -60,7 +60,7 @@ class NewProductsControllerCore extends FrontController 'products' => Product::getNewProducts($this->context->language->id, (int)($this->p) - 1, (int)($this->n), false, $this->orderBy, $this->orderWay), 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => (int)($nbProducts), - 'homeSize' => Image::getSize('home_default'), + 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM') )); diff --git a/controllers/front/PricesDropController.php b/controllers/front/PricesDropController.php index 35bf9e45a..165fc3c32 100644 --- a/controllers/front/PricesDropController.php +++ b/controllers/front/PricesDropController.php @@ -53,7 +53,7 @@ class PricesDropControllerCore extends FrontController 'products' => Product::getPricesDrop($this->context->language->id, (int)$this->p - 1, (int)$this->n, false, $this->orderBy, $this->orderWay), 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => $nbProducts, - 'homeSize' => Image::getSize('home_default'), + 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM') )); diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php index 9ce391d2e..423f0703f 100644 --- a/controllers/front/ProductController.php +++ b/controllers/front/ProductController.php @@ -345,15 +345,19 @@ class ProductControllerCore extends FrontController $product_images[(int)$image['id_image']] = $image; } if (!isset($cover)) - $cover = array('id_image' => $this->context->language->iso_code.'-default', 'legend' => 'No picture', 'title' => 'No picture'); - $size = Image::getSize('large_default'); + $cover = array( + 'id_image' => $this->context->language->iso_code.'-default', + 'legend' => 'No picture', + 'title' => 'No picture' + ); + $size = Image::getSize(ImageType::getFormatedName('large')); $this->context->smarty->assign(array( 'have_image' => Product::getCover((int)Tools::getValue('id_product')), 'cover' => $cover, 'imgWidth' => (int)$size['width'], - 'mediumSize' => Image::getSize('medium_default'), - 'largeSize' => Image::getSize('large_default'), - 'homeSize' => Image::getSize('home_default'), + 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), + 'largeSize' => Image::getSize(ImageType::getFormatedName('large')), + 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'col_img_dir' => _PS_COL_IMG_DIR_)); if (count($product_images)) $this->context->smarty->assign('images', $product_images); diff --git a/controllers/front/SearchController.php b/controllers/front/SearchController.php index de94d0c62..13ab1b5dc 100644 --- a/controllers/front/SearchController.php +++ b/controllers/front/SearchController.php @@ -81,7 +81,7 @@ class SearchControllerCore extends FrontController 'nbProducts' => $search['total'], 'search_query' => $query, 'instant_search' => $this->instant_search, - 'homeSize' => Image::getSize('home_default'))); + 'homeSize' => Image::getSize(ImageType::getFormatedName('home')))); } else if (($query = Tools::getValue('search_query', Tools::getValue('ref'))) && !is_array($query)) { @@ -97,7 +97,7 @@ class SearchControllerCore extends FrontController 'search_products' => $search['result'], 'nbProducts' => $search['total'], 'search_query' => $query, - 'homeSize' => Image::getSize('home_default'))); + 'homeSize' => Image::getSize(ImageType::getFormatedName('home')))); } else if (($tag = urldecode(Tools::getValue('tag'))) && !is_array($tag)) { @@ -110,7 +110,7 @@ class SearchControllerCore extends FrontController 'products' => $result, // DEPRECATED (since to 1.4), not use this: conflict with block_cart module 'search_products' => $result, 'nbProducts' => $nbProducts, - 'homeSize' => Image::getSize('home_default'))); + 'homeSize' => Image::getSize(ImageType::getFormatedName('home')))); } else { diff --git a/controllers/front/StoresController.php b/controllers/front/StoresController.php index 77e2bf669..ac72fd26d 100644 --- a/controllers/front/StoresController.php +++ b/controllers/front/StoresController.php @@ -262,7 +262,7 @@ class StoresControllerCore extends FrontController $this->assignStores(); $this->context->smarty->assign(array( - 'mediumSize' => Image::getSize('medium_default'), + 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), 'defaultLat' => (float)Configuration::get('PS_STORES_CENTER_LAT'), 'defaultLong' => (float)Configuration::get('PS_STORES_CENTER_LONG'), 'searchUrl' => $this->context->link->getPageLink('stores'), diff --git a/controllers/front/SupplierController.php b/controllers/front/SupplierController.php index af980192b..90c8c274a 100644 --- a/controllers/front/SupplierController.php +++ b/controllers/front/SupplierController.php @@ -118,12 +118,12 @@ class SupplierControllerCore extends FrontController $suppliers = Supplier::getSuppliers(true, $this->context->language->id, true, $this->p, $this->n); foreach ($suppliers as &$row) - $row['image'] = (!file_exists(_PS_SUPP_IMG_DIR_.'/'.$row['id_supplier'].'-medium_default.jpg')) ? $this->context->language->iso_code.'-default' : $row['id_supplier']; + $row['image'] = (!file_exists(_PS_SUPP_IMG_DIR_.'/'.$row['id_supplier'].'-'.ImageType::getFormatedName('medium').'.jpg')) ? $this->context->language->iso_code.'-default' : $row['id_supplier']; $this->context->smarty->assign(array( 'pages_nb' => ceil($nbProducts / (int)$this->n), 'nbSuppliers' => $nbProducts, - 'mediumSize' => Image::getSize('medium_default'), + 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), 'suppliers_list' => $suppliers, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), )); diff --git a/modules/blockbestsellers/blockbestsellers.php b/modules/blockbestsellers/blockbestsellers.php index 48e96e797..e41a43da3 100644 --- a/modules/blockbestsellers/blockbestsellers.php +++ b/modules/blockbestsellers/blockbestsellers.php @@ -120,8 +120,8 @@ class BlockBestSellers extends Module $this->smarty->assign(array( 'best_sellers' => $best_sellers, - 'mediumSize' => Image::getSize('medium_default'), - 'smallSize' => Image::getSize('small_default') + 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), + 'smallSize' => Image::getSize(ImageType::getFormatedName('small')) )); return $this->display(__FILE__, 'blockbestsellers.tpl'); } @@ -158,7 +158,7 @@ class BlockBestSellers extends Module $this->smarty->assign(array( 'best_sellers' => $best_sellers, - 'homeSize' => Image::getSize('home_default'))); + 'homeSize' => Image::getSize(ImageType::getFormatedName('home')))); return $this->display(__FILE__, 'blockbestsellers-home.tpl'); } } \ No newline at end of file diff --git a/modules/blocklayered/blocklayered.php b/modules/blocklayered/blocklayered.php index 0caa42665..6fad4abb3 100644 --- a/modules/blocklayered/blocklayered.php +++ b/modules/blocklayered/blocklayered.php @@ -3868,7 +3868,7 @@ class BlockLayered extends Module $smarty->assign( array( - 'homeSize' => Image::getSize('home_default'), + 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'nb_products' => $nb_products, 'category' => (object)array('id' => Tools::getValue('id_category_layered', 1)), 'pages_nb' => (int)($pages_nb), diff --git a/modules/blocknewproducts/blocknewproducts.php b/modules/blocknewproducts/blocknewproducts.php index 3a327844c..0f3c18d00 100644 --- a/modules/blocknewproducts/blocknewproducts.php +++ b/modules/blocknewproducts/blocknewproducts.php @@ -101,7 +101,7 @@ class BlockNewProducts extends Module $this->smarty->assign(array( 'new_products' => $newProducts, - 'mediumSize' => Image::getSize('medium_default'), + 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), )); return $this->display(__FILE__, 'blocknewproducts.tpl'); diff --git a/modules/blockspecials/blockspecials.php b/modules/blockspecials/blockspecials.php index 4352b3dc4..f27e9fe8d 100644 --- a/modules/blockspecials/blockspecials.php +++ b/modules/blockspecials/blockspecials.php @@ -92,7 +92,7 @@ class BlockSpecials extends Module $this->smarty->assign(array( 'special' => $special, 'priceWithoutReduction_tax_excl' => Tools::ps_round($special['price_without_reduction'], 2), - 'mediumSize' => Image::getSize('medium_default'), + 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), )); return $this->display(__FILE__, 'blockspecials.tpl'); diff --git a/modules/crossselling/crossselling.php b/modules/crossselling/crossselling.php index ebb0434a1..1de6bb3ac 100755 --- a/modules/crossselling/crossselling.php +++ b/modules/crossselling/crossselling.php @@ -158,7 +158,7 @@ class CrossSelling extends Module $taxCalc = Product::getTaxCalculationMethod(); foreach ($orderProducts AS &$orderProduct) { - $orderProduct['image'] = $this->context->link->getImageLink($orderProduct['link_rewrite'], (int)$orderProduct['product_id'].'-'.(int)$orderProduct['id_image'], 'medium_default'); + $orderProduct['image'] = $this->context->link->getImageLink($orderProduct['link_rewrite'], (int)$orderProduct['product_id'].'-'.(int)$orderProduct['id_image'], ImageType::getFormatedName('medium')); $orderProduct['link'] = $this->context->link->getProductLink((int)$orderProduct['product_id'], $orderProduct['link_rewrite'], $orderProduct['category'], $orderProduct['ean13']); if (Configuration::get('CROSSSELLING_DISPLAY_PRICE') AND ($taxCalc == 0 OR $taxCalc == 2)) $orderProduct['displayed_price'] = Product::getPriceStatic((int)$orderProduct['product_id'], true, NULL); @@ -212,7 +212,7 @@ class CrossSelling extends Module $taxCalc = Product::getTaxCalculationMethod(); foreach ($orderProducts AS &$orderProduct) { - $orderProduct['image'] = $this->context->link->getImageLink($orderProduct['link_rewrite'], (int)$orderProduct['product_id'].'-'.(int)$orderProduct['id_image'], 'medium_default'); + $orderProduct['image'] = $this->context->link->getImageLink($orderProduct['link_rewrite'], (int)$orderProduct['product_id'].'-'.(int)$orderProduct['id_image'], ImageType::getFormatedName('medium')); $orderProduct['link'] = $this->context->link->getProductLink((int)$orderProduct['product_id'], $orderProduct['link_rewrite'], $orderProduct['category'], $orderProduct['ean13']); if (Configuration::get('CROSSSELLING_DISPLAY_PRICE') AND ($taxCalc == 0 OR $taxCalc == 2)) $orderProduct['displayed_price'] = Product::getPriceStatic((int)$orderProduct['product_id'], true, NULL); diff --git a/modules/homefeatured/homefeatured.php b/modules/homefeatured/homefeatured.php index 9b37346a1..bc7291a81 100644 --- a/modules/homefeatured/homefeatured.php +++ b/modules/homefeatured/homefeatured.php @@ -108,7 +108,7 @@ class HomeFeatured extends Module $this->smarty->assign(array( 'products' => $products, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), - 'homeSize' => Image::getSize('home_default'), + 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), )); return $this->display(__FILE__, 'homefeatured.tpl'); diff --git a/modules/productcomments/productcomments.php b/modules/productcomments/productcomments.php index 3164ee73d..c48f0f637 100644 --- a/modules/productcomments/productcomments.php +++ b/modules/productcomments/productcomments.php @@ -710,7 +710,7 @@ class ProductComments extends Module 'logged' => (int)$this->context->customer->isLogged(true), 'allow_guests' => (int)Configuration::get('PRODUCT_COMMENTS_ALLOW_GUESTS'), 'productcomment_cover' => (int)Tools::getValue('id_product').'-'.(int)$image['id_image'], - 'mediumSize' => Image::getSize('medium_default'), + 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), 'criterions' => ProductCommentCriterion::getByProduct((int)Tools::getValue('id_product'), $this->context->language->id), 'action_url' => '', 'averageTotal' => (int)$average['grade'], @@ -752,7 +752,7 @@ class ProductComments extends Module 'id_product_comment_form' => (int)Tools::getValue('id_product'), 'secure_key' => $this->secure_key, 'productcomment_cover' => (int)Tools::getValue('id_product').'-'.(int)$image['id_image'], - 'mediumSize' => Image::getSize('medium_default'), + 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), 'nbComments' => (int)ProductComment::getCommentNumber((int)Tools::getValue('id_product')), 'productcomments_controller_url' => $this->context->link->getModuleLink('productcomments'), 'productcomments_url_rewriting_activated' => Configuration::get('PS_REWRITING_SETTINGS', 0)