Post by SirNeo » Wed Feb 08, 2023 7:57 am

Hello,

I am new to OpenCart and i'm trying to help a friend setup his shop.
Can someone tell me how i can fix this error?

Warning: Invalid argument supplied for foreach() in /path/catalog/controller/extension/module/octabproducts.php on line 530Warning
I am using Opencart 3.0.2.0

Thanks

Newbie

Posts

Joined
Wed Feb 08, 2023 7:50 am

Post by IP_CAM » Wed Feb 08, 2023 6:22 pm

octabproducts is most likely not a default OC Module.

My Github OC Site: https://github.com/IP-CAM
5'200 + 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 paulfeakins » Wed Feb 08, 2023 7:33 pm

SirNeo wrote:
Wed Feb 08, 2023 7:57 am
I am using Opencart 3.0.2.0
As above it's caused by an extension but also you should not use this version.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by SirNeo » Fri Feb 10, 2023 1:58 am

Yes it's caused by octabproducts that come with the theme Autima that i bought some years ago and that worked very well on another website.
Maybe my friend shouldn't use the 3.0.2 version but the theme is compatible only with 3.0.2 and 3.0.3 as i am aware. The only option is to fix this theme not to change it or OC version so if someone can give me a hint i apreaciate it

527 public function getFirstProduts($products) {
528 $trdProduct = array();
529 $count = 0;
530 foreach($products as $product) {
531 if($count < 1) {
532 $product_id = $product['product_id'];
533 $trdProduct[] = $product;
534 }
535 $count++;

541 public function getOtherExcpFirstProducts($products) {
542 $excpTrdProducts = array();
543
544 $count = 0;
545 foreach($products as $product) {
546 if($count > 1) {
547 $excpTrdProducts[] = $product;
548 }
549 $count++;

530 and 545 are the lines that return the error

Newbie

Posts

Joined
Wed Feb 08, 2023 7:50 am

Post by by mona » Fri Feb 10, 2023 1:11 pm


DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by SohBH » Sun Feb 12, 2023 4:44 pm

Hi, it suggests you to check argument supplied for foreach()

Code: Select all

if (is_array($products) || is_object($products)) {
foreach($products as $product) {
...
}
}

Business Web Development | Content Creation | Analytics and Reporting | SEO


User avatar
Active Member

Posts

Joined
Mon Nov 02, 2020 12:01 am
Location - Malaysia
Who is online

Users browsing this forum: No registered users and 262 guests