Restraining characters in product description

  • Posts: 29
  • Thank you received: 0
11 years 6 months ago #143379

-- HikaShop version -- :2.2.3
-- Joomla version -- :3.2.1
-- PHP version -- : 5.4.6

Hello

Can you please help me how to restrain the number of characters in products/show_default

<div id="hikashop_product_description_main" class="hikashop_product_description_main">
		<?php
echo JHTML::_('content.prepare',preg_replace('#<hr *id="system-readmore" */>#i','',$this->element->product_description));
?>
  </div>
  <?php
	if(!empty($this->element->extraData->rightBegin))
		echo implode("\r\n",$this->element->extraData->rightBegin);
	?>

Thanks in advance for your help and a great support

/Henrik

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

  • Posts: 12953
  • Thank you received: 1778
11 years 6 months ago #143412

Hi,
The solution will be to change these lines :

<div id="hikashop_product_description_main" class="hikashop_product_description_main">
<?php
    //DISPLAY the product description
    echo JHTML::_('content.prepare',preg_replace('#<hr *id="system-readmore" */>#i','',$this->element->product_description));
?>
</div>
By :
<div id="hikashop_product_description_main" class="hikashop_product_description_main">
<?php
    //DISPLAY the product description
    echo substr(JHTML::_('content.prepare',preg_replace('#<hr *id="system-readmore" */>#i','',$this->element->product_description)),0,50);
?>
</div>

Note that you can replace the 50 by the number of character that you want for your product description.

The following user(s) said Thank You: Bankthaworn

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

  • Posts: 29
  • Thank you received: 0
11 years 6 months ago #143439

Hi Mohamed

Thanks for the quick reply ...

This does not really work as it should, it seems as if some important code also becomes limited.

If I choose a low number (between 50-200), the look of the page is changed dramatic.
But if I choose a very high number (such as 2000), then the page looks as it should but without a visable restriction of characters

/Henrik

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

  • Posts: 12953
  • Thank you received: 1778
11 years 6 months ago #143461

So you'll probably have to use some CSS code to adapt the display of your product page :).

The following user(s) said Thank You: Bankthaworn

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

  • Posts: 29
  • Thank you received: 0
11 years 6 months ago #143494

Oddly enough, it works well with certain numbers, so i'll just go with one that works :) .

(Some numbers did that the "form" went all the way down past related products, messing up my background and changed the css for related products.)

Thanks for your help, it is much appreciated

/Henrik

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

Time to create page: 0.051 seconds
Powered by Kunena Forum