• Hi to Everyone,

    A notice appears on the top of my homepage (https://shanti-music.com/shop/). It goes like this: Notice: Undefined index: banner_id in /home/wtjkcewo

    How do I solve this coding issue? Please note I’m not an IT expert at all… just a website owner learning as I go.

    Thanks in advance.

    hln

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter hlnrnld

    (@hlnrnld)

    Sorry… here is the full notice:

    Notice: Undefined index: banner_id in /home/wtjkcewo/public_html/shop/catalog/controller/module/slideshow.php on line 17

    Dear,
    It seems that your site is not powered by WordPress. Are you sure you use WordPress for your site?

    Thread Starter hlnrnld

    (@hlnrnld)

    Hi Daanial,

    I use a WordPress site (https://shanti-music.com/). The page in question is the shop site for my page and it is powered by OpenCart.

    However the PHP coding can be accessed at my cPanel pages. I have located the exact page where the PHP coding is indicated. I only need to know what I should add or subtract in the codes to remove the error notification on my shop homepage. Or perhaps could it be more complicated than that?

    I’d appreciate some assistance.

    Thanks,
    Helen

    Hi Helen,

    Actually I have never worked with OpenCart but if I want to check it I can advice you to check shop/catalog/controller/module/slideshow.php on line 17 and probably remove the whole banner_id line there, but this can make other problems so always make some backups first and be careful with what you do.

    Thread Starter hlnrnld

    (@hlnrnld)

    Daanial,

    I tried and yes, it caused more problems…

    This is what’s found on line 17:
    $results = $this->model_design_banner->getBanner($setting[‘banner_id’]);

    I removed it and got an additional warning on the top of my shop homepage:
    Warning: Invalid argument supplied for foreach() in /home/wtjkcewo/public_html/shop/catalog/controller/module/slideshow.php on line 19

    I removed line 19 and saved it. The whole shop page disappeared! LOL. Well I restored everything and we’re back with the original notice on my page.

    I’ll keep looking into the matter and would certainly appreciate anyone’s input for repairing the codes.

    I’m pasting the whole code found on the slideshow php below in case it makes sense to anyone out there:

    <?php
    class ControllerModuleSlideshow extends Controller {
    protected function index($setting) {
    static $module = 0;

    $this->load->model(‘design/banner’);
    $this->load->model(‘tool/image’);

    $this->document->addScript(‘catalog/view/javascript/jquery/nivo-slider/jquery.nivo.slider.pack.js’);
    $this->document->addStyle(‘catalog/view/theme/’ . $this->config->get(‘config_template’) . ‘/stylesheet/slideshow.css’);

    $this->data[‘width’] = $setting[‘width’];
    $this->data[‘height’] = $setting[‘height’];

    $this->data[‘banners’] = array();

    $results = $this->model_design_banner->getBanner($setting[‘banner_id’]);

    foreach ($results as $result) {
    if (file_exists(DIR_IMAGE . $result[‘image’])) {
    $this->data[‘banners’][] = array(
    ‘title’ => $result[‘title’],
    ‘link’ => $result[‘link’],
    ‘image’ => $this->model_tool_image->resize($result[‘image’], $setting[‘width’], $setting[‘height’])
    );
    }
    }

    $this->data[‘module’] = $module++;

    if (file_exists(DIR_TEMPLATE . $this->config->get(‘config_template’) . ‘/template/module/slideshow.tpl’)) {
    $this->template = $this->config->get(‘config_template’) . ‘/template/module/slideshow.tpl’;
    } else {
    $this->template = ‘default/template/module/slideshow.tpl’;
    }

    $this->render();
    }
    }
    ?>

    Thanks and regards,
    Helen

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Undefined index’ is closed to new replies.