josh1r Posted May 3, 2020 Share Posted May 3, 2020 Hi. I want to start by saying that I haven't (fortunately) been on this forum in years, as my old osc site has continued to work well over the years. I also haven't done any development on the site in ages, so I admit I don't fully remember how osc/php/etc.. works (I was self-taught years ago and remember some of it, but not all). In any case, sometime in the past week or so (I think, but it could have happened longer ago), something went wrong with manufacturers.php There is now an error on my site (blueluxe.com) on the left hand nav bar which says: Warning: Invalid argument supplied for foreach() in /home/blueluxe/public_html/includes/boxes/manufacturers.php on line 38 I haven't made any changes to my site in ages (literally months/years) so I don't think I did anything to cause this. I asked my webhost to check php/database versions/changes and they claim they didn't cause this. Any thoughts? Thanks so much! Link to comment Share on other sites More sharing options...
burt Posted May 3, 2020 Share Posted May 3, 2020 2 minutes ago, josh1r said: Any thoughts? It might be a very good idea to provide this: 2 minutes ago, josh1r said: Warning: Invalid argument supplied for foreach() in /home/blueluxe/public_html/includes/boxes/manufacturers.php on line 38 so what is the code on line 38 exactly. Link to comment Share on other sites More sharing options...
josh1r Posted May 3, 2020 Author Share Posted May 3, 2020 Geez, sorry, yeah, that would help... line 38 is: foreach ($manufacturers as $man) { and i also attached the whole file manufacturers.php Link to comment Share on other sites More sharing options...
burt Posted May 3, 2020 Share Posted May 3, 2020 empty your cache (in admin) this *might* fix it check your list of manufacturers (in admin) all look correct? turn off the manufacturers box if all else fails And, think about uprating to Phoenix, as your version is ancient. It was EOL a decade ago... Link to comment Share on other sites More sharing options...
josh1r Posted May 3, 2020 Author Share Posted May 3, 2020 Thanks. Neither 1 nor 2 helped, so I'll turn it off for now. Is there a way (probably within my hosting so I'll ask them as well, to track/log what exactly might be causing that error? As for updating, I'm sure that's way more involved than I can handle right now. Again, I haven't done anything on the site in ages, don't remember a lot of what I taught myself, and don't want to pay someone right now to do the update. But I will look into it as I've never even heard of it before (that's how out of the loop of I am...!). Link to comment Share on other sites More sharing options...
hungryfrank Posted May 4, 2020 Share Posted May 4, 2020 ask your host, it might be because your host has upgraded the php. you can turn the error reporting off, see if it works? it is a warning after all. you can see if your host can go back to the old php. you can cut up to 4 pages of your checkout by using my three add_ons login create account in one page Express checkout login pop up modal Link to comment Share on other sites More sharing options...
♥ecartz Posted May 4, 2020 Share Posted May 4, 2020 3 hours ago, josh1r said: Is there a way (probably within my hosting so I'll ask them as well, to track/log what exactly might be causing that error? This isn't something a host can help you do. It's a coding thing. You'd hire a developer to troubleshoot. If you want to continue to try yourself: $manufacturers = $cache->get_cache('manufacturers', 'ARRAY'); $total_rows = count($manufacturers); if ($total_rows < 1) { Consider commenting out these lines and the closing } and see if it works. Or change them to $manufacturers = $cache->get_cache('manufacturers', 'ARRAY'); $total_rows = count($manufacturers); if (is_array($manufacturers) && $total_rows < 1) { You could also add var_dump($manufacturers); and see what it says. That would go before the if and after the closing } for the if. The basic problem though is that that version is so old that there is no supported PHP for it any more. The simplest solution would be to turn off the box. It doesn't work this way, so not a big deal to turn it off. Always back up before making changes. Link to comment Share on other sites More sharing options...
josh1r Posted May 4, 2020 Author Share Posted May 4, 2020 Commenting out : // $manufacturers = $cache->get_cache('manufacturers', 'ARRAY'); // $total_rows = count($manufacturers); // // if ($total_rows < 1) { $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name"); $total_rows = tep_db_num_rows($manufacturers_query); while ($man = tep_db_fetch_array($manufacturers_query)) { $manufacturers[] = $man; } // } pretty much did the trick! however, it shows manufacturers even if they have no products (not a big deal, i can live with that!) thanks so much! Link to comment Share on other sites More sharing options...
josh1r Posted May 5, 2020 Author Share Posted May 5, 2020 Quick follow-up; does that fact that I commented out the lines above tell us what exactly was causing the original problem? Link to comment Share on other sites More sharing options...
♥ecartz Posted May 5, 2020 Share Posted May 5, 2020 It says that the cache was corrupted and not reloading. There may have been a PHP update on your host that changed how count handled things in that case. I have a sort of vague recall that something used to be a zero that may now be a one. But since that code doesn't set the cache block, there's no way to fix it there. You might be able to fix it in whatever the $cache thing is, but I don't believe that's standard. I think that's an App you added. Because I recall the core caching as working differently. Of course, that's old enough that perhaps my recall is wrong. You commented out the code that checks if the cache is working and falls back to a database query. So it just always does the database query. Because the cache was returning that it was working even though it didn't seem to be. Always back up before making changes. Link to comment Share on other sites More sharing options...
josh1r Posted May 5, 2020 Author Share Posted May 5, 2020 Ok thanks so much Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.