Brand Display on Products with different variants

  • Posts: 214
  • Thank you received: 1
12 years 1 month ago #117911

Hi Guys,

If you look at a product page on my site (eg craftkeg.com/index.php/hikashop-menu-for...oduct/7-beach-blonde ) you can see I've edited show_default so I'm displaying the brand name...

<strong>Supplier: </strong><?php $class = hikashop_get('class.category');
$manufacturer = $class->get($this->element->product_manufacturer_id);
echo $manufacturer->category_name; ?><br>

My question is however, if you select a different variant (size in my case) the Brand then vanishes. Am I able to have it so the Brand is displayed even when a variant is selected?

Kind Regards,

Matthew

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

  • Posts: 13201
  • Thank you received: 2322
12 years 1 month ago #117985

Hi,

Yes, you probably need to use "$this->element->main->product_manufacturer_id" to get the value from the main product and not a variant.

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

  • Posts: 214
  • Thank you received: 1
12 years 1 month ago #118022

Hi Xavier, did you mean change it so it looks like...

<strong>Supplier: </strong><?php $class = hikashop_get('class.category');
$manufacturer = $class->get($this->element->main->product_manufacturer_id);
echo $manufacturer->category_name; ?><br>

because that did not seem to do the trick?

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

  • Posts: 12953
  • Thank you received: 1778
12 years 1 month ago #118062

Hi,

The problem is probably coming from the fact that you have put your custom code into this price span TAG :

<span id="hikashop_product_price_main" class="hikashop_product_price_main">
    <?php
    //LAYOUT listing_price
    if ($this->params->get('show_price')) {
      $this->row = & $this->element;
      $this->setLayout('listing_price');
      echo $this->loadTemplate();
    }
    ?>
  </span>
So the best solution will be to put your modification before or after this span.

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

Time to create page: 0.061 seconds
Powered by Kunena Forum