Short description in 50 characters

  • Posts: 85
  • Thank you received: 0
8 years 11 months ago #250217

-- HikaShop version -- : 2.6.4
-- Joomla version -- : 3.6.2

Hi,

I modified the Display-->Views --> product / listing_img_title and added a new raw with:
<?php echo preg_replace('#<hr *id="system-readmore" */>.*#is','',$this->row->product_description); ?>

But many product have a long description.

Is there any solution to display on the 50 char from the description?

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

  • Posts: 4820
  • Thank you received: 654
  • MODERATOR
8 years 11 months ago #250257

Hello,

Your needs is quite classical, so don't forget before create a new topic to search into our forum if what you needed wasn't already available.

Follow this link : here .

Have a look on Mohamed Thelji message (#143412).

Best regards.

Last edit: 8 years 11 months ago by Philip.

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

  • Posts: 85
  • Thank you received: 0
8 years 11 months ago #250463

Hi,

I modified and changed the products/show_default with the following, but without any affects:

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

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

  • Posts: 26275
  • Thank you received: 4045
  • MODERATOR
8 years 11 months ago #250465

Hi,

Please be sure that you're editing the right view for the right template.
The easy way is to add some text at the beginning of the view and check if you see that content in the front-end.

www.hikashop.com/support/documentation/1...ize-the-display.html

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: 85
  • Thank you received: 0
8 years 11 months ago #250829

I made wrong, but I'm confused with that link what you wrote.

This works but not the first 50 char

echo JHTML::_('content.prepare',preg_replace('#.*<hr *id="system-readmore" */>#is','',$this->row->product_description));

Or this works too
<?php echo preg_replace('#<hr *id="system-readmore" */>.*#is','',$this->row->product_description); ?>

But this not work
echo substr(JHTML::_('content.prepare',preg_replace('#<hr *id="system-readmore" */>#i','',$this->element->product_description)),0,50);

I need your help to modify the first two to display only the first 50 char.

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

  • Posts: 26275
  • Thank you received: 4045
  • MODERATOR
8 years 11 months ago #250835

Hi,

1/ row->product_description
2/ row->product_description
3/ element->product_description

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: 85
  • Thank you received: 0
8 years 11 months ago #250910

Because I don't know the exact operation of each HikaShop, and my PHP knowledge is basic, I can't modify alone the source code. I can cook with what I find in the forum...

Then there is no solution to display the fist 50 char of pruduct description from row without insert a readmore into the description?

Last edit: 8 years 11 months ago by palee3.

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

  • Posts: 26275
  • Thank you received: 4045
  • MODERATOR
8 years 11 months ago #250912

Hi,

The two first codes are using "row->product_description" and you are telling that these codes are working.
The last one using using "element->product_description" and you're telling that the code is not working.
Why not using "row->product_description" in the third code ?

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: 85
  • Thank you received: 0
8 years 11 months ago #250995

Hi,

Thank you, with the third one and with the row->product_description it works, thx.

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

Time to create page: 0.069 seconds
Powered by Kunena Forum