- Posts: 1195
- Thank you received: 13
Assign different listing_img_title view
5 months 4 weeks ago #371907
by verzevoul
Assign different listing_img_title view was created by verzevoul
-- 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.
Thank you
-- 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.
Code:
<!-- 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.
5 months 4 weeks ago #371909
by nicolas
Replied by nicolas on topic Assign different listing_img_title view
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.
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.
5 months 4 weeks ago #371919
by verzevoul
Replied by verzevoul on topic Assign different listing_img_title view
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
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.
5 months 4 weeks ago #371923
by nicolas
Replied by nicolas on topic Assign different listing_img_title view
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.
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.
5 months 4 weeks ago #371926
by verzevoul
Replied by verzevoul on topic Assign different listing_img_title view
Great!
Can you help me about where i add the text?
Can you help me about where i add the text?
Please Log in or Create an account to join the conversation.
5 months 4 weeks ago #371927
by nicolas
Replied by nicolas on topic Assign different listing_img_title view
Hi,
Didn't you already added it in an override of listing_img_title as per your initial message ?
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.
5 months 3 weeks ago #371947
by verzevoul
Replied by verzevoul on topic Assign different listing_img_title view
Hi!
The text (με ΦΠΑ) that i added next to the price is for prices with tax.
That's why i am asking if i can add a different text there for the prices without tax!
Thank you
The text (με ΦΠΑ) that i added next to the price is for prices with tax.
That's why i am asking if i can add a different text there for the prices without tax!
Thank you
Please Log in or Create an account to join the conversation.
5 months 3 weeks ago #371948
by nicolas
Replied by nicolas on topic Assign different listing_img_title view
Hi,
Got it, you want the text to change automatically depending on whether that listing is showing prices with tax or without tax. You can do that in your listing_img_title override with this small check:
Put that where you currently have the hardcoded "(με ΦΠΑ)" text. The value comes from the "Show taxed prices" setting of the menu item (and falls back to the same setting in the HikaShop configuration when the menu item leaves it on the default), so the correct text is shown automatically for each listing without you having to maintain two separate files.
Got it, you want the text to change automatically depending on whether that listing is showing prices with tax or without tax. You can do that in your listing_img_title override with this small check:
Code:
<?php
$config = hikashop_config();
$priceWithTax = $this->params->get('price_with_tax', 3);
if($priceWithTax == 3)
$priceWithTax = (int)$config->get('price_with_tax');
if($priceWithTax == 1) {
echo ' (με ΦΠΑ)';
} elseif($priceWithTax == 0) {
echo ' (χωρίς ΦΠΑ)';
}
// note: a value of 2 means both prices (with and without tax) are displayed,
// add a line here if you also want a text in that case
?>
The following user(s) said Thank You: verzevoul
Please Log in or Create an account to join the conversation.
5 months 3 weeks ago - 5 months 3 weeks ago #371949
by verzevoul
Replied by verzevoul on topic Assign different listing_img_title view
Great thank you!
Can i add a class to the text to be able to customise it?
Also, even though in the product listing it is correct now and the prices of this category are without tax, when you enter a product page the price is displayed with the tax. Why is that?
For example:
www.art-metal.gr/epipla2/krevatia
www.art-metal.gr/epipla2/krevatia/product/krevati-art-5011-001
Can i add a class to the text to be able to customise it?
Also, even though in the product listing it is correct now and the prices of this category are without tax, when you enter a product page the price is displayed with the tax. Why is that?
For example:
www.art-metal.gr/epipla2/krevatia
www.art-metal.gr/epipla2/krevatia/product/krevati-art-5011-001
Last edit: 5 months 3 weeks ago by verzevoul.
Please Log in or Create an account to join the conversation.
5 months 3 weeks ago - 5 months 3 weeks ago #371950
by nicolas
Replied by nicolas on topic Assign different listing_img_title view
Hi,
Sure. Just add a span like this:
Whether the price is displayed with or without taxes depends.
On the listings, it depends on the corresponding setting under the Products options tab of the menu item, or the HikaShop options tab of the module.
On the product page, it depends on the main setting in the HikaShop configuration page:
www.hikashop.com/support/documentation/5...nfig.html#main_taxes
Sure. Just add a span like this:
Code:
echo ' <span class="my_class">(με ΦΠΑ)</span>';
Whether the price is displayed with or without taxes depends.
On the listings, it depends on the corresponding setting under the Products options tab of the menu item, or the HikaShop options tab of the module.
On the product page, it depends on the main setting in the HikaShop configuration page:
www.hikashop.com/support/documentation/5...nfig.html#main_taxes
Last edit: 5 months 3 weeks ago by nicolas.
The following user(s) said Thank You: verzevoul
Please Log in or Create an account to join the conversation.
Time to create page: 0.069 seconds