Code for displaying Brand Name in product list

  • Posts: 634
  • Thank you received: 16
11 years 7 months ago #97758

Some PHP coder need to help in a simple feature:

I want to add Product Brand name in my product listing. I tried some tweak in file list_img_desc.php but I finally accepted that my PHP knowledge is too poor to keep trying forever...

I cloned <!-- PRODUCT NAME --> piece of code and tried several 'mutations' but the best I got is the brand code itself, but not it's name.

Please bring some light to the project

<!-- PRODUCT BRAND -->
<span class="hikashop_product_name">
<?php if($this->params->get('link_to_product_page',1)){ ?>
<a href="<?php echo $link;?>">
<?php } ?>
<?php
echo $this->row->product_name;
?>
<?php if($this->params->get('link_to_product_page',1)){ ?>
</a>
<?php } ?>
</span>
<!-- EO PRODUCT BRAND -->

I want to achieve this


Attachments:

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

  • Posts: 13201
  • Thank you received: 2322
11 years 7 months ago #97841

Hi,

To have the brand name you can use:

$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;

The following user(s) said Thank You: PeterChain

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

Time to create page: 0.076 seconds
Powered by Kunena Forum