Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    Nov 2007
    Location
    Pennsauken, NJ
    Posts
    71
    Plugin Contributions
    0

    Default Image Headers for Product Listing Page

    Hi all.

    I had wanted to be able to put some stylized image text above each product listing pages (in place of the category name), and have it different for each category, but I didn't want to affect the category box, as I wanted that to stay as text.

    I had not been able to find a solution for this, and so I figured one out myself.

    The modification only affects the tpl_index_product_list.php file, located in the /includes/templates/YOUR_TEMPLATE/templates folder.

    And you simply change the following line:

    Code:
    <h1 id="productListHeading"><?php echo $breadcrumb->last(); ?></h1>
    With this:

    Code:
    <div align="center">
    <br/>
    <?php 
    $spacereplace = trim($breadcrumb->last());
    $spacereplace = str_replace (" ", "_", $spacereplace); 
    $catimagestring = "<img src=\"/menu/images/$spacereplace.gif\" />"; echo $catimagestring; 
    ?>
    <br/>
    </div>
    The above stores the images in the main images directory, but that can obviously be changed to whatever you want.

    Essentially all it does is take the category name, replace the spaces between words (if any) with underscores, and appends the ".gif" extension and puts in an IMG tag. So you need to have an image file that is named exactly in this way so that it can find the file.

    The only drawback to this method (albeit minor) is that you have a few characters that you cannot use in your category names in order for this to work correctly (i.e. / or " or . etc). Maybe there is a way to solve this too, but I am not that familiar with PHP to know what it is yet.

    If you want to see it in action, check the following link? (Currently only the first 4 categories are set up with images. So click on one of them.)

    http://www.bestpizzainphilly.net/menu

    Hope this helps!

    Chris

  2. #2
    Join Date
    Nov 2007
    Location
    Pennsauken, NJ
    Posts
    71
    Plugin Contributions
    0

    Default Re: Image Headers for Product Listing Page

    One more thing is that when you name your image files, make sure that, in addition to the "_" between the words, that the letters match the CASE of the letters in the category name exactly, or it won't find the file.

    Chris

  3. #3
    Join Date
    Feb 2007
    Posts
    159
    Plugin Contributions
    0

    Default Re: Image Headers for Product Listing Page

    Love what you have done with the images. I see you're almost finished. I'm going to try your technique as it seems it's exactly what I want to do. Sure wish there was a WYSIWYG editior for MACs to just put and place images in exchange for all the hand coding one has to do with PHP.

    So from what I understand you said is that you name the category image the same as the category you are replacing with the same CASE, right?


    Beth-Katherine

 

 

Similar Threads

  1. v151 Image Lazy Loader for the product listing page
    By delia in forum All Other Contributions/Addons
    Replies: 40
    Last Post: 3 Aug 2022, 08:09 PM
  2. Different image for product listing page
    By thebigkick in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 2 Jul 2012, 05:04 PM
  3. Different image for product listing and Product Info?
    By JuanDBB in forum Basic Configuration
    Replies: 2
    Last Post: 7 Apr 2009, 09:32 PM
  4. looking for: new product listing page with browse buttons for more than one image
    By vandiermen in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 21 Feb 2009, 03:05 AM
  5. Use one image for product listing and another for product detail
    By Outlawlb in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 20 Mar 2007, 06:09 AM

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