aleister1987 Posted June 22, 2012 Share Posted June 22, 2012 Hello all, I have just downloaded a home banner module for opencart and after trying to get in touch with the original author, it looks like his not supporting his work correctly and im stuck with TWO PHP errors. Warning: Invalid argument supplied for foreach() on line 22. Warning: array_multisort() [function.array-multisort]: Argument #1 is expected to be an array or a sort flag on line 25. The code is as follows:- <?php /* Homepage Slideshow v1.0 Brought to you by Readyman - www.alreadymade.com */ class ControllerModuleHomepageslideshow extends Controller { protected function index() { //$this->language->load('module/homepageslideshow'); //$this->data['heading_title'] = $this->language->get('heading_title'); //$this->load->model('tool/seo_url'); $this->data['config_url'] = $this->config->get('config_url'); $this->data['delay'] = $this->config->get('homepageslideshow_delay'); $this->data['speed'] = $this->config->get('homepageslideshow_speed'); $this->data['pause'] = $this->config->get('homepageslideshow_pause'); $this->data['height'] = $this->config->get('homepageslideshow_height'); $this->data['width'] = $this->config->get('homepageslideshow_width'); $a = unserialize($this->config->get('homepageslideshow_slide_image')); foreach ($a as $key => $row) { $sorting[$key] = $row['sortorder']; } array_multisort($sorting, SORT_ASC, $a); $this->data['slide_images'] = $a; $this->id = 'homepageslideshow'; if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/homepageslideshow.tpl')) { $this->template = $this->config->get('config_template') . '/template/module/homepageslideshow.tpl'; } else { $this->template = 'default/template/module/homepageslideshow.tpl'; } $this->render(); } } any help would be greatly appreciated!! Quote Link to comment https://forums.phpfreaks.com/topic/264636-php-array-error/ Share on other sites More sharing options...
Mahngiel Posted June 23, 2012 Share Posted June 23, 2012 The error is stemming from this: $a = unserialize($this->config->get('homepageslideshow_slide_image')); Either the return values for that function are not serialized or is empty/false. Try echo'ing/dumping the results to see what's being returned. Quote Link to comment https://forums.phpfreaks.com/topic/264636-php-array-error/#findComment-1356329 Share on other sites More sharing options...
aleister1987 Posted June 23, 2012 Author Share Posted June 23, 2012 Thanks for the reply! Is there anyway i could remove that or simply change the way its written. The actual application itself works. I think they are just warning errors. How would you go about changing that function? I'm not hot on PHP, that's why i have posted lol. An help would be great! Quote Link to comment https://forums.phpfreaks.com/topic/264636-php-array-error/#findComment-1356444 Share on other sites More sharing options...
Mahngiel Posted June 23, 2012 Share Posted June 23, 2012 Sure you could. Where do your images come from? Quote Link to comment https://forums.phpfreaks.com/topic/264636-php-array-error/#findComment-1356472 Share on other sites More sharing options...
aleister1987 Posted June 24, 2012 Author Share Posted June 24, 2012 My images come from a directory, im sure it's ../catalog/view/theme/default/image/ That's where the slides for the slideshow are placed and used. Quote Link to comment https://forums.phpfreaks.com/topic/264636-php-array-error/#findComment-1356569 Share on other sites More sharing options...
aleister1987 Posted June 24, 2012 Author Share Posted June 24, 2012 Could i attach a zip file with all the files relating to that file? Quote Link to comment https://forums.phpfreaks.com/topic/264636-php-array-error/#findComment-1356577 Share on other sites More sharing options...
aleister1987 Posted June 25, 2012 Author Share Posted June 25, 2012 Just to show you where the scripts are coming and going to? Quote Link to comment https://forums.phpfreaks.com/topic/264636-php-array-error/#findComment-1356908 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.