Results 1 to 9 of 9
  1. #1
    Join Date
    Nov 2008
    Posts
    71
    Plugin Contributions
    0

    Default Edit php to make specific product title an image

    Hi, using 1.39h and will try and keep it as simple as possible because I think I am close?
    I have tried the Images for Titles add-on too, and it doesn't work for this specifically. But I am trying to take a little of that and apply it to a specific place in my php to call an image instead of the Product Title-->
    The Page example:
    http://www.paynemason.com/Showcase/p...ndex&cPath=2_7

    **Where it says "Black Lion Robusto Primier" in Grey, to the right of the product image - only in this spot - is where I want to place an image. Not anywhere else the Product Name or _id is called in to show "Black Lion Robusto Primier" . I only want to change the the title to an image where it is listed under it's category.

    Here is the hack/image call from the Add-on Image for Title modification to tpl_product_info_display.php

    <!--bof Product Name-->
    <h1 id="productName" class="productGeneral"><?php echo title_image_exists($products_name, 'prodname' . $_GET['products_id']); ?></h1>
    <!--eof Product Name-->

    So I figured to find and switch out id="itemTitle" (* id I'm getting with firebug where these product titles I want changed are) with id=productName. Problem I'm having is putting this in the right spot in the following php page:

    /includes/templates/template_default/common/product_listing.php
    and
    /includes/modules/product_listing.php

    --because these are the only two pages calling for "itemTitle" like this:
    $lc_text = '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'manufacturers_id=' . $_GET['manufacturers_id'] . '&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h3><div>
    and

    $lc_text = '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing->fields['products_id']) . '">

    or this one in includes/modules/product_listing
    '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id'] > 0) ?



    so I tried to put that code from the product_info_display edit to the product_listing page but can't seem to get it. Anybody done this or have a different way of looking at it?

    Thanks!

  2. #2
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Edit php to make specific product title an image

    Quote Originally Posted by danwebman View Post
    I have tried the Images for Titles add-on too, and it doesn't work for this specifically.
    How exactly does it not work?
    What specifically does it do differently than what you are expecting?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Nov 2008
    Posts
    71
    Plugin Contributions
    0

    Default Re: Edit php to make specific product title an image

    Hi. It changes up the Title on the product info page, but not the page I showed in the link. I don't want any changes to the product info page- I only want to edit in an image for the product title on this specific page. The page where it is a listing of all the products in that category.

  4. #4
    Join Date
    Nov 2008
    Posts
    71
    Plugin Contributions
    0

    Default Re: Edit php to make specific product title an image

    acctually, what would give me the easest help for you is to just let me know what page to edit- which .php am I looking for that displays the page I am looking to edit? Then I will at least know I am testing the right part. Thanks!

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

    Default Re: Edit php to make specific product title an image

    Yes, you are correct: Images for Titles is not currently configured to handle product names in the product listing page.
    It is a simple matter to extend the functionality, however.

    First, there is no /includes/templates/template_default/common/product_listing.php.
    Perhaps you are thinking of /includes/templates/template_default/templates/tpl_modules_product_listing.php?
    Also, /includes/modules/product_listing.php is a core file; if you want to modify it, copy it to /includes/modules/your_template/product_listing.php.

    PHP Code:
    title_image_exists($products_name'prodname' $_GET['products_id']) 
    can be adapted to the product listing as
    PHP Code:
    title_image_exists($listing->fields['products_name'], 'prodlistname' $listing->fields['products_id']) 
    This can be substituted for
    $listing->fields['products_name']
    in product_listing.php for the product name item case (be sure you are working on the list set of cases and not the heading set).

    Name your images like prodlistname23.gif.

  6. #6
    Join Date
    Nov 2008
    Posts
    71
    Plugin Contributions
    0

    Default Re: Edit php to make specific product title an image

    Intresting, so I did it(replace $listing->fields['products_name'] with the code you showed me) and the listing page still works, So I'm pretty sure the code is going in there solid, but the image isn't showing. named prodlist64.png for product id #64 and nothing. Still the text. Am I maybe putting the image in the wrong spot. Put it in images folder and buttons folder?

  7. #7
    Join Date
    Nov 2008
    Posts
    71
    Plugin Contributions
    0

    Default Re: Edit php to make specific product title an image

    To add, I went with:
    case 'PRODUCT_LIST_NAME':
    $lc_align = '';
    $lc_text = '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id'] > 0) ? zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . title_image_exists($listing->fields['products_name'], 'prodlistname' . $listing->fields['products_id']) . '</a></h3><div class="listingDescription">' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listi ng->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>';
    break;

    inthe modules/product_listing.php

  8. #8
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Edit php to make specific product title an image

    Quote Originally Posted by danwebman View Post
    the image isn't showing. named prodlist64.png for product id #64 and nothing. Still the text.
    Why are you using .png ? And why aren't you using "prodlistname" as the prefix?
    Glenn said:
    Quote Originally Posted by gjh42 View Post
    Name your images like prodlistname23.gif.
    And the documentation for the mod says
    Name your product-name images like prodname69.gif, and save in /your_template/buttons/your_language/. Replace the number with the product id
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  9. #9
    Join Date
    Nov 2008
    Posts
    71
    Plugin Contributions
    0

    Default Re: Edit php to make specific product title an image

    Using .png for the quality w/transparency. Edited the .php to include .png's in the modified files from Images for Titles.

    Accidentally wrote ##########= really had images named- prodlistname64.png and prodlistname64.gif in that buttons folder behind my template_default.... duh! Thanks for all the help!! I made a new buttons/english/prodlistnameXX.png uploaded and pow, looks great :)

 

 

Similar Threads

  1. edit alt text(title) of a sidebox image
    By wagnerguy in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 27 Jan 2012, 07:44 AM
  2. Replies: 5
    Last Post: 18 Sep 2011, 05:37 PM
  3. Edit Product: No Title or Description?
    By coxdabd in forum General Questions
    Replies: 3
    Last Post: 16 Dec 2010, 08:32 AM
  4. How to make a product image fill a specific space?
    By Inudat1966 in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 18 Jul 2010, 10:00 PM
  5. add an image to a specific product page
    By gsdcypher in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 15 Sep 2009, 02:06 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