lateral Posted January 30, 2015 Share Posted January 30, 2015 (edited) Hi guys I was implementing Vekia's post (http://mypresta.eu/en/art/developer/product-page-visits-counter.html) and it was working fine except for the fact that the visit counter numbers were incorrect. I decided to have a play around with the query that he was using in the FrontController and now when I start the Front Office, I get nothing, just a blank white screen in the browser. I have cleared the cache via the back office and the browser cache, I have also removed the changes that I made to the SQL code but I can't get the Front Office to work again... What else can I do???? Thanks for your help Regards Greg Edited February 3, 2015 by lateral (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted January 31, 2015 Share Posted January 31, 2015 hello turn on error reporting then instead of blank page you will see where the error is. in addition, to rebuild controllers remove cache/class_index.php file prestashop will rebuild with first page refresh Link to comment Share on other sites More sharing options...
lateral Posted January 31, 2015 Author Share Posted January 31, 2015 Thanks Vekia, I decided to restore from a backup and I'm know up and running again. If this happens again, I'll try your suggestions. Have you had time to look and fix the query that you use to get the number of Product Pages views: public static function getTotalViewed($id_product){$view1 = Db::getInstance()->getRow('SELECT pv.counter AS total FROM '._DB_PREFIX_.'page_viewed pvLEFT JOIN '._DB_PREFIX_.'page p ON pv.id_page = p.id_pageLEFT JOIN '._DB_PREFIX_.'page_type pt ON p.id_page_type = pt.id_page_typeWHERE pt.name = \'product\' AND p.`id_object` = '.intval($id_product).'');return isset($view1['total']) ? $view1['total'] : 0;} As always, Thanks for your help Regards Greg Link to comment Share on other sites More sharing options...
vekia Posted January 31, 2015 Share Posted January 31, 2015 query is okay, the problem is probably with fact that: - your shop doesnt have "data mining" module (installed and enabled) configuration of this module must look like: Link to comment Share on other sites More sharing options...
lateral Posted January 31, 2015 Author Share Posted January 31, 2015 Hi Vekia, The data Mining module has been installed and configured for many months and since the beginning of my store. Here is a screenshot of the current configuration: Regards Greg Link to comment Share on other sites More sharing options...
vekia Posted January 31, 2015 Share Posted January 31, 2015 so, what is the result if you use in product.tpl: {FrontController::getTotalViewed(Tools::getValue('id_product'))} ? Link to comment Share on other sites More sharing options...
lateral Posted January 31, 2015 Author Share Posted January 31, 2015 Hi Vekia, I am already using everything as descrivbed in your post: (http://mypresta.eu/e...ts-counter.html) including the following: {FrontController::getTotalViewed(Tools::getValue('id_product'))} If I look at the table that contains the page views there are lots of records and when I manually sum them for a specific product ID and compare the total to what is being displayed in the Front Office, they are not the same. The front office is always much much less. I also went into the MYSQL admin and ran the following query (I got it from a comment on your post) to see what it showed: SELECT pv.counter AS total FROM ps_page_viewed pvLEFT JOIN ps_page p ON pv.id_page = p.id_pageLEFT JOIN ps_page_type pt ON p.id_page_type = pt.id_page_typeWHERE pt.name = 'product' AND p.id_object = 446 I also looked at the Stats section in the Back office and compared the total with the same Product ID and it also differed significantly from the Front Office. I'm not sure what records are actually contained in the ps_page_viewed table but all I want is a total of ALL page views for each product to be displayed... Is it possible to provide me with a different query similar to the one shown above for me to try? Regards Greg Link to comment Share on other sites More sharing options...
lateral Posted February 1, 2015 Author Share Posted February 1, 2015 Hi again Vekia, I'm trying to figure out what is actually happening with the calculation of the number of pages views and the data that's actually recorded in the page_viewed table but am not finding anything that means much to me (remember that I am a newbie ). When I run the following query and I look at ID = 23, I see a total of 1131. When I look in the Stats (Back office) I see a "Total Viewed" = 77 ( have set the date range Start=2012-08-01, end = 2015-02-01. When I look at the total that is displayed on the Front Office, I see a total = 2. My guess is that the 77 is probable closer to the correct number. I had a look at Google Analytics and did some rough calculations and the pageviews is very close to 77...... SELECT id_page, (SUM(counter)) AS Total FROM ps_page_viewed GROUP BY id_page Link to comment Share on other sites More sharing options...
lateral Posted February 1, 2015 Author Share Posted February 1, 2015 Hi Vekia, I found in GitHub what looks like the code for the back office Stats "Total Viewed" total...am I correct? https://github.com/PrestaShop/statsproduct/blob/master/statsproduct.php Is it possible to rework this code? Regards Greg Link to comment Share on other sites More sharing options...
lateral Posted February 3, 2015 Author Share Posted February 3, 2015 Hey Vekia, Have you had a chance to look into this any more? It would be great to get it working correctly.... Regards Greg Link to comment Share on other sites More sharing options...
ABANGWEB Posted April 1, 2015 Share Posted April 1, 2015 (edited) Im looking display 10 product in homepage from best viewed product all visitor or counter product.. Maybe this guide can update for display 10 best counter product. Edited April 1, 2015 by ABANGWEB (see edit history) Link to comment Share on other sites More sharing options...
ghostofelvis100 Posted July 9, 2018 Share Posted July 9, 2018 On 31/01/2015 at 12:33 AM, vekia said: hello turn on error reporting then instead of blank page you will see where the error is. in addition, to rebuild controllers remove cache/class_index.php file prestashop will rebuild with first page refresh Hi, I have a similar problem - blank front office. I tried updating to 1.7.4 from 1.7.3.3 and the update failed halfway so I'm trying to restore the back-up. Back office is seemingly fine - so I assume my db is fine. When I turn on error reporting the front office remains blank. 'cache/class_index.php' is now deprecated in 1.7 - is there a current alternative? Surely this should be fixable? I'd rather not have to re-install the whole thing. Thanks for any help Andy Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now