Results 1 to 9 of 9
  1. #1
    Join Date
    Dec 2009
    Posts
    234
    Plugin Contributions
    0

    Default Custom Banner for each product category

    Hi, Ive searched the forums here but couldnt find an answer; is there a way to show a custom banner depending on the product category currently being viewed?

    I was reading this thread; http://www.zen-cart.com/forum/showth...er+category%3F

    And its close to what I want.

    Strictly speaking, i dont need a banner, but I want a large-sized image (not a thumbnail) to be at the top of the main column for each product category.

    Any thoughts on the best way to do this?

    Going by the thread referenced above, id need to set up some php if statements. If anyone can help with the syntax that would be great thanks.

    Thanks,

    Scott.

  2. #2
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: Custom Banner for each product category

    One way to approach this would be to use the ability Zen Cart has to apply a different css file to each category. The instruction about how to do this are in a readme file in the css folder of the default template and you can search the forum for further information.

    A downside of that would be that the image would be a background so would not be linkable.

    If you want to create an image that links then you would need to get stuck into a bit of php coding which is not too difficult.

    Or alternately someone may have done something similar before but I haven't seen it on the forums.

  3. #3
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Custom Banner for each product category

    Settle on a size and set it in the admin-config - images
    Zen-Venom Get Bitten

  4. #4
    Join Date
    Dec 2009
    Posts
    234
    Plugin Contributions
    0

    Default Re: Custom Banner for each product category

    Hi Guys, thanks for the reply. THe image needs to be an exact size as the right col and the header ######## up to it.

    I think ill need to build a PHP [If] and [Else] statement to do it.

    Luckily, I have a programmer friend to help me, just wanted to check here first to see if anyone had done it first.

    Cheers,

    Scott.

  5. #5
    Join Date
    Dec 2009
    Posts
    234
    Plugin Contributions
    0

    Default Re: Custom Banner for each product category

    In the interest of sharing, I figured out how to display a different image depending on which category is currently being viewed;

    PHP Code:
    <?php if ( (int)$cPath  == "1" ) {
    echo 
    '<img src="images/a.jpg">'
    }
    elseif ( (int)
    $cPath  == "2" ) {
    echo 
    '<img src="images/b.jpg">'
    }
    else {
    echo 
    '<img src="images/c.jpg">'

    }
    ?>
    cPath 1 is category one, cPath2 is category two and so on. You can keep building this "if" statement for as many categories that you have.

    The last "else" is to display a default image for any page outside of a category, e.g; privacy page, or shipping page etc.

    I know this would be elementary stuff for a php coder, but i thought id post it in case someone is looking for a fix like this.

    Cheers,

    Scott.
    Last edited by Scott_C; 3 Dec 2009 at 01:03 PM.

  6. #6
    Join Date
    Dec 2009
    Posts
    234
    Plugin Contributions
    0

    Default Re: Custom Banner for each product category

    P.S. this code was built to display in the main center column of the template; tpl_main_page.php

    I put it right after the breadcrumb code so that my different images are always at the top of the page.

  7. #7
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Custom Banner for each product category

    Hi guys, just found this thread.
    Smart Backgrounds is built to do what you want; in some situations (lots of variations) it is easier to manage, and in other situations (fewer variations) the c_##.css method is easier.

    Smart Backgrounds can be modified to switch foreground images or any other page-sensitive task as well, based on the existence of a relevant image file (described in the readme). I have a new version of it (3.0) that makes this even easier. I haven't submitted it yet, so I will attach it here until it is publicly available. I believe it is completely functional, but let me know if there is any problem.
    Last edited by gjh42; 9 Feb 2010 at 04:42 AM.

  8. #8
    Join Date
    Dec 2009
    Posts
    234
    Plugin Contributions
    0

    Default Re: Custom Banner for each product category

    Thanks Glenn, i'll check this out.

  9. #9
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Custom Banner for each product category

    Zip attachment moved to Smart Backgrounds support thread, pending activation in Free Addons.

 

 

Similar Threads

  1. select each new banner for each web page
    By OLIVIER72 in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 17 May 2010, 06:58 PM
  2. Add custom images to each category on the product listing page?
    By immersive in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 8 Jul 2009, 03:29 PM
  3. Custom Page For Each Category
    By Craig Robbo in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 27 Jan 2009, 11:36 AM
  4. Custom Box for each product
    By mattfrand in forum Basic Configuration
    Replies: 1
    Last Post: 4 Jul 2008, 02:52 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR