Forums / Templates, Stylesheets, Page Layout / Product Title in One line. add (.....) From in line end..

Product Title in One line. add (.....) From in line end..

Started by jennydutch on 25 Sep 2014, 11:41 PM · Views: 1,166

Results 1 to 6 of 6
25 Sep 2014, 11:41 PM
#1
jennydutch avatar

jennydutch

New Zenner

Join Date:
Apr 2014
Location:
Bronx, New York, United States
Posts:
83
Plugin Contributions:
0

Product Title in One line. add (.....) From in line end..

i want to one line, title, to my every product in product listing page...

like tht..

Attachment 14552

To

Attachment 14551

Please help

27 Sep 2014, 5:43 AM
#2
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Product Title in One line. add (.....) From in line end..

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..

Attachment 14552

To

Attachment 14551

Please help

27 Sep 2014, 8:07 PM
#3
jennydutch avatar

jennydutch

New Zenner

Join Date:
Apr 2014
Location:
Bronx, New York, United States
Posts:
83
Plugin Contributions:
0

Re: Product Title in One line. add (.....) From in line end..

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!


28 Sep 2014, 4:43 PM
#4
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Product Title in One line. add (.....) From in line end..

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;
28 Sep 2014, 7:59 PM
#5
jennydutch avatar

jennydutch

New Zenner

Join Date:
Apr 2014
Location:
Bronx, New York, United States
Posts:
83
Plugin Contributions:
0

Re: Product Title in One line. add (.....) From in line end..

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 :) :-*

28 Sep 2014, 8:25 PM
#6
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Product Title in One line. add (.....) From in line end..

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 :) :-*