Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Banners specific to category

Banners specific to category

Locked

Views: 1,669

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
12 Jan 2008, 9:47 PM
#1
jrstaatsiii avatar

jrstaatsiii

New Zenner

Join Date:
Sep 2007
Posts:
48
Plugin Contributions:
0

Banners specific to category

for reference...https://www.fleurdepup.com/store *please note that we are still developing and have not yet set up payment options.

If you notice on the main page, there is a gray box acting as a container for an image or .swf. It is not a banner through zencart's admin and is actually hard coded as a div into main_page.php. At the moment this image will show on every page.

I wish to have a different image/.swf load here depending on where a user is on my site. So a specific image will load for the main page and another for each category, and so on.

How would I go about doing this?

Thanks for the help.

Rich

12 Jan 2008, 10:15 PM
#2
shackle avatar

shackle

Zen Follower

Join Date:
Apr 2006
Posts:
228
Plugin Contributions:
0

Re: Banners specific to category

Have you tried replacing the gray image code with the flash code you have?

The gray image shows up on every page for me, so all you would need to do is replace it right?

EDIT: didn't notice the part you said about changing on select pages.

12 Jan 2008, 10:35 PM
#3
jrstaatsiii avatar

jrstaatsiii

New Zenner

Join Date:
Sep 2007
Posts:
48
Plugin Contributions:
0

Re: Banners specific to category

I think I might not have been clear.

Right now, that gray box is just a placeholder jpg

What I would like to accomplish is to have different images appear depending on what category the user is viewing.

So on the main page I might have an image displaying a featured product and the image would link to that product's page.

However if someone were to click on the category, fleur de Travel, an image displaying a visual of dog traveling products would appear.

So on and so forth.

So I think I need to write a conditional like,
if category id=12 then show blahblah.jpg
if category id=2 then show jibberjabber.jpg

I just don't know how to do that.

23 Jan 2008, 6:14 PM
#4
mydanilo avatar

mydanilo

Totally Zenned

Join Date:
Dec 2004
Posts:
1,024
Plugin Contributions:
0

Re: Banners specific to category

Just looked at your site and it looks to me that you figured out how to have a picture above the category title. I am trying the same thing. Could you please enlighten us how you did it?

23 Jan 2008, 8:30 PM
#5
stardancer avatar

stardancer

New Zenner

Join Date:
Dec 2007
Posts:
19
Plugin Contributions:
0

Re: Banners specific to category

mydanilo:

Just looked at your site and it looks to me that you figured out how to have a picture above the category title. I am trying the same thing. Could you please enlighten us how you did it?

You can make a banner for each category and point to it in your category description box instead of putting a category picture in :)

Easy job, once you make the banners

JoAnne

23 Jan 2008, 10:55 PM
#6
mydanilo avatar

mydanilo

Totally Zenned

Join Date:
Dec 2004
Posts:
1,024
Plugin Contributions:
0

Re: Banners specific to category

StarDancer:

You can make a banner for each category and point to it in your category description box instead of putting a category picture in :)

Easy job, once you make the banners

JoAnne

Do you mean put it just where it put the text for the category description? Wouldn't it be then below the category title? I want it to be above the category title just like fleurdepup here: http://fleurdepup.com/store/index.php?main_page=index&cPath=13_16.

Maybe I need a bit more details how to do it.

25 Jan 2008, 1:25 PM
#7
mydanilo avatar

mydanilo

Totally Zenned

Join Date:
Dec 2004
Posts:
1,024
Plugin Contributions:
0

Re: Banners specific to category

Just following up on my problem. I tried what StarDancer suggested but the result is that the Title is still above my banner picture. You can see it here.
http://www.mydanilo.com/index.php?main_page=index&cPath=7

What I want is the Title below my picture. I want eventually on every category page a banner or call it header image above the title and of course it will be specific for each category.
Here is another zen site that solved this beautifully:
http://www.isabelharris.co.nz/shop/index.php?main_page=index&cPath=5

Can somebody tell me how to do this? Pleeeeese. :lookaroun

25 Jan 2008, 5:01 PM
#8
jrstaatsiii avatar

jrstaatsiii

New Zenner

Join Date:
Sep 2007
Posts:
48
Plugin Contributions:
0

Re: Banners specific to category

sorry for the delay....but basically I used the code from this post:

http://www.zen-cart.com/forum/showthread.php?t=61790

I wrapped that code in between <div id "catImage"> </div> which was placed appropriately on the main page file. If you want in the header, it would go in the header file, etc.

let me know if this helps

25 Jan 2008, 5:14 PM
#9
jrstaatsiii avatar

jrstaatsiii

New Zenner

Join Date:
Sep 2007
Posts:
48
Plugin Contributions:
0

Re: Banners specific to category

mydanilo:

Try this:

  1. Find the file: tpl_main_page.php. Since you are planning on modifying this file, it is always best to put it into YOURTEMPLATE/common/tpl_main_page.php. I also have a file in this folder for tpl_header.php and tpl_footer.php

  2. Open tpl_main_page.php. scroll down to right below this piece of text:

<!-- eof breadcrumb --> On the next line of code, I inserted all of this exactly for my site:
<!-- bof  collection category image-->
<?php
if ($current_page_base == ("index" or "product_info"))
{?>
  <div id="collectionTitleImage"> <?php
  
  if (ereg("(^2$|^2_)",$cPath)) //fleur de spa
  { 
    echo "<img src='" . HTTP_SERVER . DIR_WS_CATALOG . "/images/spa.gif' alt='fleur de spa'>";
  }
  elseif (ereg("(^11$|^11_)",$cPath)) //fleur de sleep
  {
    echo "<img src='" . HTTP_SERVER . DIR_WS_CATALOG . "/images/sleep.gif' alt='fleur de sleep'>";
  }
  elseif (ereg("(^13$|^13_)",$cPath)) //fleur de travel
  {
    echo "<img src='" . HTTP_SERVER . DIR_WS_CATALOG . "/images/travel.gif' alt='fleur de travel'>";
  }
  elseif (ereg("(^6$|^6_)",$cPath)) //fleur de wear
  {
    echo "<img src='" . HTTP_SERVER . DIR_WS_CATALOG . "/images/top.gif' alt='fleur de wear'>";
  }
  elseif (ereg("(^9$|^9_)",$cPath)) //fleur de accessory
  {
    echo "<img src='" . HTTP_SERVER . DIR_WS_CATALOG . "/images/accessory.gif' alt='fleur de accessory'>";
  }
  elseif ($this_is_home_page) //home page
{
echo "<img src='" . HTTP_SERVER . DIR_WS_CATALOG . "/images/index.gif' alt='Home Page'>";
}
  ?>
  </div> <?php 
} ?>
<!-- eof  collection category image -->

I think this will answer your question. This code was originally given to me by the gjh42 from the post i linked previously so he dersvers all the credit.

Later, and hope it works

Rich

25 Jan 2008, 9:08 PM
#10
mydanilo avatar

mydanilo

Totally Zenned

Join Date:
Dec 2004
Posts:
1,024
Plugin Contributions:
0

Re: Banners specific to category

Many thanks, I will give it a try.