Skip to main content

Truncate Product Name length

More
13 years 9 months ago #84747 by in2computing
Hi

I was wondering how to truncate the length of the Product Name on front end display.

My eshop is in2computing.com/eShop/product/listing.html

Any help would be much appreciated.

Thanks and regards
Yogi

Please Log in or Create an account to join the conversation.

More
13 years 9 months ago #84816 by Xavier
Replied by Xavier on topic Truncate Product Name length
Hi,

To truncate it in the product listing, you have to edit the view "product / listing_img_title" and replace the line "echo $this->row->product_name;" by "echo substr($this->row->product_name, 0, 50);"
Where "50" is the number of char to display.
The following user(s) said Thank You: in2computing

Please Log in or Create an account to join the conversation.

More
13 years 9 months ago - 13 years 9 months ago #84850 by in2computing

Xavier wrote: replace the line "echo $this->row->product_name;" by "echo substr($this->row->product_name, 0, 50);"
Where "50" is the number of char to display.


Hello Xavier

Thanks for your quick response... That sorted out the problem... I have added "..." at the end of the product name as it truncates in the middle of the word...

echo substr($this->row->product_name, 0, 50)."...";
:)

Thanks again
Last edit: 13 years 9 months ago by in2computing.

Please Log in or Create an account to join the conversation.

More
13 years 9 months ago #84928 by in2computing
Where do I make the changes for the shopping cart module for the same reason?

Please Log in or Create an account to join the conversation.

More
13 years 9 months ago #84990 by Xavier
Replied by Xavier on topic Truncate Product Name length
You have to edit the view "product / cart" for this content.

Please Log in or Create an account to join the conversation.

More
13 years 9 months ago #85179 by in2computing
Sorry Xavier! Can you please be a bit more specific? I am not able to figure out which file to modify...

Please Log in or Create an account to join the conversation.

More
13 years 9 months ago #85273 by Jerome
Replied by Jerome on topic Truncate Product Name length
Hi,

It would be difficult to be more specific.
Last time you have edit the view "product | listing_img_title" and this time you should edit the view "product | cart".

Regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
The following user(s) said Thank You: in2computing

Please Log in or Create an account to join the conversation.

More
13 years 9 months ago #86592 by in2computing
Thanks Jerome

I got it sorted now. Sorry for being a bit thick earlier.

Please Log in or Create an account to join the conversation.

More
10 years 5 months ago #239192 by in2computing

Xavier wrote: Hi,

To truncate it in the product listing, you have to edit the view "product / listing_img_title" and replace the line "echo $this->row->product_name;" by "echo substr($this->row->product_name, 0, 50);"
Where "50" is the number of char to display.


This line is different in the latest version. <a href="<?php echo $link;?>" title="<?php echo $this->escape($this->row->product_name); ?>">

What do I do now please?

Please Log in or Create an account to join the conversation.

More
10 years 5 months ago #239256 by nicolas
Hi,

Instead of :
Code:
<a href="<?php echo $link;?>" title="<?php echo $this->escape($this->row->product_name); ?>">
you can do:
Code:
<a href="<?php echo $link;?>" title="<?php echo $this->escape(substr($this->row->product_name, 0, 50)); ?>">

Please Log in or Create an account to join the conversation.

Time to create page: 0.406 seconds
Powered by Kunena Forum