From 7e029cc2dcc4d55b18a5e25ec9d66954705d111c Mon Sep 17 00:00:00 2001 From: Nolwenn Date: Tue, 14 Jun 2016 12:01:16 +0200 Subject: [PATCH] ajout picto listing --- modules/advpicto/advpicto.php | 10 ++++++++-- modules/advpicto/classes/AdvPictoClass.php | 4 +++- themes/toutpratique/css/global.css | 1 + themes/toutpratique/css/k2000.css | 15 +++++++++++++++ .../advpicto/views/templates/hook/category.tpl | 11 +++++++++++ themes/toutpratique/product-list.tpl | 3 ++- 6 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 themes/toutpratique/modules/advpicto/views/templates/hook/category.tpl diff --git a/modules/advpicto/advpicto.php b/modules/advpicto/advpicto.php index e3b384bb..16bf3b10 100644 --- a/modules/advpicto/advpicto.php +++ b/modules/advpicto/advpicto.php @@ -162,11 +162,17 @@ class AdvPicto extends Module public function hookDisplayPictogrammesProduct($params) { $id_product = $params['id_product']; - + $is_listing = $params['is_listing']; $pictos = AdvPictoClass::getPictosForProductDetails($id_product); $this->smarty->assign('pictos', $pictos); - return $this->display(__FILE__, 'product.tpl'); + if($is_listing) + { + return $this->display(__FILE__, 'category.tpl'); + } + else { + return $this->display(__FILE__, 'product.tpl'); + } } } \ No newline at end of file diff --git a/modules/advpicto/classes/AdvPictoClass.php b/modules/advpicto/classes/AdvPictoClass.php index d9b8ba47..e24b6865 100644 --- a/modules/advpicto/classes/AdvPictoClass.php +++ b/modules/advpicto/classes/AdvPictoClass.php @@ -183,9 +183,11 @@ class AdvPictoClass extends ObjectModel public static function getPictosForProductDetails($id_product = null) { $context = Context::getContext(); - + + $id_product = (int) $id_product; if(!empty($id_product) && is_int($id_product)) { + $query = ' SELECT DISTINCT(advp.`id_advpicto`), `title` FROM `'._DB_PREFIX_.'advpicto_product` advp diff --git a/themes/toutpratique/css/global.css b/themes/toutpratique/css/global.css index ad7fef61..e06a0086 100644 --- a/themes/toutpratique/css/global.css +++ b/themes/toutpratique/css/global.css @@ -2874,6 +2874,7 @@ main#categorycms { margin-bottom: 30px } font-family: 'pompiere_regular'; color: #666666; } + #product .pictos .picto:nth-child(odd) { padding-right: 5px; } #product .pictos .picto:nth-child(even) { padding-left: 5px; } #product .pictos .picto div { diff --git a/themes/toutpratique/css/k2000.css b/themes/toutpratique/css/k2000.css index ee9dbd5a..e53b2607 100644 --- a/themes/toutpratique/css/k2000.css +++ b/themes/toutpratique/css/k2000.css @@ -503,6 +503,21 @@ header.page-heading.order-process { padding: 25px 0 0 0 } .product-container .btn { width: 100%; } + + .product-container .pictos { + margin-bottom: 15px; + } + .product-container .pictos li { + width: auto; + margin-right: 1%; + display: inline-block; + height: 38px; + max-width: 30%; + } + .product-container .pictos li img { + max-height: 100%; + max-width: 100%; + } .product-container:hover .btn { background: #6ac5bb none repeat scroll 0 0; color: #fff; diff --git a/themes/toutpratique/modules/advpicto/views/templates/hook/category.tpl b/themes/toutpratique/modules/advpicto/views/templates/hook/category.tpl new file mode 100644 index 00000000..aa5a81a0 --- /dev/null +++ b/themes/toutpratique/modules/advpicto/views/templates/hook/category.tpl @@ -0,0 +1,11 @@ +{if $pictos} + +{/if} \ No newline at end of file diff --git a/themes/toutpratique/product-list.tpl b/themes/toutpratique/product-list.tpl index db1f2d75..0926a3f8 100644 --- a/themes/toutpratique/product-list.tpl +++ b/themes/toutpratique/product-list.tpl @@ -25,7 +25,8 @@ - {hook h='displayPictogrammesCategory' id_product=$product.id} + {hook h='displayPictogrammesProduct' id_product=$product.id_product is_listing='true'} +