Contact us for info button on product listing page

  • Posts: 14
  • Thank you received: 0
6 years 9 months ago #294360

-- url of the page with the problem -- : floors4u.nl/pvc-vloeren
-- HikaShop version -- : 3.4.0
-- Joomla version -- : 3.8.8
-- PHP version -- : 7.2.6
-- Browser(s) name and version -- : Firefox 60.0.2

Hi,

I have a menu item type product listing. It shows the image, title and price. I want to add a "contact us for info" button, same as which is shown on a single product page.

I added this code to product / listing_img_title.php:

<!-- Start offerteknop bij listing  --> 
<div>
<?php

$params = @$this->params;
			global $Itemid;
			$url_itemid = '';
			if(!empty($Itemid)) {
				$url_itemid = '&Itemid='.$Itemid;
			}
			echo $this->cart->displayButton(
				JText::_('CONTACT_US_FOR_INFO'),
				'contact_us',
				$params,
				''.hikashop_completeLink('product&task=contact&cid=' . $row->product_id.$url_itemid),
				'window.location=\'' . hikashop_completeLink('product&task=contact&cid=' . $row->product_id.$url_itemid) . '\';return false;'
			);

?>
</div>
<!-- Einde offerteknop bij listing -->

The button is shown and links to the contact form. But there is no context from the product (no product shown).
When I click the button on a single article page the name and picture is shown at the top of the contact form.

The URL ends with cid- and should be cid-### (id of the product)

How do I get the product title and image when I click on the contact button on a product listing page where more than 1 products are shown.

Regards,
Eric Beernink

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

  • Posts: 83603
  • Thank you received: 13533
  • MODERATOR
6 years 9 months ago #294362

Hi,

That's because $row->product_id doesn't exist in that view. You should replace it by $this->row->product_id

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

  • Posts: 14
  • Thank you received: 0
6 years 9 months ago #294371

Hi Nicolas,

Thank you, it works perfect now.

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

Time to create page: 0.057 seconds
Powered by Kunena Forum