Post by schlegk » Sun Mar 06, 2011 5:57 pm

I have installed the Cleaner by Default 2-Column template and would like to randomly change my header image banner when customers click on different pages. Ideally there would be 5 different banners which would appear.

The Cleaner by Default 2-Column template can be found here:
http://www.opencart.com/index.php?route ... order=DESC

Any help on what code to add and where to add it would be appreciated.

Thanks!
Karim

Newbie

Posts

Joined
Sun Jan 16, 2011 1:30 am

Post by Chones » Sun Mar 06, 2011 7:02 pm

Hi Karim, sorry for not replying sooner.

Firstly you need to create your 5 banners - name them header-bg-1.jpg, header-bg-2.jpg, header-bg-3.jpg etc.

Then in your stylesheet change

Code: Select all

#cmtop-banner {
	background: #144a92 url('../image/header-bg.jpg') top left no-repeat;
	height: 150px;
	width: 960px;
}
to

Code: Select all

#cmtop-banner {
	height: 150px;
	width: 960px;
}
Finally, in your header template find <div id="cmtop-banner"> and change it to

Code: Select all

<div id="cmtop-banner" style="background: #144a92 url('catalog/view/theme/<?php echo $template ?>/image/header-bg-<?php echo rand(1, 5); ?>.jpg') top left no-repeat;">
That should work.

http://scarletandjones.com/
http://sharpdressedman.co.uk/
http://coffincompany.co.uk/
http://horsesculptures.co.uk/
If I've helped you out, why not buy me a beer? http://craigmurray.me.uk


User avatar
Active Member

Posts

Joined
Wed Mar 24, 2010 9:07 pm
Location - London

Post by schlegk » Thu Mar 10, 2011 3:11 am

Works great! Thank you.

Newbie

Posts

Joined
Sun Jan 16, 2011 1:30 am
Who is online

Users browsing this forum: No registered users and 30 guests