Page 1 of 4 123 ... LastLast
Results 1 to 10 of 32
  1. #1
    Join Date
    Oct 2006
    Location
    Lostwithiel, Cornwall
    Posts
    69
    Plugin Contributions
    0

    Default Header change according to category

    Hi

    Is it possible to change the header according to category please? i.e. If the header has a man with a kilt in on the front page, when I click on the category kilts woman, can I change the header image to a woman in a kilt please?

    Also how do I change the size of category images on the home page?

    Many thanks.

    Rich

  2. #2
    Join Date
    Feb 2007
    Location
    Vienna
    Posts
    38
    Plugin Contributions
    0

    Default Re: Header change according to category

    sure.

    i'd suggest to connect the header-image to the cPath (it's easy).

    basics
    each category has it's own cPath. the first step is to write down which categories you want to use and their cPath. eg klick on the category "kilts woman" and write down the cPath from the addressbar.

    do it
    like zencart does it by default, you should set the header-image in the css file like that:
    PHP Code:
    #logoWrapper{
        
    background-imageurl(../images/header_bg.jpg);
        
    background-repeatrepeat-x;
        
    background-color#ffffff;
        
    height:75px;
        } 
    now, we connect the css with the cPath's.

    create one logoWrapper for each possible logo, and add a '_' and the cPath after "#logoWrapper" like that example:
    (assumed, the category "women kilts" has the cPath 1, and "mens kilts" is 2)
    PHP Code:
    #logoWrapper_1 {
        
    background-imageurl(../images/header_bg_women_kilt.jpg);
        
    background-repeatrepeat-x;
        
    background-color#ffffff;
        
    height:75px;
        }
    #logoWrapper_2 {
         
    background-imageurl(../images/header_bg_men_kilt.jpg);
         
    background-repeatrepeat-x;
         
    background-color#ffffff;
         
    height:75px;
         } 
    now we come to the file "/includes/templates/your_template_dir/common/tpl_header.php"
    1. find the line <div id="logoWrapper"> (line 70 here)
    2. just before that line, we specify, which cpaths we want to have the logo changed.
      add that code before the <div> and modify the $logo_cpath to your needs (here we allow cpath 1 and 2 to change the logo):
      PHP Code:
      <?php
      unset($logo_cpath);
      $logo_cpath[] = "1";
      $logo_cpath[] = "2";
      /* add as many $logo_cpath[] = ...; as you want */
      ?>
    3. replace <div id="logoWrapper"> with that:
      PHP Code:
      <div id="logoWrapper<?php if (array_search($_REQUEST['cPath'], $logo_cpath)) { echo '_' $_REQUEST['cPath']; } ?>">
    thats it!

    may sound tricky, but is completely easy. try it out!

  3. #3
    Join Date
    Oct 2006
    Location
    Lostwithiel, Cornwall
    Posts
    69
    Plugin Contributions
    0

    Default Re: Header change according to category

    Hi

    Absolutely brilliant and totally easy - thanks to you.

    Take a look at the test run:
    http://zencart.cregy.co.uk/

    Rich

  4. #4
    Join Date
    Oct 2006
    Location
    Lostwithiel, Cornwall
    Posts
    69
    Plugin Contributions
    0

    Default Re: Header change according to category

    Hi Chris

    Quote Originally Posted by crazy_chris View Post
    sure.

    i'd suggest to connect the header-image to the cPath (it's easy).

    may sound tricky, but is completely easy. try it out!

    Thanks for this and it works perfectly. Is it possible to do it with a non-cpath item please?

    http://palomablanca.org.uk/

    Thanks

    Rich

  5. #5
    Join Date
    Feb 2007
    Posts
    24
    Plugin Contributions
    0

    Default Re: Header change according to category

    I want to do this but I need to use a flash file. Can this be done through CSS?

    One thought I had was to have a hard coded header file for each category. Anyone know of an easy way to the above code changes with a header file?

  6. #6
    Join Date
    Oct 2006
    Location
    Lostwithiel, Cornwall
    Posts
    69
    Plugin Contributions
    0

    Default Re: Header change according to category

    Hi

    I am not sure I understand the question.

    1. Do you want the header to be a flash file?
    2. Do you want the header to rotate flash files?

    Thanks

    Rich

  7. #7
    Join Date
    Feb 2007
    Posts
    24
    Plugin Contributions
    0

    Default Re: Header change according to category

    I want to display a flash file in the header and rotate it out depending on the category.

    Sorry if I wasn't clear.

  8. #8
    Join Date
    Oct 2006
    Location
    Lostwithiel, Cornwall
    Posts
    69
    Plugin Contributions
    0

    Default Re: Header change according to category

    Hi Dale

    I'm not sure that it is possible with the above code but there might be another way to do it. I have asked the question on another forum and I'll continue to look and try myself.

    Rich

  9. #9
    Join Date
    May 2005
    Location
    Sweden
    Posts
    151
    Plugin Contributions
    0

    Default Re: Header change according to category

    Wonderful mod!

    One little issue though, I need the header to be inherited to my subcategories.
    Otherwise I would have to manually add approx. 200 sub and sub sub categories to my 5 top categories.

    Anyone with a nice solution?

    Also, I met some resistance with one of my categories, everything looked fine in the code and all I had to do was to create a new category to get a new id.
    The non-working id was "10", has anyone noticed this issue and have a good answer on what caused it?

  10. #10
    Join Date
    Dec 2006
    Posts
    157
    Plugin Contributions
    0

    Default Re: Header change according to category

    I must be missing something. I thought followed these instructions to the T several times and still can't get my new header to show on the corresponding category. The first thing I did was added the logowrapper and cpath to my stylesheet. See my example below:
    #logoWrapper_14 {
    background-image: url(../images/bg_hdr_bottoms.jpg);
    background-repeat: repeat-x;
    background-color: #ffffff;
    height:160px;
    }

    Then I followed these instructions:
    <?php
    unset($logo_cpath);
    $logo_cpath[] = "14";
    /* add as many $logo_cpath[] = ...; as you want */
    ?>


    And finally I replaced the divd logowrapper:
    <div id="logoWrapper<?php if (array_search($_REQUEST['cPath'], $logo_cpath)) { echo '_' . $_REQUEST['cPath']; } ?>">

    I'm using the Purpleshades template and the latest version 1.3.7. Am I missing something?

    Thanks for any help.

 

 
Page 1 of 4 123 ... LastLast

Similar Threads

  1. change all sub category images
    By SysFix in forum General Questions
    Replies: 2
    Last Post: 5 Dec 2006, 05:30 PM
  2. Category Specific header images
    By roadhead in forum Templates, Stylesheets, Page Layout
    Replies: 17
    Last Post: 16 Jul 2006, 09:10 PM
  3. change ezpages Header
    By yabora in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 13 Jul 2006, 12:03 PM
  4. Header error when adding first product to a category
    By shelleyvdp in forum Setting Up Categories, Products, Attributes
    Replies: 7
    Last Post: 3 Jul 2006, 10:29 PM
  5. Mass Category Change?
    By brimsjewelry in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 20 Jun 2006, 08:11 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
  •