Results 1 to 8 of 8
  1. #1
    Join Date
    Feb 2013
    Posts
    2
    Plugin Contributions
    0

    Default How to set a character limit for product title when in product listing mode?

    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

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: How to set a character limit for product title when in product listing mode?

    admin > config > product listing > Display Product Description > set length
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,401
    Plugin Contributions
    87

    Default Re: How to set a character limit for product title when in product listing mode?

    Quote Originally Posted by gabriel2506 View Post
    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!

  4. #4
    Join Date
    Feb 2013
    Posts
    2
    Plugin Contributions
    0

    Default Re: How to set a character limit for product title when in product listing mode?

    Thank you so much! You are amazing!

  5. #5
    Join Date
    Oct 2007
    Posts
    103
    Plugin Contributions
    0

    Default Re: How to set a character limit for product title when in product listing mode?

    this does not help me. my title is still cut off? i changed '50' to '150' but my title length is still cut off at 64.
    i change table orders_products field products_name to varchar(128) (from varchar64) restart mysqld and still no good? i do not see produt_name in the table products?

  6. #6
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,846
    Plugin Contributions
    25

    Default Re: How to set a character limit for product title when in product listing mode?

    Quote Originally Posted by w2e View Post
    this does not help me. my title is still cut off? i changed '50' to '150' but my title length is still cut off at 64.
    i change table orders_products field products_name to varchar(128) (from varchar64) restart mysqld and still no good? i do not see produt_name in the table products?
    You can find products_name in the products_description table

  7. #7
    Join Date
    Oct 2007
    Posts
    103
    Plugin Contributions
    0

    Default Re: How to set a character limit for product title when in product listing mode?

    changed products_name in the products_description table to varchar 128.
    restart mysql.
    re-upload, and import. it finally works.

    apparently, with varchar 64, imported title was saved as 64 characters. so i have to import again.

    also when the title is cut off, import results in warning/error too.

    thanks
    Last edited by w2e; 6 Jan 2015 at 10:37 AM.

  8. #8
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: How to set a character limit for product title when in product listing mode?

    Be aware that if you changed the length of the products_name in the table products, you also have to do the same in the table orders_products or the name will be cut off on orders ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

 

 

Similar Threads

  1. How to set time limit for new product listing?
    By andrewcklau in forum Setting Up Categories, Products, Attributes
    Replies: 4
    Last Post: 25 Apr 2018, 05:21 PM
  2. v139f Product Description Character Limit
    By snowbird32 in forum Basic Configuration
    Replies: 7
    Last Post: 11 Jun 2013, 06:45 PM
  3. set a character limit for product title to show a certain number of characters
    By annav in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 10 Jun 2013, 02:38 PM
  4. v150 Prevent alignment issues in product listing pages when product title lengths differ
    By OLCS in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 7 Nov 2012, 11:48 PM
  5. Increase Products Model character limit when adding a new product.
    By gloerick in forum Customization from the Admin
    Replies: 3
    Last Post: 27 Feb 2012, 06:54 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR