Skip to main content

Assign a specific tax rate to a category

More
10 years 3 months ago #242667 by hielkio
-- url of the page with the problem -- : www.koffiematters.nl
-- HikaShop version -- : 2.6.3

Hi people,

I can't figure it out .. I hope you guys can help me out here :)
What I'd like to achieve is this:
- Assign a taxrate to a category (including the existing products)
- Show "Marge product" under the productprice (instead of incl. VAT)

Thank you very much for thinking with me :)

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

More
10 years 3 months ago #242684 by Mohamed Thelji
Hello,
The solution will be to :
- Create another tax category via "Hikashop->System->Taxes->'Manage tax categories'"
- Create a new tax with that tax category and a specific rate via "Hikashop->System->Taxes"
- Edit all the products of your category and set the "Tax category" option of the "Prices and Taxes" tab to the tax category you created.
The following user(s) said Thank You: hielkio

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

More
10 years 3 months ago #242943 by hielkio
I think I wasn't clear enough, sorry :huh:
The right tax-rate / category was assigned to the products, but ...
I'd like to show the tax description (Incl. TAX or No TAX) under the productprice.



I added a static text "Incl. TAX" in listing_price.php before, but now we've got products that don't have any TAX on it.
Maybe a stupid or simple question / solution, is there a way to echo the TAX description or TAX category what assigned is to the product?

Hope you can help me out :)

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

More
10 years 3 months ago - 10 years 3 months ago #242953 by Philip
Hello,

You have to add a check in order to only apply your "custom code" on required category product listing.
More precisely, you can get the category Id and only display your required value if this is the wanted categorie Id.
See this code sample :
Code:
$YourPrice="YourValue"; // Check if the categories is setted : if (isset($this->row->categories) ) { // Read all categories IF the product have several categories setted foreach ($this->row->categories as $key => $value) { // Required category found, display your price : if ($value->category_id == '12' ) $YourPrice="YourValue"; echo '<span class="hikashop_product_price_with_YOUR_TAX">' . $YourPrice . "</span>"; } }

Hope this will help you.

Regards
Last edit: 10 years 3 months ago by Philip.

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

More
10 years 5 days ago #250961 by hielkio
It was working before, but now it isn't anymore :unsure:

This is the code I used:
Code:
$displayValue = ""; // Check if the categories is setted : if (isset($this->row->categories) ) { // Read all categories IF the product have several categories setted foreach ($this->row->categories as $key => $value) { // Required category found, display your price : if ($value->category_id == '13' ) $YourPrice="Marge product"; else $YourPrice="Incl. BTW"; $displayValue = '<span>' . $YourPrice . "</span>"; } echo $displayValue;

The 'problem' is, that the products are assigned to 2 categories, in this case "Jura Occasions" AND the parent category "Coffeemachines".

For the php folks among us, it's very simple to solve I think :silly:
In my code, it's checking if there's another category, if it is, he uses the ELSE value (or am I wrong?)
Wouldn't it be simpler to just check 1 category and if the product is member of it, it will apply the condition.

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

More
10 years 5 days ago #250966 by nicolas
Hi,

How about doing instead:
Code:
$displayValue = ""; // Required category found, display your price : if ($this->element->category_id == '13' ) $YourPrice="Marge product"; else $YourPrice="Incl. BTW"; $displayValue = '<span>' . $YourPrice . "</span>"; echo $displayValue;
That way, it will use the curent category of the listing instead of checking in the categories of each product.
The following user(s) said Thank You: hielkio

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

More
10 years 4 days ago #251044 by hielkio
Wow! You're my hero :)
Thank you very much .. it works like a charm!

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

Time to create page: 0.235 seconds
Powered by Kunena Forum