Cannot Get Brand To Display On Product Contact Page

  • Posts: 966
  • Thank you received: 11
  • Hikashop Business
2 years 5 months ago #344472

I tried getting the brand name to display on the Product Contact page (product / contact.php) by using the codes below and others, but have no luck. Why does none of these work?

<?php
		if($this->config->get('manufacturer_display', 0) && !empty($this->element->product_manufacturer_id)){
			$class = hikashop_get('class.category');
			$manufacturer = $class->get($this->element->product_manufacturer_id, true);
			global $Itemid;
			$categoryClass = hikashop_get('class.category');
			$categoryClass->addAlias($manufacturer);
			echo $this->image->display($manufacturer->file_path,false,$manufacturer->file_name, '', '', $this->image->main_thumbnail_x, $this->image->main_thumbnail_y);
		}
		?>
<?php
$db = JFactory::getDBO();
$db->setQuery('SELECT category_name FROM '.hikashop_table('category').' WHERE category_id='.(int)$this->row->product_manufacturer_id);
$brandName = $db->loadResult();
echo $brandName;
		}
		?>
<p class="hikashop_cart_brand_name">
	<?php $class = hikashop_get('class.category');
	$manufacturer = $class->get($product->product_manufacturer_id);
	echo $manufacturer->category_name; ?>
</p>

Thanks!

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

  • Posts: 83338
  • Thank you received: 13476
  • MODERATOR
2 years 5 months ago #344481

Hi,

That's because you need to adapt the code to the specifics of the view file.
For the product / contact view file, the product data is available in $this->product and not in $this->row or $this->element or $product.

The three pieces of code can work there, if only you replace $this->row or $this->element or $product by $this->product
Note however that for the first piece of code, $this->image also needs to be replaced by $this->imageHelper

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

  • Posts: 966
  • Thank you received: 11
  • Hikashop Business
2 years 5 months ago #344515

Thank you so very much!

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

Time to create page: 0.055 seconds
Powered by Kunena Forum