Adding custom module to product page.

  • Posts: 34
  • Thank you received: 0
8 years 1 month ago #268770

-- HikaShop version -- : 3.0.1
-- Joomla version -- : 3.7
-- PHP version -- : 7.0

I want to place a link on the product page which will display an article popup whenever it's clicked.

I have been following the instructions in this thread: www.hikashop.com/forum/4-how-to/82640-ad...to-product-page.html

By adding the PHP code to either the top or bottom of the view "product / show_default", I can get the link to appear at either the top or bottom of the product page.

I would like the link to appear underneath the product price though. I would have thought that the best way to achieve this would be to activate it via "Modules under the product page" however my custom module is not available as an option here.

What is the best way to achieve this please?

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

  • Posts: 83987
  • Thank you received: 13603
  • MODERATOR
8 years 1 month ago #268776

Hi,

Well, instead of adding your code to the top or the bottom of the show_default view file, you could add it just after the display of the price. That way, you would have it exactly where you want it.
The price is displayed by that code in that view file:

<span id="hikashop_product_price_main" class="hikashop_product_price_main"  itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<?php
	// LAYOUT listing_price
	if($this->params->get('show_price') && (empty($this->displayVariants['prices']) || $this->params->get('characteristic_display') != 'list')) {
		$this->row =& $this->element;
		$this->setLayout('listing_price');
		echo $this->loadTemplate();
?>
		<meta itemprop="availability" content="http://schema.org/<?php echo ($this->row->product_quantity != 0) ? 'InStock' : 'OutOfstock' ;?>" />
		<meta itemprop="priceCurrency" content="<?php echo $this->currency->currency_code; ?>" />
<?php
	}
?>
		</span>

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

  • Posts: 34
  • Thank you received: 0
8 years 1 month ago #268805

Thanks Nicolas, that did the trick!

I spent a lot of time pasting the code in different locations throughout the "show_default" view file, however it would only successfully display on my site whenever it was pasted at the top or bottom of the file.

I am unfortunately a complete novice with PHP and it seems that the code will only work when placed in very specific locations throughout the file.

Once again, thank you very much for your help!!

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

Time to create page: 0.054 seconds
Powered by Kunena Forum