Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Number of characters in description displayed

Number of characters in description displayed

Locked

Views: 1,681

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
1 Feb 2007, 9:42 PM
#1
dwessell avatar

dwessell

Zen Follower

Join Date:
Mar 2005
Posts:
143
Plugin Contributions:
0

Number of characters in description displayed

Hi,

In the featured product boxes, where are the maximum # of characters displayed (From the product description) controlled from? Or is this template specific?

Thanks
David

1 Feb 2007, 9:50 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Number of characters in description displayed

If I understand the screen that you are referencing

admin > config > product listing > Display Product Description > set the length

1 Feb 2007, 10:00 PM
#3
dwessell avatar

dwessell

Zen Follower

Join Date:
Mar 2005
Posts:
143
Plugin Contributions:
0

Re: Number of characters in description displayed

Almost...

At http://www.showball.com/index.php?main_page=index

See how the Featured Product Description is cut off, that's what I"m looking for.

Thanks
David

1 Feb 2007, 10:12 PM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Number of characters in description displayed

Opps!!! Need to read slower>>> this is what is in the featured setting screen

Display Product Description
Do you want to display the Product Description - First 150 characters?
This would then be buried in the files and probably a param description

2 Feb 2007, 1:31 AM
#5
ajeh avatar

ajeh

Oba-san

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

Re: Number of characters in description displayed

One of these days I need to make those user definable lengths ... but not today ... :cool:

2 Feb 2007, 9:04 PM
#6
dwessell avatar

dwessell

Zen Follower

Join Date:
Mar 2005
Posts:
143
Plugin Contributions:
0

Re: Number of characters in description displayed

Ajeh:

One of these days I need to make those user definable lengths ... but not today ... :cool:

Can you point me towards the file with the restrictions? I'd like to take a run at it and see if I can increase it...

Thanks
David

3 Feb 2007, 2:41 AM
#7
bunyip avatar

bunyip

Totally Zenned

Join Date:
Sep 2004
Location:
Western Massachusetts
Posts:
2,361
Plugin Contributions:
1

Re: Number of characters in description displayed

includes/templates/template_default/templates/tpl_modules_products_featured_listing.php
at 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']), 'products_id=' . $featured_products->fields['products_id']) . '"> ' . MORE_INFO_TEXT . '</a>'));

see the 150 in red there?
When you edit the file, save it as an override copy - includes/templates/your_template/templates/tpl...

3 Feb 2007, 2:56 AM
#8
bunyip avatar

bunyip

Totally Zenned

Join Date:
Sep 2004
Location:
Western Massachusetts
Posts:
2,361
Plugin Contributions:
1

Re: Number of characters in description displayed

Ajeh:

One of these days I need to make those user definable lengths ... but not today ... :cool:

Here's a quick way to make it configurable...
Edit this line of code (113) in tpl_modules_products_featured_listing.php

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

change that 150 to PRODUCT_FEATURED_LIST_DESCRIPTION so you have

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

and run an sql patch to modify the configuration key:

UPDATE configuration SET `configuration_value` = '150',
`configuration_description` = 'Do you want to display the Product Description? <br /><br />Enter how many characters of the description you wish to display (0= off, default=150) ',
`use_function` = NULL ,
`set_function` = '' WHERE `configuration_key` ='PRODUCT_FEATURED_LIST_DESCRIPTION';

Now you can set the character length from Admin :yes:

Similar process can be followed for New Products listing

7 Feb 2007, 7:21 PM
#9
dwessell avatar

dwessell

Zen Follower

Join Date:
Mar 2005
Posts:
143
Plugin Contributions:
0

Re: Number of characters in description displayed

Hey Bunyip..

Thanks for that, I don't think it's it though. What I'm looking for, is what comes up on the main index page, when it displays your featured products (http://showball.com).

From what I can tell (I'm still getting used to your codebase).. What first loads is the tpl_index_default.php file, that then does a require on tpl_modules_featured_products.php..

I did find this code:

'.substr(zen_trunc_string($featured_products->fields['products_description'], PRODUCT_LIST_DESCRIPTION),0,500).'<br>

The 500 number is mine. However, while that did increase the number of chars displayed, it didn't increase it to 500.. So there must be another hardcoded number somewhere else? I'm sure it's something you'll be able to pick out in moments.. Thanks for the help..

Thanks
David

7 Feb 2007, 8:13 PM
#10
bunyip avatar

bunyip

Totally Zenned

Join Date:
Sep 2004
Location:
Western Massachusetts
Posts:
2,361
Plugin Contributions:
1

Re: Number of characters in description displayed

Your product description is still being truncated to the number of characters set by the configuration key PRODUCT_LIST_DESCRIPTION

You don't need to use the substr function, but can achieve what you want simply by changing the value of the constant PRODUCT_LIST_DESCRIPTION from Admin -> Configuration > Product Listing > Display Product Description
and leaving the code as ```
'.zen_trunc_string($featured_products->fields['products_description'], PRODUCT_LIST_DESCRIPTION).'<br>

(This approach will also give you the same length of product description in your normal product listings)

Alternatively, if you want to hard-code the string length for your featured products module, use

'.zen_trunc_string($featured_products->fields['products_description'], 500).'<br>