Jump to content

How can I edit the length of product name?


Genet

Recommended Posts

  • 1 month later...

Is there anyone who can help with this very important issue. I think I've browsed through entire forum looking for solution. So far nada.

 

Editing product-list.tpl from themes/prestashop doesn't change a thing. I'm on prestashop 1.4.4.1

 

I find this unbelievable that there is no one who can provide a solution for this.

Link to comment
Share on other sites

Home page of prestashop says: "Best Open-Source E-commerce Application".

 

My question: IS IT REALLY ???

 

Since apparently it can't even properly display product titles and there is no way to change it. I've tried editing many lines with 'truncate' and it doesn't help. Apparently many other people on this forum face the same issue.

 

Maybe one of the developers can answer this one???

Link to comment
Share on other sites

Thank you for your answer.

 

But there's one thing I can't understand. The original value of 'truncate' in product-list.tpl is '35'. And whether I change it to 60, 80 or 100, it's like prestashop doesn't see this and titles' length doesn't change at all. The weird part is that titles are sometimes cut at 29 characters, other time it's 24 or 33 characters.

 

I honestly give up. I really wished the product names were limited to 128 characters. That would be all I need. But I can't come anywhere near that value.

 

Any help would be greatly appreciated.

Link to comment
Share on other sites

That value is set to "varchar(128)" in my database as well as in classes/Product.php. I set "truncate" to 128 in product-list.tpl

 

So it is my understanding that product names should be 128 characters long. However, they are shortened at around 30 characters.

 

Does language version of prestashop have anything to do with it? Mine is polish.

 

Thx.

Link to comment
Share on other sites

Hi danny,

 

In your theme's product-list.tpl file, locate the following line (should be around line 42 in v1.4.6.2)

{$product.name|truncate:35:'...'|escape:'htmlall':'UTF-8'}

 

and increase the truncate value from 35 to whatever you would like it to be.

 

Please let me know if this works for you.

 

-Mike

Link to comment
Share on other sites

I am a novice in Prestashop but this worked for me:

You have to force Smarty to recompile the new changed values.

Go to Back Office > Preferences > Performance. In Smarty force compile. Check if is OK now, and them disable force compile for speed.

 

I hope I was helpful.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

I am a novice in Prestashop but this worked for me:

You have to force Smarty to recompile the new changed values.

Go to Back Office > Preferences > Performance. In Smarty force compile. Check if is OK now, and them disable force compile for speed.

 

I hope I was helpful.

 

It seems like that was it !!! :)

Thank you big time.

 

I would put 'SOLVED' in the topic's title but I'm not the author.

Link to comment
Share on other sites

  • 7 months later...
  • 1 year later...

I had to change the global.css:

 

From

 

ul.product_list h5{
    overflow: hidden;
    white-space: nowrap;
    font-size: 1.2em;
 
To 
 
ul.product_list h5{
    overflow: hidden;
    white-space: wrap;
    font-size: 1.2em;
min-height : 44px;
    max-height: 44px;
 

 

This way it didnt wrap the text. The Height has to be set like this for all products to be align.

  • Like 1
Link to comment
Share on other sites

  • 10 months later...

The product names are limited to 128 characters. You can always remove that limitation, but you'll need some knowledge of SQL & PHP - it can't be changed just my removing thte "truncate" modifier from the template.

 

I have removed (just increasing the numbers did seemingly no effect) all and every truncate thing I could find and changed `ps_product_lang`.`name` (as well as `ps_product_lang`.`meta_title`) type from VARCHAR(128) to VARCHAR(255). Although removing the truncates has improved the things greatly,the 128-character product title limitation is still there (I have got a couple of goods that don't fit: one with 133-symbol-long name and another with 152-symbol-long). PrestaShop still refuses longer titles (via CSV import as well as via the products catalog interface). There seem to be some validation stuff with this limit hard-coded somewhere, I am going to try to find it...

Link to comment
Share on other sites

There seem to be some validation stuff with this limit hard-coded somewhere, I am going to try to find it...

 

Looks like it's in the \classes\Product.php file...

'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCatalogName', 'required' => true, 'size' => 128),
PS: Thanks G-d (and the authors) PrestaShop has source code and database structure this sane, it really is the best thing I like about PrestaShop (although there still are things that seem mysterious to me like some parameters (like ggoods additional shipping costs) keeping their old values (where the heck is this data remembered? I have turned all the caches I could find off!) after I change them in the database using SQL). Edited by StrangeAttractor (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...