Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / html links in product description (on listing page)

html links in product description (on listing page)

Locked

Views: 2,103

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
15 Jun 2006, 3:46 AM
#1
lovere avatar

lovere

Zen Follower

Join Date:
Jul 2004
Location:
Nevada City, CA
Posts:
95
Plugin Contributions:
0

html links in product description (on listing page)

Hello,

I'd like to be able to have a link in the product description for some of my products, that appears on the product listing page.

The display of the description occurs on line 122 of modules/product_listing.php:

$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']) . '">' . $listing->fields['products_name'] . '</a></h3><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>';

I've tried removing the zen_clean_html function so that it looked like so,```php
$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']) . '">' . $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' . zen_trunc_string(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id'])), PRODUCT_LIST_DESCRIPTION) . '</div>';

but it broke the display, cutting off output right after <div class="listingDescription">.

I'm probably going about this the hard way (as usual!), so if anyone knows a way to keep links in the truncated description, please respond :thumbsup: 

David
15 Jun 2006, 8:10 AM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: html links in product description (on listing page)

Huh - looks like it ought to work. You seem to have removed the correct extra close parenthesis....

What I did to edit this was just comment it out ...zen_trunc_string(/zen_clean_html/(stripslashes... and not touch any parentheses. Maybe that will work for you too?

15 Jun 2006, 4:32 PM
#3
lovere avatar

lovere

Zen Follower

Join Date:
Jul 2004
Location:
Nevada City, CA
Posts:
95
Plugin Contributions:
0

Re: html links in product description (on listing page)

gjh42:

Huh - looks like it ought to work. You seem to have removed the correct extra close parenthesis....

What I did to edit this was just comment it out ...zen_trunc_string(/zen_clean_html/(stripslashes... and not touch any parentheses. Maybe that will work for you too?

It turns out that either removing the zen_clean_html and associated parends or doing it your way will work.

What was happening with me was that the previous product had a table in the first part of the description, which was being truncated after 150 characters, and voila, messed up layout.

So, no more tables in the first 150 characters of description!

Thanks for the response :thumbsup: