Post by Eleventh_Earl » Thu Aug 20, 2020 8:22 pm

Hi Experts

I am encountering a problem with OC 2.3.0.2 in the category view. When there are too many products for one page, I get a link to page 2, 3 etc. That works fine. However, when I'm viewing page 2 of the category, then click the link to return to page 1, I get the following errors displayed at the top of the browser.

Warning: A non-numeric value encountered in .../catalog/controller/product/category.php on line 174
Warning: A non-numeric value encountered in .../catalog/controller/product/category.php on line 363
Warning: A non-numeric value encountered in .../catalog/controller/product/category.php on line 363
Warning: A non-numeric value encountered in .../catalog/controller/product/category.php on line 363
Warning: A non-numeric value encountered in .../catalog/controller/product/category.php on line 371
Warning: A non-numeric value encountered in .../catalog/controller/product/category.php on line 375

The relevant lines from the category.php file are below.

Line 174 => 'start' => ($page - 1) * $limit,

Line 363 => $data['results'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($product_total - $limit)) ? $product_total : ((($page - 1) * $limit) + $limit), $product_total, ceil($product_total / $limit));

Line 371 => $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page - 1), true), 'prev');
}

Line 375 => $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page + 1), true), 'next');
}

I'm more than a little out of my depth with this one. Any suggestions as to what may be causing the error, or ideas on how to correct it would be really appreciated!

Thanks folks.

Newbie

Posts

Joined
Thu Oct 24, 2013 2:36 am

Post by IP_CAM » Thu Aug 20, 2020 11:22 pm

Well, with the exception of this line:

Code: Select all

Line 174 => 'start' => ($page - 1) * $limit,
none of the other lines as quoted matches the 2.3.0.2 default File content
you show. Something must therefore have been changed and/or added in your

Code: Select all

controller/product/category.php
File, and it's not possible, to be of any assistance this way...

My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by Eleventh_Earl » Fri Aug 21, 2020 4:22 am

Thanks for the reply. I have uploaded a fresh copy of the controller/product/category.php to eliminate any changes that may have been made.

I now get the same error messages, but with different line numbers giving the same errors.

174 => 'start' => ($page - 1) * $limit,
349 => $data['results'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($product_total - $limit)) ? $product_total : ((($page - 1) * $limit) + $limit), $product_total, ceil($product_total / $limit));
357 => $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page - 1), true), 'prev');
361 => $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page + 1), true), 'next');

I had hoped that after uploading a new file from a fresh download (prompted by your comments) that the issue would resolve, but only the line numbers have changed.

Newbie

Posts

Joined
Thu Oct 24, 2013 2:36 am

Post by khnaz35 » Sat Aug 29, 2020 11:20 am

Have your host change the PHP version ? what is your current version?

Got an urgent question that’s keeping you up at night? There might just be a magical inbox ready to help: khnaz35@gmail.com
Enjoy nature ;) :) :-*


User avatar
Active Member
Online

Posts

Joined
Mon Aug 27, 2018 11:30 pm
Location - Malaysia

Post by johnp » Sat Aug 29, 2020 5:04 pm

Try uploading a clean copy of OC into a sub folder. Something like /clean. Amend the config.php and admin/config.php and see if you can connect to the current database. That will help identify where the problem sits. Also, can you list your PHP version.

Opencart 1.5.6.5/OC Bootstrap Pro/VQMOD lover, user and geek.
Affordable Service £££ - Opencart Installs, Fixing, Development and Upgrades
Plus Ecommerce, Marketing, Mailing List Management and More
FREE Guidance and Advice at https://www.ecommerce-help.co.uk


User avatar
Active Member

Posts

Joined
Fri Mar 25, 2011 10:25 am
Location - Surrey, UK

User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by khnaz35 » Sat Aug 29, 2020 5:39 pm

xxvirusxx wrote:
Sat Aug 29, 2020 5:34 pm
You need to add (int) on some locations..
https://github.com/opencart/opencart/pull/7785/files
Some locations mean? Same lines where he had warning

Got an urgent question that’s keeping you up at night? There might just be a magical inbox ready to help: khnaz35@gmail.com
Enjoy nature ;) :) :-*


User avatar
Active Member
Online

Posts

Joined
Mon Aug 27, 2018 11:30 pm
Location - Malaysia

Post by xxvirusxx » Sat Aug 29, 2020 5:42 pm

khnaz35 wrote:
Sat Aug 29, 2020 5:39 pm
Some locations mean?
If you click on that link you will see files names....and where...

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by khnaz35 » Sat Aug 29, 2020 5:48 pm

xxvirusxx wrote:
Sat Aug 29, 2020 5:42 pm
khnaz35 wrote:
Sat Aug 29, 2020 5:39 pm
Some locations mean?
If you click on that link you will see files names....and where...
Thanks for clarifying, he must be able to solved it now

Got an urgent question that’s keeping you up at night? There might just be a magical inbox ready to help: khnaz35@gmail.com
Enjoy nature ;) :) :-*


User avatar
Active Member
Online

Posts

Joined
Mon Aug 27, 2018 11:30 pm
Location - Malaysia
Who is online

Users browsing this forum: No registered users and 70 guests