Show manufacturer name and error in the home title

  • Posts: 23
  • Thank you received: 0
10 years 9 months ago #145775

-- HikaShop version -- : 2.2.3
-- Joomla version -- : 3.2.1
-- PHP version -- : 5.3.27

Hi,

In the home page I have a menu category listing with a module of associated products and I want to show in each of those products the manufacturer name. The Type of Layout I'm using is DIV and I'm editing this file \html\com_hikashop\product\listing_img_title.php I used this code but nothing happens:

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);
  global $Itemid;

  $categoryClass = hikashop_get('class.category');
  $categoryClass->addAlias($manufacturer);
  echo JText::_('MANUFACTURER').': '.'<a href="'.hikashop_completeLink('category&task=listing&cid='.$manufacturer->category_id.'&name='.$manufacturer->alias.'&Itemid='.$Itemid).'">'.$manufacturer->category_name.'</a>';
}

Another issue is the name of the title in the home page. I don't know if it is related with the menu category listing

Attachments:
Last edit: 10 years 9 months ago by cipionhabla.

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

  • Posts: 13201
  • Thank you received: 2322
10 years 9 months ago #145849

Hi,

1. In the option of your listing div menu/module, thanks to check if you use the listing_img_title template and not the listing_img_desc for example. Then thanks to make the editions via the menu Display > Views.
Else if you already have an override you will not see the changes and when updating HikaShop you will lose your changes.

2. It probably come from the options in the category listing menu, so thanks to enable the option "Use menu name instead of
category name for the title " and set the desired name in the menu title.

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

  • Posts: 23
  • Thank you received: 0
10 years 9 months ago #146169

Hello,

I tried to put the code under the product name but nothing happens. I verified the listing_img_title template and it is working because I did a test with a paragraph and it worked.

This is how I modified the file:

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

<?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);
          global $Itemid;

          $categoryClass = hikashop_get('class.category');
          $categoryClass->addAlias($manufacturer);
          echo JText::_('MANUFACTURER').': '.'<a href="'.hikashop_completeLink('category&task=listing&cid='.$manufacturer->category_id.'&name='.$manufacturer->alias.'&Itemid='.$Itemid).'">'.$manufacturer->category_name.'</a>';
} ?>

The second point works perfectly.

Thanks

Last edit: 10 years 9 months ago by cipionhabla.

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

  • Posts: 13201
  • Thank you received: 2322
10 years 9 months ago #146230

Hi,

Are you sure that the option "Display the manufacturer" in Configuration > Display > Default parameters for products is enables, or the option in the menu/module options displaying the desired page ?

I think that you don't enter in the if condition, so you have to check if there is a value in: $this->element->product_manufacturer_id before the if condition.

You can use a simple "echo": echo $this->element->product_manufacturer_id;

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

  • Posts: 23
  • Thank you received: 0
10 years 8 months ago #146753

Element did't find anything but row did it so this works in a Listing of categories with a menu

<!-- PRODUCT BRAND -->
    <h5 class="product-card-brand">
        <?php
            if ( $this->config->get('manufacturer_display', 0) && !empty($this->row->product_manufacturer_id) ) {
                $categoryClass = hikashop_get('class.category');
                $manufacturer = $categoryClass->get($this->row->product_manufacturer_id);
                echo $manufacturer->category_name;
            }
        ?>
    </h5>
<!-- EO PRODUCT BRAND -->

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

  • Posts: 12953
  • Thank you received: 1778
10 years 8 months ago #146774

Hi,
So did you solved your issue ? :)

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

Time to create page: 0.095 seconds
Powered by Kunena Forum