New Zenner
- Join Date:
- Apr 2014
- Location:
- Bronx, New York, United States
- Posts:
- 83
- Plugin Contributions:
- 0
Started by jennydutch on 25 Sep 2014, 11:41 PM · Views: 1,166
New Zenner
Totally Zenned
The option to truncate or "limit characters" on the products name is not an option in Zen Cart (I don't think).
You can open /includes/modules/product_listing.php
find:
$listing->fields['products_name']
under case 'PRODUCT_LIST_NAME':
and change to:
zen_trunc_string($listing->fields['products_name'], 5)
change 5 to the amount a characters you want to display.
hope this helps!
jennydutch:
i want to one line, title, to my every product in product listing page...
like tht..
To
Please help
New Zenner
Thanks for your reply . i just change this code but i got no result....
is my change is correct?
/includes/modules/product_listing.php
case 'PRODUCT_LIST_NAME':
$lc_align = '';
$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>';
break;
To
case 'PRODUCT_LIST_NAME':
$lc_align = '';
$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'], 5) . '</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>';
break;
rbarbour:
The option to truncate or "limit characters" on the products name is not an option in Zen Cart (I don't think).
You can open /includes/modules/product_listing.php
find:
$listing->fields['products_name']
under case 'PRODUCT_LIST_NAME':
and change to:
zen_trunc_string($listing->fields['products_name'], 5)change 5 to the amount a characters you want to display.
hope this helps!
Totally Zenned
The code is correct but the changes should be made in the template override directory.
instead of /includes/modules/product_listing.php
copy to: /includes/modules/YOUR_TEMPLATE_FOLDER/product_listing.php
jennydutch:
Thanks for your reply . i just change this code but i got no result....
is my change is correct?
/includes/modules/product_listing.php
case 'PRODUCT_LIST_NAME':
$lc_align = '';
$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>';
break;
>
> To
>
>
> ```
case 'PRODUCT_LIST_NAME':
$lc_align = '';
$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'], 5) . '</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>';
break;
New Zenner
rbarbour:
The code is correct but the changes should be made in the template override directory.
instead of /includes/modules/product_listing.php
copy to: /includes/modules/YOUR_TEMPLATE_FOLDER/product_listing.php
Wow........ iTs working Thanks hero :) :-*
Totally Zenned
Glad you got it to work!
I'm not sure what version Zen Cart your using but I know versions 1.5.2 and 1.5.3 also allow you to append the truncated text like so:
zen_trunc_string($listing->fields['products_name'], 25, '...more')
It will appear like this:
Lorem ipsum dolor sit ame...more
jennydutch:
Wow........ iTs working Thanks hero :) :-*
Tell staff why this post should be reviewed.