Skip to main content

Restraining characters in product description

More
12 years 7 months ago #143379 by Stroppen
-- 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
Code:
<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.

More
12 years 7 months ago #143412 by Mohamed Thelji
Hi,
The solution will be to change these lines :
Code:
<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 :
Code:
<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.

More
12 years 7 months ago #143439 by Stroppen
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.

More
12 years 7 months ago #143461 by Mohamed Thelji
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.

More
12 years 7 months ago #143494 by Stroppen
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.202 seconds
Powered by Kunena Forum