Dirty Butter Posted July 24, 2018 Share Posted July 24, 2018 I haven't been able to pin down what's happening when this error is logged: PHP Warning: A non-numeric value encountered in /xxx/public_html/plushcatalog/classes/catalogue.class.php on line 116 Lines 112-147: public function categoryPagination($page) { if ($this->_category_count) { //Pagination $catalogue_products_per_page = $GLOBALS['gui']->itemsPerPage('products', 'perpage'); if (($page * $catalogue_products_per_page) > $this->_category_count) { $new_page = (int)ceil($this->_category_count / $catalogue_products_per_page); if ($new_page < $page) { httpredir(currentPage(null, array('page'=>$new_page))); } } if (($pages = $GLOBALS['db']->pagination($this->_category_count, $catalogue_products_per_page, $page)) !== false) { // Display pagination $GLOBALS['smarty']->assign('PAGINATION', $pages); } } } I'm on today's commit of 6.2.2. Link to comment Share on other sites More sharing options...
Dirty Butter Posted August 22, 2018 Author Share Posted August 22, 2018 I think I may have found it. The number of items per page in Store Settings>Layout is Deprecated. The actual settings for the number per page are in the skins config. So I deleted the old number I still had in Store Settings and left it blank. Then I opened a page of items, used More to load the next page of items on the store front, and there was no error message. Link to comment Share on other sites More sharing options...
bsmither Posted August 22, 2018 Share Posted August 22, 2018 Certain information says the admin setting is deprecated, but I see that it is still used if the skin config does not have the newer <products> node. So, the config file setting, then the admin setting, then 10 as the last fallback. Link to comment Share on other sites More sharing options...
Dirty Butter Posted August 23, 2018 Author Share Posted August 23, 2018 Well, I was mistaken. I have a bunch of that same error message in the php error log today. It did not show up in the Admin Error Log. Link to comment Share on other sites More sharing options...
bsmither Posted August 23, 2018 Share Posted August 23, 2018 Make an insignificant edit to line 116: From: if (($page * $catalogue_products_per_page) > $this->_category_count) { To: if ( ($page * $catalogue_products_per_page ) > $this->_category_count ) { PHP does not care about statements that break across many lines (one exception), so any further error messages should show exactly which variable PHP is complaining about. Link to comment Share on other sites More sharing options...
Dirty Butter Posted August 24, 2018 Author Share Posted August 24, 2018 The error message now points to $catalogue_products_per_page I still have the Store Settings set to a blank number of products per page. I'll put it back and see what happens. Link to comment Share on other sites More sharing options...
Dirty Butter Posted August 24, 2018 Author Share Posted August 24, 2018 I tried going back to the Store Setting with a number in the products per page. It did not change the error message. Error message still points to $catalogue_products_per_page Link to comment Share on other sites More sharing options...
bsmither Posted August 24, 2018 Share Posted August 24, 2018 So these error messages are only appearing after you press the More button? But not on the initial page of a category listing (or search)? Enable debugging. In the file /classes/catalogue.class.php, near line 115: Find: $catalogue_products_per_page = $GLOBALS['gui']->itemsPerPage('products', 'perpage'); Change to: $catalogue_products_per_page = $GLOBALS['gui']->itemsPerPage('products', 'perpage');$GLOBALS['debug']->debugMessage('$cppp is: ('.gettype($catalogue_products_per_page).')'.print_r($catalogue_products_per_page,true)); When you get a page of items that has the More button at the bottom of the list, and that you get error messages, scroll to the bottom of the Debug section. There, you will find something like: Debug Messages: [0] $cppp is: (integer)6 This place in the code is just above where $catalogue_products_per_page gets used. So, if it is non-numeric, we can trace out why that is so. Link to comment Share on other sites More sharing options...
Dirty Butter Posted August 25, 2018 Author Share Posted August 25, 2018 I thought the More procedure was doing it, but I cannot reproduce it by using More to go to the second page of a Category. It's something customers are doing, but I have no idea what. Link to comment Share on other sites More sharing options...
Dirty Butter Posted August 25, 2018 Author Share Posted August 25, 2018 I just had a thought and hopefully this time I found it. I compared the time in the error log of the last occurrence and checked it against the Users Online. No one had been recorded for that time. But when I looked at Webbots for that time and followed these type links, it created the error message every time: https://dirtybutter.com/plushcatalog/russ-plush-animals.html?page=all So maybe it's the page=all that's causing it??? Link to comment Share on other sites More sharing options...
bsmither Posted August 25, 2018 Share Posted August 25, 2018 After making the edit above, use the suspect URL, and determine if page=all could cause this. Please report back what the debug message says. If page=all, then I suspect the $page variable, not the $catalogue_products_per_page variable. Link to comment Share on other sites More sharing options...
QuotesUK Posted October 9, 2018 Share Posted October 9, 2018 I have this error in my logs and it appears with a referrer from Google Link to comment Share on other sites More sharing options...
Dirty Butter Posted October 9, 2018 Author Share Posted October 9, 2018 So does that mean it's not in our code, so there's nothing to do but ignore it? I have recently discovered that View All in admin will cause it, but it does not show the error on our stock test store. Link to comment Share on other sites More sharing options...
QuotesUK Posted October 9, 2018 Share Posted October 9, 2018 No I was just saying it appears in my log files with requests made by Google. Google is probably more likely to follow all the available links than customers. But I guess in a small way it does confirm that it happens to non-admins Link to comment Share on other sites More sharing options...
havenswift-hosting Posted October 18, 2018 Share Posted October 18, 2018 https://github.com/cubecart/v6/issues/2199 Link to comment Share on other sites More sharing options...
Al Brookbanks Posted October 30, 2018 Share Posted October 30, 2018 How do I reproduce this error? Sorry I figured it out. Please see: https://github.com/cubecart/v6/commit/c2b9867df8872907389a8cdd114ded70a245653f Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.