Assign different listing_img_title view

  • Posts: 1152
  • Thank you received: 13
  • Hikashop Business
2 days 23 hours ago #371907

-- HikaShop version -- : 4.6.2
-- Joomla version -- : 3.10.12

Hi,

Is it possible to create and assign overrides for the listing_img_title.php view file like we do for show_default.php for example?
I need to have a different one for a specific category.

I have added a custom span text <span class="uk-text-meta">(με ΦΠΑ)</span> in the price area and i need to change that span for a specific category.

<!-- PRODUCT PRICE -->
<?php
	if($this->params->get('show_price','-1')=='-1'){
		$config =& hikashop_config();
		$this->params->set('show_price',$config->get('show_price'));
	}
	if($this->params->get('show_price')){
		$this->setLayout('listing_price');
		echo $this->loadTemplate();
	}
?>
  
  <span class="uk-text-meta">(με ΦΠΑ)</span>
  
	<!-- EO PRODUCT PRICE -->

Thank you

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

  • Posts: 85610
  • Thank you received: 14019
  • MODERATOR
2 days 19 hours ago #371909

Hi,

Yes and no.

For show_default, you have a "layout on product page" in the HikaShop configuration as default for all the products, and a "layout" setting in each product to override this default so that you can have per product layouts.

In that sense, there is no "per category" layout setting for the product card of listings. This would be strange in some cases.
For example, if you display a HikaShop content module configured to display a listing of best sellers, it's likely the products will come from different categories. And having different products on the same listing displayed with different item layout could lead to strange results. Also, a product can be linked to different categories, which could potentially be linked to different item layouts.

However, there is an indirect way to do it per category: Suppose that you have a "Shop" menu item to access the listing of your categories and then you click on a category to get to its products listing, and then you click on a product to access the product's details page. You could configure a sub menu item named "A" as child of that "Shop" menu item and with its type as a categories listing or products listing, and with its main category set to category "A". Then on the Shop menu item, when clicking on "A", HikaShop would automatically switch you to the sub menu item "A". And in that sub menu item, you can configure an item layout for the products of that category under the "Products options" tab. And you can do the same for category B with a sub menu item B, with a different item layout selected for the products of that category.

The following user(s) said Thank You: verzevoul

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

  • Posts: 1152
  • Thank you received: 13
  • Hikashop Business
2 days 4 hours ago #371919

Hi,

It's kinda complicated :silly:
If in that specific menu item i change the Show taxed prices to no tax, can i add a custom text there for no taxed prices only?

Thank you

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

  • Posts: 85610
  • Thank you received: 14019
  • MODERATOR
1 day 23 hours ago #371923

Hi,

Yes. Since you have already set up a menu item dedicated to that category, with its own listing_img_title view file, and only that menu item is configured to show prices without tax, you can simply put your custom text directly in that view file. It will only appear when products are displayed through that menu item, which is the no-tax one, so the custom text will only show on the no-tax listings, exactly as you want.

The following user(s) said Thank You: verzevoul

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

  • Posts: 1152
  • Thank you received: 13
  • Hikashop Business
1 day 23 hours ago #371926

Great!

Can you help me about where i add the text?

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

  • Posts: 85610
  • Thank you received: 14019
  • MODERATOR
1 day 20 hours ago #371927

Hi,

Didn't you already added it in an override of listing_img_title as per your initial message ?

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

Time to create page: 0.062 seconds
Powered by Kunena Forum