Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Nov 2008
    Posts
    60
    Plugin Contributions
    0

    Default Add more info link to product listing description when description is truncated

    First of all, this is for ZC version 1.3.8. There may be some differences in earlier versions.

    On the All Products page, when a product's description is truncated (does not all display because it's too long), a More Info link appears at the end of the description. For some reason, the Product Listing page was not coded this way. Instead, all you get is an ellipse at the end of the truncated description, which isn't enough for the unobservant shopper.

    I found solutions that would add the link to the product listing description, but all the ones I found add the link regardless of whether or not the description is truncated, in other words, even when there actually is no other information to go see.

    Upon taking a look at how the link code works on the All Products page, I managed to get it to work properly on the Product Listing page, appearing only when it should. I figured that others might want to do this as well, so here are the instructions.

    You'll be changing one file: product_listing.php. If you have made no previous alterations to that file, look for it in /includes/modules/. Once you've made the changes, put it in /includes/modules/your_template/. Do not apply the changes to the default file.

    In the above file, find the following code (within lines 98 and 100 if no previous changes have been made to the file):
    Code:
    <div class="listingDescription">' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>';
    Replace with:
    Code:
    <div class="listingDescription">' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION, ' <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']) . '">' . MORE_INFO_TEXT . '</a>') . '</div>';
    IMPORTANT: There are two places in the file that have this code. Be sure to change both.

    And that's it. You should now get a more info link after every truncated description on the Product Listing page but not when the description is all there, just like you do on the All Products page.

    Be aware that if a product has attributes, there will now be two 'more info' links, the one at the end of the description and the one in the usual spot in place of the Buy Now or Add to Cart button.

  2. #2
    Join Date
    Jan 2007
    Posts
    105
    Plugin Contributions
    0

    Default Re: Add more info link to product listing description when description is truncated

    This is TERRIFIC and a big thank you...:). One problem I have with this though, is when I click on "New Products" it is at the end of my description, it shows a number associated to the category product ID and the "more info" is under my image. I'd like it to be exactly displayed the same as my Product Listing on main categories. Any ideas how to fix?

    http://outdoorsinteriors.com

    Thanks again

    OI

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

    Default Re: Add more info link to product listing description when description is truncated

    This must have been a problem that you had before because this mod doesn't affect your New Products page at all, unless your site is set up to use the same layout for New Products as the Product Listing page. If you'd like to do that, you should check out:

    http://www.zen-cart.com/forum/showth...emplate&page=8

    The instructions are for changing the All Products page, but it can be used for New Products as well, though a wee bit of understanding of the code (or help in doing it) would probably be needed. I applied it to my All Products page, and it works great.

    Anyhow, back to your problem. I don't use the New Products page, so I just turned it on to take a look at it on my site. The more info link under the image is the one you get in place of your Buy Now button when a product has attributes. That has nothing to do with the description being truncated. As for the category ID number showing up at the end of your description, I don't think it should be doing that. Mine doesn't. I took a quick look at the code for that part of the page, and I see nothing that would cause the ID number to display. Have you installed a contribution that made changes to /includes/templates/template_default/templates/tpl_modules_products_new_listing.php? That file should be in /includes/templates/your_template/templates/ if you did, unless you changed the default file itself.

    If no changes were made to that file, there should be the following code at or around line 107 (if you're using ZC version 1.3.8):

    Code:
          if (PRODUCT_NEW_LIST_DESCRIPTION > '0') {
            $disp_text = zen_get_products_description($products_new->fields['products_id']);
            $disp_text = zen_clean_html($disp_text);
    
            $display_products_description = stripslashes(zen_trunc_string($disp_text, PRODUCT_NEW_LIST_DESCRIPTION, '<a href="' . zen_href_link(zen_get_info_page($products_new->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($products_new->fields['master_categories_id']) . '&products_id=' . $products_new->fields['products_id']) . '"> ' . MORE_INFO_TEXT . '</a>'));
          } else {
            $display_products_description = '';
          }
    This is the code that displays the product description, truncates it if it's too long, and puts the More Info link at the end if the description is truncated. If it doesn't look like that in your tpl_modules_products_new_listing.php file, something has been changed and, apparently, caused a bug in the code.

    Could you give me a URL to the New Products page that's doing this so that I can see for myself what's happening? I went to your site, but it doesn't have the New Products page activated.

    Personal note about your site: You should consider having product images display on all your product listing pages. Shoppers want to be able to see at a glance what a product looks like rather than having to click through to the Product Info page.

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

    Default Re: Add more info link to product listing description when description is truncated

    Never mind. I guess I must be blind today. I didn't even see your New Products sidebox. I took a look at your new products page, and, yeah, that's weird. When I get some time, I'll look at the source code and see what's going on, though I'd actually need to see your tpl_modules_products_new_listing.php file to really see what's happening.

  5. #5
    Join Date
    Nov 2008
    Posts
    60
    Plugin Contributions
    0

    Default Re: Add more info link to product listing description when description is truncated

    It's me again. I couldn't tell a thing from your source code. The key to what's causing this should be in that file I mentioned. This is very definitely a bug in the code. As for that More Info link under the image, that is what shows instead of the quantity box if a product has an attribute/option. if you take a look at "Bear & Cub Rustic Fireplace Screen" on page 2, you'll see that it has the quantity box instead of the More Info link because there are no attributes.

  6. #6
    Join Date
    Jan 2007
    Posts
    105
    Plugin Contributions
    0

    Default Re: Add more info link to product listing description when description is truncated

    A BIG THANK YOU for the help and responsiveness. I almost have it all fixed. Only thing now I'm trying to do is get the description in "New Products" lined up the same way as when you click on a given product from "Catgories".........aligned center from the image with price on the right and name centered. Hopefully this makes sense. Just want the formatting to look the same on "New Products" as when you click on a given product category.

    Thanks so much...:)

    OI

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

    Default Re: Add more info link to product listing description when description is truncated

    You're very welcome.

    The problem is that All Products, New Products, Featured Products, Specials and Product Listing each have their own template layout, so they don't all look the same. I don't know why they were designed that way. It would make more sense for every page to have a consistent appearance.

    To do what you want, you'll probably have to use that mod that I gave you the link to. With it, you can make your New Products page look like the product listing pages, which are the pages you see when you click on a category. Unfortunately, the instructions there could be pretty confusing for anyone who has absolutely no coding skills at all. I'm just learning (thanks to the gazillion mods I've made to this store), and I was able to do it.

    Here is the link again. This one is corrected. The last one I gave you went to page 8, which isn't right.

    http://www.zen-cart.com/forum/showth...sting+template

    Be sure to read the messages on the first 5 pages. There are some corrections and further explanations and instructions, including some stuff about changing the New Products page. You should glance through the rest of the pages as well. I never went through them all since I didn't need to.

    I must stress that for major changes like this, test them out on a test site first. Don't experiment on your live site.

  8. #8
    Join Date
    Jan 2007
    Posts
    105
    Plugin Contributions
    0

    Default Re: Add more info link to product listing description when description is truncated

    Last post did not go through so trying again here...:). Thanks again and I'll try the mod.

    On a side note: My main page do you have any idea how I can position the DHL logo truck right at the end of "FREE SHIPPING All Products"? to fill up that white space?

    Thanks

    OI

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

    Default Re: Add more info link to product listing description when description is truncated

    The only way I can think of at the moment to do what you want would be to put that text and the graphic in nested containers you create in your stylesheet. You'd do something like this:

    Code:
    .container {
    	width: 500px;
    	position: relative;
    	height: 72px;
    }
    .leftBox {
    	width: 395px;
    	position: relative;
    	top: 16px;
    }
    .rightBox {
    	width: 105px;
    	left: 395px;
    	top: 0px;
    	position: absolute;
    }
    Then, you'd put your text and logo inside <div> tags like this:

    Code:
    <div class="container">
    <div class="leftBox"><p><strong>Free Shipping and No Sales Tax...</strong>
    <br>It's simple....we offer <strong><font color="#cc0000">FREE SHIPPING</font></strong> on ALL products.</div>
    <div class="rightBox"><img id="graphicFiller1" src="includes/templates/gloss_blue/images/dhllogo.bmp" width="105" height="72"></div>
    </div>
    You'll need to change the size of .container and .leftBox and the position of .rightBox so that the text fits properly, and you might have to increase or decrease 'top: 16px' in .leftBox to get the text perfectly centered, but that should work for you.

    Of course, placing the logo to the left with the "Free Shipping and No Sales Tax... It's simple....we offer FREE SHIPPING on ALL products." to the right of it would be much easier to accomplish.

  10. #10
    Join Date
    Jan 2007
    Posts
    105
    Plugin Contributions
    0

    Default Re: Add more info link to product listing description when description is truncated

    Thanks again for all the help....I'll give that a shot....:)

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v151 How-to add more info link in standard products listing
    By robyweb in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 15 Apr 2014, 11:21 AM
  2. product description truncated
    By thefuss in forum Setting Up Categories, Products, Attributes
    Replies: 8
    Last Post: 3 Mar 2011, 09:45 PM
  3. Add 'More Info' link to product description on Category page
    By gotlogos in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 11 Dec 2010, 03:33 AM
  4. add a more info or Link to the Products description Module
    By RobertG in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 12 Feb 2010, 04:41 PM
  5. Product description in product more info in html format but not in product listing?
    By this side up in forum Customization from the Admin
    Replies: 1
    Last Post: 18 Dec 2006, 06:25 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