X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Rotating the Main Image based on categories (https://forum.x-cart.com/showthread.php?t=14157)

JaredMatfess 05-23-2005 04:37 PM

Rotating the Main Image based on categories
 
I sure hope someone can help on this one...

I've got X-cart 4.x and what I'm trying to do is have it rotate the image (using the flexy rectangles skin)

It's the banner

/skin1/images/custom/main_bg_1.jpg

I have no idea which template references this file, and I'm not the best programmer, but essentially what I'd like to do is if it's on the "hats" category I want it to display the main_bg_hats.jpg which would feature some hats, on shoes, it would change the big image to main_bg_shoes.jpg

Is this something that people are doing??

shan 05-24-2005 03:00 AM

im sure youll find stuff like this in the custom mods forum but the basic rule is something like this.

Code:

{if $cat eq "1" }
[img]{$ImagesDir}/yourpic_1.jpg[/img]
{elsif $cat eq "2"}
[img]{$ImagesDir}/yourpic_2.jpg[/img]
{elsif $cat eq "3"}
[img]{$ImagesDir}/yourpic_3.jpg[/img]
{else}
[img]{$ImagesDir}/yourpic_normal.jpg[/img]
{/if}


JaredMatfess 06-11-2005 03:38 PM

Do you know where this image file is referenced? I've been looking through all the templates and just can't seem to find it..

Thanks!

JaredMatfess 06-11-2005 04:02 PM

/customer/home.tpl

got it!

ChristineP 01-05-2009 06:41 AM

Re: Rotating the Main Image based on categories
 
This is exactly what I want to do with swapping/rotating image when a (root) category is selected, though I currently have my original image in head.tpl as it sits below my logo and menu bar. Would the above script work in the head.tpl or do I need to look at this differently by using a .js file?

Any help is appreciated.
Christine

ARW VISIONS 01-05-2009 05:35 PM

Re: Rotating the Main Image based on categories
 
You could use the elseif statements in the head.tpl if you wanted to.

Quote:

Originally Posted by ChristineP
This is exactly what I want to do with swapping/rotating image when a (root) category is selected, though I currently have my original image in head.tpl as it sits below my logo and menu bar. Would the above script work in the head.tpl or do I need to look at this differently by using a .js file?

Any help is appreciated.
Christine


ChristineP 01-06-2009 07:40 AM

Re: Rotating the Main Image based on categories
 
I've been playing with this and still not getting any results other than errors. I placed my images in the skin1/images folder on the host server and tried the original code in the head.tpl as:

<div class="HeadLine" style="text-align: left; height: 153px; width: 100%; margin: 10px 0px 0px 0px">
{if $cat eq "110" }
[img]{$ImagesDir}/IR_HdrImg.jpg[/img]
{elsif $cat eq "120"}
[img]{$ImagesDir}/textbanner.jpg[/img]
{elsif $cat eq "130"}
[img]{$ImagesDir}/IR_HdrImg.jpg.jpg[/img]
{else}
[img]{$ImagesDir}/textbanner.jpg[/img]
{/if}
</div>


Also placed the same images in my Images folder on the host server and the code in the head.tpl as:
<div class="HeadLine" style="text-align: left; height: 153px; width: 100%; margin: 10px 0px 0px 0px">
{if $categories[cat_num].categoryid = "110"}
<img src="/Images/IR_HdrImg.jpg" height="153" border="0" alt="IR Bullet Cameras" />
{elseif $categories[cat_num].categoryid = "120"}
<img src="/Images/textbanner.jpg" height="153" border="0" alt="IR Bullet Cameras" />
{elseif $categories[cat_num].categoryid = "130"}
<img src="/Images/IR_HdrImg.jpg" height="153" border="0" alt="IR Bullet Cameras" />
{elseif $categories[cat_num].categoryid = "140"}
<img src="/Images/textbanner.jpg" height="153" border="0" alt="IR Bullet Cameras" />
{/if}
</div>

Do you have suggestions for me to try?

Christine

Quote:

Originally Posted by Ashley
You could use the elseif statements in the head.tpl if you wanted to.


Vetrivel 01-06-2009 07:58 AM

Re: Rotating the Main Image based on categories
 
If you get an error please post that too.So it is easy to debug.
and
TRY THIS:
<div class="HeadLine" style="text-align: left; height: 153px; width: 100%; margin: 10px 0px 0px 0px">
{if $categories[cat_num].categoryid eq "110"}
<img src="{$ImagesDir}/IR_HdrImg.jpg" height="153" border="0" alt="IR Bullet Cameras" />
{elseif $categories[cat_num].categoryid eq "120"}
<img src="{$ImagesDir}/textbanner.jpg" height="153" border="0" alt="IR Bullet Cameras" />
{elseif $categories[cat_num].categoryid eq "130"}
<img src="{$ImagesDir}/IR_HdrImg.jpg" height="153" border="0" alt="IR Bullet Cameras" />
{elseif $categories[cat_num].categoryid eq "140"}
<img src="{$ImagesDir}/textbanner.jpg" height="153" border="0" alt="IR Bullet Cameras" />
{/if}
</div>

Quote:

Originally Posted by ChristineP
I've been playing with this and still not getting any results other than errors. I placed my images in the skin1/images folder on the host server and tried the original code in the head.tpl as:

<div class="HeadLine" style="text-align: left; height: 153px; width: 100%; margin: 10px 0px 0px 0px">
{if $cat eq "110" }
[img]{$ImagesDir}/IR_HdrImg.jpg[/img]
{elsif $cat eq "120"}
[img]{$ImagesDir}/textbanner.jpg[/img]
{elsif $cat eq "130"}
[img]{$ImagesDir}/IR_HdrImg.jpg.jpg[/img]
{else}
[img]{$ImagesDir}/textbanner.jpg[/img]
{/if}
</div>


Also placed the same images in my Images folder on the host server and the code in the head.tpl as:
<div class="HeadLine" style="text-align: left; height: 153px; width: 100%; margin: 10px 0px 0px 0px">
{if $categories[cat_num].categoryid = "110"}
<img src="/Images/IR_HdrImg.jpg" height="153" border="0" alt="IR Bullet Cameras" />
{elseif $categories[cat_num].categoryid = "120"}
<img src="/Images/textbanner.jpg" height="153" border="0" alt="IR Bullet Cameras" />
{elseif $categories[cat_num].categoryid = "130"}
<img src="/Images/IR_HdrImg.jpg" height="153" border="0" alt="IR Bullet Cameras" />
{elseif $categories[cat_num].categoryid = "140"}
<img src="/Images/textbanner.jpg" height="153" border="0" alt="IR Bullet Cameras" />
{/if}
</div>

Do you have suggestions for me to try?

Christine


ARW VISIONS 01-06-2009 07:59 AM

Re: Rotating the Main Image based on categories
 
your original code is missing and 'e' in the elseif

ARW VISIONS 01-06-2009 08:01 AM

Re: Rotating the Main Image based on categories
 
Edit**

try this. make sure you use the <img src /> tag and that your files re in the skin1 images dir

<div class="HeadLine" style="text-align: left; height: 153px; width: 100%; margin: 10px 0px 0px 0px">
{if $main and $cat eq "110" }
<img src="{$ImagesDir}/IR_HdrImg.jpg" />
{elseif $main and $cat eq "120"}
<img src="{$ImagesDir}/textbanner.jpg />
{elseif $main and $cat eq "130"}
<img src="{$ImagesDir}/IR_HdrImg.jpg.jpg />
{else}
<img src="{$ImagesDir}/textbanner.jpg />
{/if}
</div>


All times are GMT -8. The time now is 05:33 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.