Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Display Product Description - truncate issue

Display Product Description - truncate issue

Locked

Views: 3,893

Results 1 to 8 of 8
This thread is locked. New replies are disabled.
31 Mar 2007, 11:44 PM
#1
got2know avatar

got2know

New Zenner

Join Date:
Jan 2007
Posts:
6
Plugin Contributions:
0

Display Product Description - truncate issue

Hi - new to Zen Cart and having some challenges.

I want to display more than 80 characters in the various Listings (Products Listing, Featured Listing, etc.).

It seems this is controlled here:

Admin>Configuration>Product Listing>Display Product Description

If I edit this field, it works, but only up to 80 characters. So if I set it at 40 characters, 40 will show in the Product Listings, Featured Listings, etc. If I set it at 60 or 80, all works like it should. However, anything over 80 doesn't work - it will stop at 80 characters.

Any thoughts.

Thanks.

1 Apr 2007, 12:14 AM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Display Product Description - truncate issue

Have you an URL where this is happening?

I can go to 150, 500, 20, etc. just changing the setting in:
Configuration ... Product Listing ...

Display Product Description
Do you want to display the Product Description?

0= OFF
150= Suggested Length, or enter the maximum number of characters to display

1 Apr 2007, 12:26 AM
#3
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Display Product Description - truncate issue

Note: on New, Featured and All Listing there is not a switch for this ... how did I miss that?! :eek:

This is hard coded at the moment, for example the Featured Listing:
tpl_modules_products_featured_listing.php

Has the code at approximately line 113:

        $display_products_description = stripslashes(zen_trunc_string($disp_text, 150, '<a href="' . zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($featured_products->fields['master_categories_id']) . '&products_id=' . $featured_products->fields['products_id']) . '"> ' . MORE_INFO_TEXT . '</a>'));

The 150 sets the length ...

This should be fixed in one of the upcoming releases to allow you to set the length yourself ...

If one were to assume that the code would change so that the setting in Featured Listing where it reads:

Display Product Description
Do you want to display the Product Description - First 150 characters?

Would change from 0 or 1 to mean on or off and get 150 characters to be how many where 0 is OFF and any value is the number of characters ... this would be the change made ...

Cannot believe I goobered up a setting like that ... :lamo:

1 Apr 2007, 5:43 AM
#4
got2know avatar

got2know

New Zenner

Join Date:
Jan 2007
Posts:
6
Plugin Contributions:
0

Re: Display Product Description - truncate issue

Ajeh,

Thanks for the advice. Something is still amiss, though.

I went to "tpl_modules_products_all_listing.php" in my template directory. I found the line you refered to and changed the number from 150 to 50. That effectively reduced the number of characters displaying on the listing for each product to 50. However, when I set it to anything over 80 (e.g. 90), it still truncates at 80.

I purchased this template and am modifying it. Perhaps whomever originally built it changed something somewhere. I just don't know where to look.

Here's the URL of the All Products listing:

http://www.orthopedicapothecary.com/index.php?main_page=products_all

Let me know if you have any further ideas.

Thanks.

**** EDITED *** Never ever post in a forum, email, newsletter etc. the zenid or zenAdminID or you will be doomed!!** :eek:

1 Apr 2007, 2:13 PM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Display Product Description - truncate issue

This is really kind of weird ...

You may need to search further to see if something is further truncating the description beyond the setting ...

The function zen_get_products_description gets the description ... might look for that and see if it is doing something else with it ...

The function zen_trunc_string is what is using the paramater of the size to shrink it ...

2 Apr 2007, 3:35 AM
#6
got2know avatar

got2know

New Zenner

Join Date:
Jan 2007
Posts:
6
Plugin Contributions:
0

Re: Display Product Description - truncate issue

First - thanks for the EDIT above on the hyperlink.

Next - I figured it out - at least for the most part.

Here's the breakdown of the issue and how I found my way to it in case others have similar problems. I'm by no means a programmer, so forgive me if I mis-use any terms.

  • First, I changed the template from the one I purchased (e.g My-Template) to the Classic one. All then worked the way it was supposed to under Classic. Thus, I concluded it was something specific to how my template had been built.

  • I then started comparing files between the Classic and My-Template. I found that My-Template included a bunch of $tm_ references including "$tm_desc = $display_products_description;"

  • I somehow found my way to a file in "My-Template/common/" called "tpl_tmfuncs.php". Upon examining it, I found 3 references to "80" which was my truncation limit. I changed them all to 500 and discovered that this was indeed the issue.

Now I just need to figure out if I really needed to change all 3 instances of "80" and if that will mess anything else up.

Finally, in doing some further forum searches, it seems that purchasing templates (namely one from Template Monster), can get you more than you bargained for. I guess at times the template designers take liberties with the code just to get it to look suitable for sale. I'm not sure if this is one of those or not, but this sure took some time out of my life to figure out.

Thanks again for steering me in the right direction.

2 Apr 2007, 3:56 AM
#7
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Display Product Description - truncate issue

For the next release I replaced all the original 150 settings with constants that are now in the database table:
PRODUCT_NEW_LIST_DESCRIPTION
PRODUCT_FEATURED_LIST_DESCRIPTION
PRODUCT_ALL_LIST_DESCRIPTION

Change the configuration_value to the size you want in your database, for now, and use those constants in place of the 150 in their appropriate files ...

On the next upgrade, they should have the text and the size will be a fill-in ...

20 Apr 2007, 7:14 PM
#8
bsandland avatar

bsandland

New Zenner

Join Date:
Apr 2007
Posts:
13
Plugin Contributions:
0

Re: Display Product Description - truncate issue

I'm having the same problem as the OP, and I've tried both of the suggestions given here and it's still not working. Is there any new information on how to fix this problem? You can see my site at https://www.minglewoodsolutions.com , and you'll see on the main page under "featured products" we only get three words for the description. VERY frustrating!! ANY help would be wonderful and greatly appreciated.