Originally Posted by
gabriel2506
I want to set a character limit when my product titles are showing in product listing pages.
I do want to keep the long titles when you are looking a product page, I just want to set a limit of character showing when customer browse for products as the title goes down on 2-3 lines and it doesn't look nice.
Is there any presets to do that? Or do you have to change code to do it? If so, what do I have to change and can you give me a detail instruction on how to do it.
Thanks you
Like kobra indicated, you can set the limits for the product description in your admin but not the product title. To limit the number of characters in a product's name on your product listing pages, you'll need to:
1. Copy /includes/modules/product_listing.php to /includes/modules/YOUR_TEMPLATE/product_listing.php.
2. Edit that file; for the v1.5.1 version, the code to change is on line 97. Change
Code:
$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']) . '">' . $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>';
to
Code:
$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']) . '">' . zen_trunc_string($listing->fields['products_name'], 50) . '</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>';
If 50 is not the right number of characters, just change the 50 to whatever works for you!
Bookmarks