Post by HenrysCat » Fri Jul 23, 2021 11:00 pm

Any one any idea how I can center the Google adsense banner?
I tried adding <div align="center"> to the start of the ad code, it worked for the banner but also centered everything else on Opencart :D I have removed that now so the banner is still aligned left.
https://xazzi.co.uk/
Thanks all
Last edited by HenrysCat on Sat Jul 24, 2021 2:32 am, edited 1 time in total.

OC Version 3.0.3.7 - Debian 10 - ISPConfig


Newbie

Posts

Joined
Fri Jul 23, 2021 2:01 pm

Post by straightlight » Fri Jul 23, 2021 11:24 pm

OC version. By either creating an event or an extension module.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

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

Post by HenrysCat » Sat Jul 24, 2021 1:47 am

Version 3.0.3.7
Creating an event? has anyone done this before?

OC Version 3.0.3.7 - Debian 10 - ISPConfig


Newbie

Posts

Joined
Fri Jul 23, 2021 2:01 pm

Post by straightlight » Sat Jul 24, 2021 1:54 am

HenrysCat wrote:
Sat Jul 24, 2021 1:47 am
Version 3.0.3.7
Creating an event? has anyone done this before?
Of course. You can either look at the documentation: https://github.com/opencart/opencart/wiki/Events-System or look at the catalog/controller/extension/advertise/google.php file as an e.g on how to build an event from a controller.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

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

Post by HenrysCat » Sat Jul 24, 2021 2:06 am

Are we talking about the same thing here? not google shopping but google ad banners, adsense.
I can't see how events can help.

I added the adsense code under common/header.twig

OC Version 3.0.3.7 - Debian 10 - ISPConfig


Newbie

Posts

Joined
Fri Jul 23, 2021 2:01 pm

Post by straightlight » Sat Jul 24, 2021 2:10 am

HenrysCat wrote:
Sat Jul 24, 2021 2:06 am
Are we talking about the same thing here? not google shopping but google ad banners, adsense.
I can't see how events can help.

I added the adsense code under common/header.twig
If you're using a custom theme, common/header.twig works just fine. As for the controller I referred, it's simply an e.g as said above.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

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

Post by HenrysCat » Sat Jul 24, 2021 2:11 am

straightlight wrote:
Sat Jul 24, 2021 2:10 am
If you're using a custom theme, common/header.twig works just fine.
OK cool, so how do I center the banner without centering the whole site?

OC Version 3.0.3.7 - Debian 10 - ISPConfig


Newbie

Posts

Joined
Fri Jul 23, 2021 2:01 pm

Post by straightlight » Sat Jul 24, 2021 2:14 am

HenrysCat wrote:
Sat Jul 24, 2021 2:11 am
straightlight wrote:
Sat Jul 24, 2021 2:10 am
If you're using a custom theme, common/header.twig works just fine.
OK cool, so how do I center the banner without centering the whole site?
The answer's already above. Without affecting the layout, you could create an extension module to achieve this. Once the module created, you simply need to assign the module to each layouts in the OC admin. Alternatively, you could use CSS to center your banner in a new class.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

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

Post by straightlight » Sat Jul 24, 2021 2:18 am

Furthermore, you could use an extension from the Marketplace to achieve this.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

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

Post by HenrysCat » Sat Jul 24, 2021 2:25 am

Fixed it,
<div align="center">
before the ad code
<div align="left">
after the ad code ;)

OC Version 3.0.3.7 - Debian 10 - ISPConfig


Newbie

Posts

Joined
Fri Jul 23, 2021 2:01 pm

Post by straightlight » Sat Jul 24, 2021 2:27 am

HenrysCat wrote:
Sat Jul 24, 2021 2:25 am
Fixed it,
<div align="center">
before the ad code
<div align="left">
after the ad code ;)
Now that the issue has been solved, please add: [SOLVED] at the beginning of the subject line on your first post.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

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

Post by paulfeakins » Mon Jul 26, 2021 5:57 pm

@straightlight
"Use an event"
"Use an extension"

Both bad suggestions in this case, please be more helpful in future - for example if suggesting an Event, explain briefly how it could apply to this particular case as well as linking to the documentation.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by paulfeakins » Mon Jul 26, 2021 6:01 pm

HenrysCat wrote:
Sat Jul 24, 2021 2:25 am
Fixed it,
<div align="center">
before the ad code
<div align="left">
after the ad code ;)
I hope you did this with vQmod or OCMOD and did not modify core OpenCart files or you may break other extensions.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by straightlight » Mon Jul 26, 2021 6:52 pm

paulfeakins wrote:
Mon Jul 26, 2021 5:57 pm
@straightlight
"Use an event"
"Use an extension"

Both bad suggestions in this case, please be more helpful in future - for example if suggesting an Event, explain briefly how it could apply to this particular case as well as linking to the documentation.
It's a free platform Paul. It's been like that for many years and people have the free will to provide their knowledge on that. Please follow the forum rules. Besides, I don't recall your presence during the weekends.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

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

Post by HenrysCat » Tue Jul 27, 2021 12:25 am

paulfeakins wrote:
Mon Jul 26, 2021 6:01 pm
I hope you did this with vQmod or OCMOD and did not modify core OpenCart files or you may break other extensions.
I did it from, Home > Theme Editor > Common > header.twig

Was this ok?

OC Version 3.0.3.7 - Debian 10 - ISPConfig


Newbie

Posts

Joined
Fri Jul 23, 2021 2:01 pm
Who is online

Users browsing this forum: No registered users and 103 guests