How to limit the text length in the product name

  • Posts: 18
  • Thank you received: 0
11 years 7 months ago #99919

i need to limit the text length that appears under the product
i have variant names so each of them has different characters length ,
so i want to make all of them to be with the same number of characters >>>> how to do that ? :blink:

Attachments:

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

  • Posts: 13201
  • Thank you received: 2322
11 years 7 months ago #99955

Hi,

You can edit the view "product / listing_img_title", and in the product_name part replace:

echo $this->row->product_name;
By:
echo substr($this->row->product_name,0,xxx);
where xxx is the number of character

The following user(s) said Thank You: Ahmed nasser

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

  • Posts: 18
  • Thank you received: 0
11 years 7 months ago #100380

i did that but
it does not work well , no changes

Attachments:

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

  • Posts: 82906
  • Thank you received: 13378
  • MODERATOR
11 years 7 months ago #100617

Hi,

Well, that's the correct solution, unless you're not using the item box layout "image and title" and in that case you would have to edit the view file corresponding to the item box layout you're using in your module.
Also, please make sure that you edit the view file for the template that you're using on the frontend and not for another one or you won't see any change.

The following user(s) said Thank You: Ahmed nasser

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

  • Posts: 18
  • Thank you received: 0
11 years 7 months ago #100875

Thanks Very much , Nicolas, Xavier :)

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

  • Posts: 108
  • Thank you received: 1
9 years 8 months ago #193272

Hi,

I have tried it for my standard edition and it worked, but now I have upgraded to business and this string is not there anymore, any ideas of how to do the same for the business edition ?

Thanks.

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

  • Posts: 12953
  • Thank you received: 1778
9 years 8 months ago #193274

Hello,
Can you check that you still have your view's file customization through "Hikashop->Display->Views" ?

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

  • Posts: 108
  • Thank you received: 1
9 years 8 months ago #193429

here is the content of the file:

<!-- PRODUCT NAME -->
<span class="hikashop_product_name">
	<?php if($this->params->get('link_to_product_page',1)){ ?>
		<a href="<?php echo $link;?>">
	<?php }
		echo $this->row->product_name;
	if($this->params->get('link_to_product_page',1)){ ?>
		</a>
	<?php } ?>
</span>
<!-- EO PRODUCT NAME -->

Last edit: 9 years 8 months ago by Jerome. Reason: [code] is nice !

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

  • Posts: 26159
  • Thank you received: 4028
  • MODERATOR
9 years 8 months ago #193432

Hi,

If you check the previous message, you will see that you have to override the view in order to modify how the product name is displayed.
You are using the default 2.3.5 content of HikaShop ; where there is no limitation in the product name.

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.

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

  • Posts: 108
  • Thank you received: 1
9 years 8 months ago #193519

yes, I know. but if you go through my previous post you'll find out that the string: echo $this->row->product_name; in which you suggest to override does not exist... :(

and I want to limit the characters of the product name only in the products list view (not in product page)

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

  • Posts: 26159
  • Thank you received: 4028
  • MODERATOR
9 years 8 months ago #193528

Hi,

In the previous post you made, I edited the content to just focus on the display of the product name.
As you can see, the content that we suggest to replace is right there (in the middle).

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: shoppist

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

  • Posts: 108
  • Thank you received: 1
9 years 7 months ago #199689

Thank you, it worked before I have upgraded to business and now, not anymore:

www.legohits.com/%D7%9C%D7%92%D7%95/%D7%...9E%D7%A9%D7%A8%D7%93

any ideas?

thank you

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

  • Posts: 108
  • Thank you received: 1
9 years 7 months ago #199766

This is what I have:

<!-- PRODUCT NAME -->
<span class="hikashop_product_name">
<?php if($this->params->get('link_to_product_page',1)){ ?>
<a href="<?php echo $link;?>">
<?php }
echo substr($this->row->product_name,0,20);
if($this->params->get('link_to_product_page',1)){ ?>
</a>
<?php } ?>
</span>
<!-- EO PRODUCT NAME -->

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

  • Posts: 82906
  • Thank you received: 13378
  • MODERATOR
9 years 7 months ago #199775

Hi,

This means that either you're not editing the correct view file, or you're editing it for another template than the template you're using on your frontend.

The following user(s) said Thank You: shoppist

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

Time to create page: 0.112 seconds
Powered by Kunena Forum