How to show short description on product layout?

  • Posts: 66
  • Thank you received: 0
10 years 7 months ago #172228

-- url of the page with the problem -- : www.pponlinestore.com/
-- HikaShop version -- : 2.3.2
-- Joomla version -- : 3.3.2
-- PHP version -- : 5.5.15
-- Browser(s) name and version -- : Google Chrome
-- Error-message(debug-mod must be tuned on) -- : NA

Hello,

How to show a short product description on product page? I am selling books on website. I want to show that short product information besides the product image. i.e. The left side should show product image and the right side should show the short description and below both of them the quantity field and characteristics selection etc. should appear.

How to do this?

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

  • Posts: 13201
  • Thank you received: 2322
10 years 7 months ago #172234

Hi,

You have to edit the view "product / show_default".
hikashop.com/support/support/documentati...ize-the-display.html

To display a short description you can use such code:

<?php echo substr(strip_tags(preg_replace('#<hr *id="system-readmore" */>.*#is','',$this->element->product_description)),0,300); ?>

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

  • Posts: 4
  • Thank you received: 0
10 years 7 months ago #172686

it's work, but...
For description of article I insert:
short description

short description
<hr id="system-readmore" />
Full description
Now short description is showing two times, once via your suggested code and once via full description of product.
How to avoid showing short description in full description?
Something like show and don't show intro text for Joomla article.

Thank you :)

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

  • Posts: 13201
  • Thank you received: 2322
10 years 7 months ago #172688

Hi,

So for the full description, you have to replace:

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

The following user(s) said Thank You: levelup

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

  • Posts: 66
  • Thank you received: 0
10 years 7 months ago #172780

Hi,

Thank you. But can I actually display the short description which is not included in the main part? I mean the short-description besides the product image should be totally different than the one in the main description section. I am little bit confused.

Gaurav

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

  • Posts: 13201
  • Thank you received: 2322
10 years 7 months ago #172797

Hi,

Using the code given previously allow that, in the description add a separation thanks to the "readmore" button.
Then the code will display the text before the separation in the short description and the other one in the description.

An easiest way will be to use a custom field via the menu Display > Custom field, set it in the table "product", with a WYSIWIG type. Then in the product edition page, you will be able to fill the content of this custom field.
Then edit the view "product / show_default" and just use the following code to display the short description:

<?php echo $this->element->YOUR_CUSTOM_FIELD_NAME; ?>

The following user(s) said Thank You: Strumjan, levelup

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

  • Posts: 4
  • Thank you received: 0
10 years 7 months ago #173106

"easiest way" work nice for me :)

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

  • Posts: 66
  • Thank you received: 0
10 years 7 months ago #175523

Xavier wrote: Hi,

Using the code given previously allow that, in the description add a separation thanks to the "readmore" button.
Then the code will display the text before the separation in the short description and the other one in the description.

An easiest way will be to use a custom field via the menu Display > Custom field, set it in the table "product", with a WYSIWIG type. Then in the product edition page, you will be able to fill the content of this custom field.
Then edit the view "product / show_default" and just use the following code to display the short description:

<?php echo $this->element->YOUR_CUSTOM_FIELD_NAME; ?>


After which line should I add this quote?

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

  • Posts: 4
  • Thank you received: 0
10 years 7 months ago #175525

... according to position where like to see that element, after, before or between other elements in code.
Also you can add style with

<span class="your-custom-style-name"><?php echo $this->element->YOUR_CUSTOM_FIELD_NAME; ?></span>
or div or what you like for styling.

Last edit: 10 years 7 months ago by Strumjan.

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

  • Posts: 66
  • Thank you received: 0
10 years 7 months ago #175527

I want the short description to be visible directly besides the product image.

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

  • Posts: 4
  • Thank you received: 0
10 years 7 months ago #175538

...try add line before or after this line

<div id="hikashop_product_top_part" class="hikashop_product_top_part">
in show_default.php file

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

  • Posts: 66
  • Thank you received: 0
10 years 7 months ago #175580

Sorry, but no success :(

Even after creating the custom field as instructed above and adding the code as suggested. I can't see the short description I added in new custom field.

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

  • Posts: 26232
  • Thank you received: 4035
  • MODERATOR
10 years 7 months ago #175609

Hi,

Did you check our documentation for the display customization ?
www.hikashop.com/support/support/documen...-display.html#layout

You have to be sure that your overriding the view for the right template.
You can try to just put some raw HTML in order to know if you're editing the right view for the right template.
HikaShop have several product page layout (default, tabular, inversed) so you first have to be sure that your targeting the right file.

The documentatino page above, would help you for the general explanation, the schema details how the view are composed for the sub elements in the product page.

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.
Last edit: 10 years 7 months ago by Jerome.

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

Time to create page: 0.086 seconds
Powered by Kunena Forum