Page 1 of 1

Different banners

Posted: Wed Jun 27, 2018 9:34 pm
by silvalucas90
Hello community,
I have a problem, I have a banner in the header of the page and I would like to change each banner according to its category
I tried this code in header.tpl

Code: Select all

<?php if (isset($category_id) && $category_id == '59' ) { ?>
<img class="img-responsive banner" src="image/agrega/banner1.jpg" alt="">
<?php } ?>
but I get this error Undefined variable: category_id

Re: Different banners

Posted: Wed Jun 27, 2018 10:18 pm
by straightlight
This extension may provide what you need: https://www.opencart.com/index.php?rout ... n_id=26378

Re: Different banners

Posted: Thu Jun 28, 2018 6:55 pm
by silvalucas90
straightlight wrote:
Wed Jun 27, 2018 10:18 pm
This extension may provide what you need: https://www.opencart.com/index.php?rout ... n_id=26378
Thanks for the response but my banners are in the header behind the menu

Re: Different banners

Posted: Thu Jun 28, 2018 7:33 pm
by thekrotek
silvalucas90 wrote:
Thu Jun 28, 2018 6:55 pm
Thanks for the response but my banners are in the header behind the menu
It is possible to do this with custom modification. If you don't have required skills, you can as a professional developer to create such modification for some fee.

Re: Different banners

Posted: Thu Jun 28, 2018 7:43 pm
by straightlight
If these banners are already handled by using an extension, contact the extension developer where you originally downloaded this extension in order to rectify this issue.

As for using the category_id in the header, take note that the appropriate variables must be used. While $category_id variable may not exist from the header controller, in your header.tpl file, at the bottom, an example (by default) is already provided with $category.

Code: Select all

<?php if (isset($category['category_id']) == (int)$category['category_id'] == 59) { ?>
    <?php // Your argument here. ?>
<?php } ?>
This should resolved the issue.