Product intro information

  • Posts: 37
  • Thank you received: 0
  • Hikashop Business
2 weeks 1 day ago #306317

-- url of the page with the problem -- : banobathrooms-co-uk.stackstaging.com/sui...duct/16-black-cotton
-- HikaShop version -- : 4.0.2
-- Joomla version -- : 3.9.5.
-- PHP version -- : 7.1.28

Hi,

The intro information stops midway through the words (please see attached). Is there a way to have separate entries for the intro text and the full description?

Attachments:

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

  • Posts: 65661
  • Thank you received: 9585
  • MODERATOR
2 weeks 21 hours ago #306321

Hi,

If you want it to cut at a certain place, you can add a read more tag to your product description.
Your product page layout is already heavily customized so I'm not sure what code you have to display the intro information.
By default, it's this code:

if(!empty($this->element->product_description)) {
			$resume = substr(strip_tags(preg_replace('#<hr *id="system-readmore" */>.*#is','',$this->element->product_description)),0,300);
			if (!empty($this->element->product_description) && strlen($this->element->product_description)>300)
				$resume .= " ...<a href='#hikashop_show_tabular_description'>".JText::_('READ_MORE')."</a>";
			echo JHTML::_('content.prepare',$resume);
		}
and if you want to use another text than the description for that intro text, then you can create a custom product field via the menu Display>Custom fields and change the product_description text to the column name of your custom product field in the code above.
That code is normally in the product/show_tabular.php view file that you can edit via the menu Display>Views.
You can use the "Display view files" setting of the HikaShop configuration to know which view file is used where in HikaShop

The following user(s) said Thank You: Crashbandi

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

  • Posts: 37
  • Thank you received: 0
  • Hikashop Business
2 weeks 16 hours ago #306338

Thanks Nicolas.

This is a bit complex for me, but I'm going to give it a go.
Can I ask, would it be possible to point the intro information to the new custom field via css? The reason I ask is because I don't want any future Hikashop updates overwriting any changes.

Regards,
Colin.

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

  • Posts: 65661
  • Thank you received: 9585
  • MODERATOR
2 weeks 5 hours ago #306339

Hi,

It's not possible to do that via CSS. Note however that if you do view files modifications via the menu Display>Views, these modifications will be saved as view overrides and you won't loose them when you update HikaShop in the future.

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

  • Posts: 37
  • Thank you received: 0
  • Hikashop Business
1 day 15 hours ago #306771

Hi,
I have added the custom field and edited the file product/show_tabular.php. Everything seems ok in the back end, but the input does not show in the front end. The custom field is in the products table and is set to show in the front-end, back-end form and back-end-listing.
Any ideas why it is not showing? Here is my code change:

		if(!empty($this->element->product_intro)) {
			$resume = substr(strip_tags(preg_replace('#<hr *id="system-readmore" */>.*#is','',$this->element->product_intro)),0,300);
			if (!empty($this->element->product_intro) && strlen($this->element->product_intro)>300)
				//$resume .= " ...<a href='#hikashop_show_tabular_description'>".JText::_('READ_MORE')."</a>";
			echo JHTML::_('content.prepare',$resume);
Thanks.

Last edit: 1 day 14 hours ago by nicolas.

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

  • Posts: 65661
  • Thank you received: 9585
  • MODERATOR
1 day 5 hours ago #306774

Hi,

Your code is wrong (it will only display if you have more than 300 characters in the custom field) and you don't need all that code.
You can just do:
echo JHTML::_('content.prepare',$this->element->product_intro);

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

  • Posts: 37
  • Thank you received: 0
  • Hikashop Business
1 day 3 hours ago #306797

Hi,

So it should look like this?:
<div id="hikashop_product_intro_main_mini" class="hikashop_product_description_main_mini"><?php
echo JHTML::_('content.prepare',$this->element->product_intro);
?></div>

Regards,
Colin

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

  • Posts: 37
  • Thank you received: 0
  • Hikashop Business
17 hours 35 minutes ago #306811

Hi,

It seems to working with this code;
<div id="hikashop_product_intro_main_mini" class="hikashop_product_description_main_mini"><?php
if(!empty($this->element->product_intro)) {
echo JHTML::_('content.prepare',$this->element->product_intro);
}
?></div>

Could you just double check it for me.

Thanks very much.

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

  • Posts: 37
  • Thank you received: 0
  • Hikashop Business
12 hours 52 minutes ago #306824

Hi,

I've just noticed that the intro text is also appearing in the 'Specification' tab?
Could you take a look please:
banobathrooms-co-uk.stackstaging.com/sui...duct/16-black-cotton

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

  • Posts: 65661
  • Thank you received: 9585
  • MODERATOR
10 hours 44 minutes ago #306825

Hi,

The code is good.
You want to turn off the display setting of the custom field (via the menu Display>Custom fields) since you're displaying it yourself. That way, it won't appear in the specifications tab.

The following user(s) said Thank You: Crashbandi

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

  • Posts: 37
  • Thank you received: 0
  • Hikashop Business
10 hours 31 minutes ago #306835

Perfect.

Thanks for your help with this Nicolas.

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

Time to create page: 0.062 seconds
Powered by Kunena Forum