Truncate Product Name length

  • Posts: 60
  • Thank you received: 1
11 years 10 months ago #84747

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.

  • Posts: 13201
  • Thank you received: 2322
11 years 10 months ago #84816

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.

  • Posts: 60
  • Thank you received: 1
11 years 10 months ago #84850

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: 11 years 10 months ago by in2computing.

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

  • Posts: 60
  • Thank you received: 1
11 years 10 months ago #84928

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.

  • Posts: 13201
  • Thank you received: 2322
11 years 10 months ago #84990

You have to edit the view "product / cart" for this content.

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

  • Posts: 60
  • Thank you received: 1
11 years 10 months ago #85179

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.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 10 months ago #85273

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.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: in2computing

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

  • Posts: 60
  • Thank you received: 1
11 years 10 months ago #86592

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.

  • Posts: 60
  • Thank you received: 1
8 years 6 months ago #239192

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.

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
8 years 6 months ago #239256

Hi,

Instead of :

<a href="<?php echo $link;?>" title="<?php echo $this->escape($this->row->product_name); ?>">
you can do:
<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.063 seconds
Powered by Kunena Forum