-
Posts
22 -
Joined
-
Last visited
Profile Information
-
First Name
Stef
-
Last Name
Arts
StefArts's Achievements
Newbie (1/14)
1
Reputation
-
Hello, Many thanks for this tutorial. It help me a lot. I have installed it on my prestashop 1.6.1.6 I have made some changes in order to have reviews counting: Here is the code: // Product Stars On Product List public function hookProductInList($params) { require_once(dirname(__FILE__).'/ProductComment.php'); require_once(dirname(__FILE__).'/ProductCommentCriterion.php'); $id_product = $params['idproduct']; $product_average = 0; $grades = ProductComment::getAveragesByProduct($id_product, $this->context->language->id); $criterions = ProductCommentCriterion::getByProduct($id_product, $this->context->language->id); $grade_total = 0; if (count($grades) > 0) { foreach ($criterions as $criterion) { if (isset($grades[$criterion['id_product_comment_criterion']])) { $grade_total += (float)($grades[$criterion['id_product_comment_criterion']]); } } $product_average = $grade_total / count($criterions); $this->context->smarty->assign('average_total', (int)$product_average); // Reviews Counting $this->smarty->assign(array( 'nbComments' => (int) ProductComment::getCommentNumber($id_product), )); return $this->display(__FILE__, '/product-list-rating.tpl'); } } // End Of Product Stars On Product List I only have PHP Notices: Trying to get property of non-object in .........productcomments.tpl.php on line 196 Trying to get property of non-object in .........productcomments.tpl.php on line 200 Trying to get property of non-object in .........productcomments.tpl.php on line 203 Undefined index: product in ...cache/smarty/compile/...file.product-list-rating.tpl.php on line 58 Here is the code of the smarty productcomments.tpl.php " height="<?php echo $_smarty_tpl->tpl_vars['mediumSize']->value['height'];?> " width="<?php echo $_smarty_tpl->tpl_vars['mediumSize']->value['width'];?> " alt="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['product']->value->name, ENT_QUOTES, 'UTF-8', true);?> " /> <div class="product_desc"> <p class="product_name"> <strong><?php echo $_smarty_tpl->tpl_vars['product']->value->name;?> </strong> </p> <?php echo $_smarty_tpl->tpl_vars['product']->value->description_short;?> Here is the code of the smarty product-list-rating.tpl.php <?php if ($_smarty_tpl->getVariable('smarty')->value['section']['i']['index']<$_smarty_tpl->tpl_vars['average_total']->value) {?> <div class="star star_on"><a href="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['product']->value['link'], ENT_QUOTES, 'UTF-8', true);?> "></a></div> I believe that is something wrong with tpl_vars['product'] but I do not know how to solve it Any help? Thank you. Regards
- 17 replies
-
- product rating
- starts
-
(and 2 more)
Tagged with:
-
Bonjour, J'ai réussi a solutionner le problème en suivant le lien de: Rapishiny Il faut modifier le fichier: themes/VOTRE THEME/js/product.js Rechercher la ligne: $(window).bind('hashchange', function(){ Changer: checkUrl(); findCombination(); Par: var is_combination = checkUrl(); if (is_combination) findCombination(); Ensuite, comme j'avais un souci: lorsque je cliquais sur "Lire les Avis" rien ne ce passait j'ai fait ça: Il faut modifier le fichier: /themes/YOUR THEME/js/modules/productcomments/js/productcomments.js J'ai ajouté: $('.nav-tabs li').removeClass('active'); $('.tab-content div').removeClass('active'); $('.nav-tabs li:last-child').addClass('active'); $('.tab-content div:last-child').addClass('active'); juste après: $(document).on('click', 'ahref=#idTab5', function(e){ $('*[id^=idTab]').addClass('block_hidden_only_for_screen'); $('div#idTab5').removeClass('block_hidden_only_for_screen'); $('ul#more_info_tabs a[href^=#idTab]').removeClass('selected'); $('ahref="#idTab5"').addClass('selected'); Mon code complet: $(document).on('click', 'ahref=#idTab5', function(e) { $('*[id^=idTab]').addClass('block_hidden_only_for_screen'); $('div#idTab5').removeClass('block_hidden_only_for_screen'); $('ul#more_info_tabs a[href^=#idTab]').removeClass('selected'); $('a[href=#idTab5]').addClass('selected'); $('.nav-tabs li').removeClass('active'); $('.tab-content div').removeClass('active'); $('.nav-tabs li:last-child').addClass('active'); $('.tab-content div:last-child').addClass('active'); } ); Pour un déplacement "soft" sur le DIV j'ai ajouté: $.scrollTo('#THE DIV YOU WANT', 400, {'offset': -50 } ); return false; Mon code final: $(document).on('click', 'ahref=#idTab5', function(e){ $('*[id^=idTab]').addClass('block_hidden_only_for_screen'); $('div#idTab5').removeClass('block_hidden_only_for_screen'); $('ul#more_info_tabs a[href^=#idTab]').removeClass('selected'); $('ahref="#idTab5"').addClass('selected'); $('.nav-tabs li').removeClass('active'); $('.tab-content div').removeClass('active'); $('.nav-tabs li:last-child').addClass('active'); $('.tab-content div:last-child').addClass('active'); $.scrollTo('#THE DIV YOU WANT', 400, {'offset': -50 }); return false; }); Dans mon cas c'etait ligne nº42 J'ai mis "#THE DIV YOU WANT" Car je n'utilise pas le tabs par défaut de prestashop et je ne connais pas leur nom. Vous devez le changer avec le nom du DIV correctÇa marche bien sur ma version 1.6.1.6 J'espère que cela pourra aider... J'ai tout de même un petit bug qui est que lorsque je clique sur "lire les avis" j'ai la case pour ajouter des quantités qui apparaît sur les produits hors stock seulement. Si quelqu'un a une idée. Merci beaucoup Cordialement. PS: Je n'ai rien inventer, j'ai trouver ces solutions au travers de beaucoup de recherche dans plusieur langues.
-
Problem With Read Reviews Button
StefArts replied to dmouradov's topic in Configuring and using PrestaShop
Hello, File to edit: /themes/YOUR THEME/js/modules/productcomments/js/productcomments.js I solved the Issue by adding: $('.nav-tabs li').removeClass('active'); $('.tab-content div').removeClass('active'); $('.nav-tabs li:last-child').addClass('active'); $('.tab-content div:last-child').addClass('active'); just after: $(document).on('click', 'a[href=#idTab5]', function(e){ $('*[id^=idTab]').addClass('block_hidden_only_for_screen'); $('div#idTab5').removeClass('block_hidden_only_for_screen'); $('ul#more_info_tabs a[href^=#idTab]').removeClass('selected'); $('a[href=#idTab5]').addClass('selected'); My complete code is: $(document).on('click', 'a[href=#idTab5]', function(e){ $('*[id^=idTab]').addClass('block_hidden_only_for_screen'); $('div#idTab5').removeClass('block_hidden_only_for_screen'); $('ul#more_info_tabs a[href^=#idTab]').removeClass('selected'); $('a[href=#idTab5]').addClass('selected'); $('.nav-tabs li').removeClass('active'); $('.tab-content div').removeClass('active'); $('.nav-tabs li:last-child').addClass('active'); $('.tab-content div:last-child').addClass('active'); }); For a smooth scroling effect to the div I have added: $.scrollTo('#THE DIV YOU WANT', 400, {'offset': -50 }); return false; Complete final code: $(document).on('click', 'a[href=#idTab5]', function(e){ $('*[id^=idTab]').addClass('block_hidden_only_for_screen'); $('div#idTab5').removeClass('block_hidden_only_for_screen'); $('ul#more_info_tabs a[href^=#idTab]').removeClass('selected'); $('a[href=#idTab5]').addClass('selected'); $('.nav-tabs li').removeClass('active'); $('.tab-content div').removeClass('active'); $('.nav-tabs li:last-child').addClass('active'); $('.tab-content div:last-child').addClass('active'); $.scrollTo('#THE DIV YOU WANT', 400, {'offset': -50 }); return false; }); In my case it was on line nº42 * I put "#THE DIV YOU WANT" because I'm not using defaults tab and I don't know the name of the default tabs. You have to change it with the correct div id It has worked well on my prestashop version which is 1.6.1.6 Hope it can help Regards. -
Problem With Read Reviews Button
StefArts replied to dmouradov's topic in Addons, modules and themes developers
Hello, File to edit: /themes/YOUR THEME/js/modules/productcomments/js/productcomments.js I solved the Issue by adding: $('.nav-tabs li').removeClass('active'); $('.tab-content div').removeClass('active'); $('.nav-tabs li:last-child').addClass('active'); $('.tab-content div:last-child').addClass('active'); just after: $(document).on('click', 'a[href=#idTab5]', function(e){ $('*[id^=idTab]').addClass('block_hidden_only_for_screen'); $('div#idTab5').removeClass('block_hidden_only_for_screen'); $('ul#more_info_tabs a[href^=#idTab]').removeClass('selected'); $('a[href=#idTab5]').addClass('selected'); My complete code is: $(document).on('click', 'a[href=#idTab5]', function(e){ $('*[id^=idTab]').addClass('block_hidden_only_for_screen'); $('div#idTab5').removeClass('block_hidden_only_for_screen'); $('ul#more_info_tabs a[href^=#idTab]').removeClass('selected'); $('a[href=#idTab5]').addClass('selected'); $('.nav-tabs li').removeClass('active'); $('.tab-content div').removeClass('active'); $('.nav-tabs li:last-child').addClass('active'); $('.tab-content div:last-child').addClass('active'); }); For a smooth scroling effect to the div I have added: $.scrollTo('#THE DIV YOU WANT', 400, {'offset': -50 }); return false; Complete final code: $(document).on('click', 'a[href=#idTab5]', function(e){ $('*[id^=idTab]').addClass('block_hidden_only_for_screen'); $('div#idTab5').removeClass('block_hidden_only_for_screen'); $('ul#more_info_tabs a[href^=#idTab]').removeClass('selected'); $('a[href=#idTab5]').addClass('selected'); $('.nav-tabs li').removeClass('active'); $('.tab-content div').removeClass('active'); $('.nav-tabs li:last-child').addClass('active'); $('.tab-content div:last-child').addClass('active'); $.scrollTo('#THE DIV YOU WANT', 400, {'offset': -50 }); return false; }); In my case it was on line nº42 * I put "#THE DIV YOU WANT" because I'm not using defaults tab and I don't know the name of the default tabs. You have to change it with the correct div id It has worked well on my prestashop version which is 1.6.1.6 Hope it can help Regards. -
How to add product review rating stars to category pages?
StefArts replied to ajensen27's topic in Core developers
Hello, It has been impossible for me to make the module working on my prestashop version (1.6.1.6) I follow these two combined tutorials: http://nemops.com/prestashop-product-rating-product-list/#.WHYJKZLWFE4 http://sobreprestashop.blogspot.com.es/2015/03/mostrar-calificacion-productos-en-lista-productos-prestashop.html It has worked well on my prestashop version. I only had to make a small change on productcomments.php to have the right counting of the number of reviews (Original code Spanish Tutorial): I change: $this->context->smarty->assign('nbComments', (int)ProductComment::getCommentNumber($id_product)); To: $this->smarty->assign(array( 'nbComments' => (int) ProductComment::getCommentNumber($id_product), )); My complete function in productcomments.php is: // Product Stars On Product List public function hookProductInList($params) { require_once(dirname(__FILE__).'/ProductComment.php'); require_once(dirname(__FILE__).'/ProductCommentCriterion.php'); $id_product = $params['idproduct']; $product_average = 0; $grades = ProductComment::getAveragesByProduct($id_product, $this->context->language->id); $criterions = ProductCommentCriterion::getByProduct($id_product, $this->context->language->id); $grade_total = 0; if (count($grades) > 0) { foreach ($criterions as $criterion) { if (isset($grades[$criterion['id_product_comment_criterion']])) { $grade_total += (float)($grades[$criterion['id_product_comment_criterion']]); } } $product_average = $grade_total / count($criterions); $this->context->smarty->assign('average_total', (int)$product_average); // Obtener el número de comentarios $this->smarty->assign(array( 'nbComments' => (int) ProductComment::getCommentNumber($id_product), )); return $this->display(__FILE__, '/product-list-rating.tpl'); } } // End Of Product Stars On Product List Also for all people who have the cart button disappearing when you click on «read reviews» on product page, the solution is there: https://github.com/PrestaShop/PrestaShop/pull/5280/files Basically you have to modify: themes/YOUR THEME/js/product.js Find the line: $(window).bind('hashchange', function(){ Change: checkUrl(); findCombination(); To: var is_combination = checkUrl(); if (is_combination) findCombination(); It has worked like a charm for me on my prestashop version (1.6.1.6) Hope it can help. Regards -
Hello, Solution of your problem is there: https://github.com/PrestaShop/PrestaShop/pull/5280/files Basically you have to modify: themes/default-bootstrap/js/product.js Find the line: $(window).bind('hashchange', function(){ Change: checkUrl(); findCombination(); To: var is_combination = checkUrl(); if (is_combination) findCombination(); It has worked like a charm for me. Hope it can help. Regards
-
Buenas, A mi me ha funcionado perfectamente. Hay que modificar el fichero: themes/default-bootstrap/js/product.js Buscar la linea: $(window).bind('hashchange', function(){ Reemplazar: checkUrl(); findCombination(); Por: var is_combination = checkUrl(); if (is_combination) findCombination(); Gracias por haber compartido la solucion Un Saludo
-
[Module] Hopopup - Avertissement contenu adulte
StefArts replied to yvanb's topic in Modules et thèmes gratuits
Bonjour, Oui, absolument, c'est la catégorie que je veux protéger. Ça marche nikel. Merci beaucoup.- 60 replies
-
- adulte
- disclaimer
-
(and 2 more)
Tagged with:
-
[Module] Hopopup - Avertissement contenu adulte
StefArts replied to yvanb's topic in Modules et thèmes gratuits
Bonjour à tous. Le module tourne bien que si on active le débug... nous nous trouvons avec ce petit message: Notice: Undefined index: id_category in .........file.hopopup.tpl.php on line 40 Qui est donc provoqué par: {if $smarty.get.id_category == '125'} Une petite idée? Merci. Cordialement- 60 replies
-
- adulte
- disclaimer
-
(and 2 more)
Tagged with:
-
Association Prestashop et Google Merchant
StefArts replied to marcel56's topic in Vente en ligne, référencement et SEO
Bonjour, Même problème ici. Avez-vous trouver un solution? Merci Cordialement. -
Hello, I have the same problem here... Prestashop 1.6.1.6
-
Bonjour, Je ne sais pas su vous avez résolu votre problème: Voici une solution: https://www.team-ever.com/prestashop-1-6-ne-pas-afficher-les-produits-hors-stock/ Cette solution fonctionne et cache tous les produits. Comment faire pour ne cacher les produit hors stock seulement du homefeatured? Quelqu'un a une idée? Merci.