- Posts: 44
- Thank you received: 2
Assign a specific tax rate to a category
10 years 3 months ago #242667
by hielkio
Assign a specific tax rate to a category was created 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
-- 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.
Less
More
- Posts: 12953
- Thank you received: 1778
10 years 3 months ago #242684
by Mohamed Thelji
Replied by Mohamed Thelji on topic Assign a specific tax rate to a category
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 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.
10 years 3 months ago #242943
by hielkio
Replied by hielkio on topic Assign a specific tax rate to a category
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
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.
10 years 3 months ago - 10 years 3 months ago #242953
by Philip
Replied by Philip on topic Assign a specific tax rate to a category
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 :
Hope this will help you.
Regards
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.
10 years 5 days ago #250961
by hielkio
Replied by hielkio on topic Assign a specific tax rate to a category
It was working before, but now it isn't anymore 
This is the code I used:
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.
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.
10 years 5 days ago #250966
by nicolas
Replied by nicolas on topic Assign a specific tax rate to a category
Hi,
How about doing instead:
That way, it will use the curent category of the listing instead of checking in the categories of each product.
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;
The following user(s) said Thank You: hielkio
Please Log in or Create an account to join the conversation.
10 years 4 days ago #251044
by hielkio
Replied by hielkio on topic Assign a specific tax rate to a category
Wow! You're my hero 
Thank you very much .. it works like a charm!
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.204 seconds