Post by silvalucas90 » Wed Jun 27, 2018 9:34 pm

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

Newbie

Posts

Joined
Mon Mar 26, 2018 8:24 am

Post by straightlight » Wed Jun 27, 2018 10:18 pm

This extension may provide what you need: https://www.opencart.com/index.php?rout ... n_id=26378

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by silvalucas90 » Thu Jun 28, 2018 6:55 pm

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

Newbie

Posts

Joined
Mon Mar 26, 2018 8:24 am

Post by thekrotek » Thu Jun 28, 2018 7:33 pm

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.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by straightlight » Thu Jun 28, 2018 7:43 pm

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.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 53 guests