rgwhitaker Posted September 3, 2013 Share Posted September 3, 2013 I'm still trying to work on getting the rating stars to appear in a category list. I'm basing the steps on the tutorial found here: http://nemops.com/prestashop-product-rating-product-list/ I can get to step #3, but when I look at the categories in my store, the stars to do not appear. I also looked in the database, and the hook isn't appearing there either. So, for some reason, it's not even getting processed. Is the hook name (ProductInList) case sensitive? Because I notice in Step #1, the "p" is lower case. Link to comment Share on other sites More sharing options...
vekia Posted September 4, 2013 Share Posted September 4, 2013 hello use {debug} command in .tpl file where you've got hook execution. then refresh website, you will see all available hooks / variables on page does the new hook exist on list? Link to comment Share on other sites More sharing options...
NemoPS Posted September 4, 2013 Share Posted September 4, 2013 Oh, you're following my tut Can you check if the module is listed in modules->positions under that hook? You might need to check 'display non positionable hooks' Link to comment Share on other sites More sharing options...
rgwhitaker Posted September 4, 2013 Author Share Posted September 4, 2013 Nemo: Yes. The productInList appears in the Modules > Positions list! It's the last one. But, for some reason, the stars do not appear. Vekia: I don't know how to do a {debug}. Do I need to do debug now that I've determined that the "productInList" hook appears in the Modules > Positions list? Link to comment Share on other sites More sharing options...
NemoPS Posted September 4, 2013 Share Posted September 4, 2013 can you try adding die('here I am) at the beginning of the new hook function in productcomments.php? At least you'll know if the hook as been loaded. You can take that line down till it's not triggering anymore to try and find the issue Link to comment Share on other sites More sharing options...
rgwhitaker Posted September 4, 2013 Author Share Posted September 4, 2013 Do you mean this function? function hookProductInList($params){ echo 'hey there';} So, with the line you recommended, should it look like this: function hookProductInList($params){ die('here i am') echo 'hey there';} You can take that line down till it's not triggering anymore to try and find the issue. What does that mean? Link to comment Share on other sites More sharing options...
rgwhitaker Posted September 4, 2013 Author Share Posted September 4, 2013 Here's what I did. I changed the function at the bottom of the productcomments.php file as follows: function hookProductInList($params){ die('here i am');} I then refreshed a category page and nothing happened. Should I have done something else? Link to comment Share on other sites More sharing options...
NemoPS Posted September 5, 2013 Share Posted September 5, 2013 You mean "here I am" is not appearing? Link to comment Share on other sites More sharing options...
rgwhitaker Posted September 5, 2013 Author Share Posted September 5, 2013 (edited) That's right. The "here i am" is not appearing. This is driving me crazy! I'm following your tutorial exactly and it's not working! Edited September 5, 2013 by rgwhitaker (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted September 5, 2013 Share Posted September 5, 2013 I'm kinda clueless at this point, try resetting the module Link to comment Share on other sites More sharing options...
rgwhitaker Posted September 5, 2013 Author Share Posted September 5, 2013 I've done that MANY times. Doesn't work. I did try it again, though, and resetting the Product Comments module doesn't make a difference. Link to comment Share on other sites More sharing options...
El Patron Posted September 5, 2013 Share Posted September 5, 2013 what causes a hook not to be processed? putting the hook in the wrong file. order of files: 1. themes/yourtemplate 2. root it just sounds to me like you are updating a file that is not being executed by ps my plug nickel Link to comment Share on other sites More sharing options...
rgwhitaker Posted September 5, 2013 Author Share Posted September 5, 2013 Let's just review what I've done so far. Perhaps you can tell me if I've done something wrong. 1) In the productcomments.php file (found in the modules/productcomments/ directory), I added the following at the top of the file (text in red is what I added): public function install() { if (!file_exists(dirname(__FILE__).'/'.self::INSTALL_SQL_FILE)) return false; else if (!$sql = file_get_contents(dirname(__FILE__).'/'.self::INSTALL_SQL_FILE)) return false; $sql = str_replace(array('PREFIX_', 'ENGINE_TYPE'), array(_DB_PREFIX_, _MYSQL_ENGINE_), $sql); $sql = preg_split("/;\s*[\r\n]+/", trim($sql)); foreach ($sql as $query) if (!Db::getInstance()->execute(trim($query))) return false; if (parent::install() == false || !$this->registerHook('productTab') || !$this->registerHook('extraProductComparison') || !$this->registerHook('productTabContent') || !$this->registerHook('header') || !$this->registerHook('productOutOfStock') || !$this->registerHook('productInList') || !Configuration::updateValue('PRODUCT_COMMENTS_MINIMAL_TIME', 30) || !Configuration::updateValue('PRODUCT_COMMENTS_ALLOW_GUESTS', 0) || !Configuration::updateValue('PRODUCT_COMMENTS_MODERATE', 1)) return false; return true; } Then, at the bottom of the productcomments.php file, I added the following: function hookProductInList($params){ echo('hey there');} 2) Then, in the product-list.tpl file (found in the themes/mytheme/ directory), I added the following: <h3><a class="product_link" href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.name|escape:'htmlall':'UTF-8'}">{$product.name|escape:'htmlall':'UTF-8'|truncate:35:'...'}</a></h3> {hook h='productInList' idproduct=$product.id_product} At this point the "hey there" should show up when I look at a category of products, right? Did I miss anything? Link to comment Share on other sites More sharing options...
rgwhitaker Posted September 5, 2013 Author Share Posted September 5, 2013 VEKIA: I'm updating the following files, as per Nemo's tutorial: 1) productcomments.php (found in modules/productcomments directory), and 2) product-list.tpl (found in themes/mytheme directory) Are these really the correct files that I need to be modifying, or are there others that I need to modify to get the result I want? Link to comment Share on other sites More sharing options...
El Patron Posted September 5, 2013 Share Posted September 5, 2013 just out of curiosity do you have: themes/yourtheme/modules/productcomments Link to comment Share on other sites More sharing options...
rgwhitaker Posted September 5, 2013 Author Share Posted September 5, 2013 Vekia: Yes! I do have a themes/mytheme/modules/productcomments directory. But, within this directory, there are only .tpl files. The following files exist within this directory: productcomments-extra.tpl productcomments.tpl productscomparison.tpl tab.tpl Should I look at making the changes that Nemo suggested in the productcomments.php file now in the productcomments.tpl file? Link to comment Share on other sites More sharing options...
rgwhitaker Posted September 5, 2013 Author Share Posted September 5, 2013 Actually, in looking at the productcomments.tpl file within the themes/mytheme/modules/productcomments directory, it seems to be for the comments found within the product page only. Link to comment Share on other sites More sharing options...
NemoPS Posted September 6, 2013 Share Posted September 6, 2013 Now... It might be redundant to ask, but since I'm clueless at this point: what's your prestashop version? 1 Link to comment Share on other sites More sharing options...
rgwhitaker Posted September 6, 2013 Author Share Posted September 6, 2013 I'm running Prestashop 1.5.4.1 and have a purchased theme, NOT the default theme. Link to comment Share on other sites More sharing options...
NemoPS Posted September 6, 2013 Share Posted September 6, 2013 Okay, can you perhaps check if it works with the default one? Just to be sure. I am really clueless at this point, I have to be honest Link to comment Share on other sites More sharing options...
rgwhitaker Posted September 7, 2013 Author Share Posted September 7, 2013 Actually, I no longer have the default theme. I think I deleted it. How can I get it back to test it? Link to comment Share on other sites More sharing options...
NemoPS Posted September 7, 2013 Share Posted September 7, 2013 You can re-download your very same prestashop version's package and copy it from there Link to comment Share on other sites More sharing options...
rgwhitaker Posted September 7, 2013 Author Share Posted September 7, 2013 I copied the default theme over to my server from my hard drive. I then changed the theme within the admin panel to the default theme, and then when I looked at the site, it was a mess! It was a combination of the default theme and my purchased theme. If I tried to look at a single product page, the page came up blank. So, right now I'm not going to waste time on the default theme. I don't want to use it anyway! I still cannot get the stars to appear in a category listing on my theme. Would purchasing a rating module, like the Google Rich Snippets + Product Ratings and Reviews, allow me to get the stars in a category listing? Or is this module just based on the Product Comments module? Link to comment Share on other sites More sharing options...
rgwhitaker Posted September 7, 2013 Author Share Posted September 7, 2013 Question: Is this the correct code to put in the product-list.tpl file: {hook h='productInList' idproduct=$product.id_product} Is the idproduct=$product.id_product code correct to grab the correct information? Link to comment Share on other sites More sharing options...
rgwhitaker Posted September 11, 2013 Author Share Posted September 11, 2013 Anyone? Link to comment Share on other sites More sharing options...
NemoPS Posted September 11, 2013 Share Posted September 11, 2013 Hi, Yes, that's the way to go I REALLY am clueless! There is no apparent reason why this shouldn't work Link to comment Share on other sites More sharing options...
rgwhitaker Posted September 11, 2013 Author Share Posted September 11, 2013 I have no other clue either. Perhaps it's a conflict with my theme. Link to comment Share on other sites More sharing options...
El Patron Posted September 11, 2013 Share Posted September 11, 2013 I followed this guide and it technically worked. I'm closing this as it's to painful to watch. If the OP can make a good case to open it, then PM me. Link to comment Share on other sites More sharing options...
Recommended Posts