import mass actions the TAX change

  • Posts: 122
  • Thank you received: 3
  • Hikashop Business
5 years 1 week ago #313114

-- HikaShop version -- : 4.2.2
-- Joomla version -- : 3.9.13
-- PHP version -- : 7.3.8

hi,

Do you know that when a import.csv is whithout the colom product_tax_ all taxes are changed to whitout tax in products that normaly have a tax as Hihg 21%?

Such happend when i want all (category) products by mass actions export and import, to change product codes or product names i have to take also the product_tax. Then it is save.

Is that because i change for the variants the product_code? I take the coloms product_id and the product_parent_id in the csv and it is not "realy" a new product then.

regards,

Marius

Attachments:
Last edit: 5 years 1 week ago by mariussport.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
5 years 1 week ago #313126

Hi,

I don't see why that would change.
I've looked at the code of the mass action import and the only place where the product_tax_id is mentioned is in that piece:

if(!empty($data->elements[$id]->price_value_with_tax)){
					$currencyHelper = hikashop_get('class.currency');
					if(empty($data->elements[$id]->product_tax_id)){
						if(!empty($oldElement->product_tax_id)){
							$data->elements[$id]->product_tax_id = $oldElement->product_tax_id;
						}else{
							$data->elements[$id]->product_tax_id = $currencyHelper->getTaxCategory();
						}
					}

					if($data->elements[$id]->product_tax_id){
						if(strpos($data->elements[$id]->price_value_with_tax,'|')===false){
							$data->elements[$id]->price_value = $currencyHelper->getUntaxedPrice(hikashop_toFloat($data->elements[$id]->price_value_with_tax),hikashop_getZone(),$data->elements[$id]->product_tax_id);
						}else{
							$price_value = explode('|',$data->elements[$id]->price_value_with_tax);
							foreach($price_value as $k => $price_value_one){
								$price_value[$k] = $currencyHelper->getUntaxedPrice($price_value_one,hikashop_getZone(),$data->elements[$id]->product_tax_id);
							}
							$data->elements[$id]->price_value = implode('|',$price_value);
						}
					}
					unset($data->elements[$id]->price_value_with_tax);
				}
What this code does is that if there is the price_value_with_tax column in the CSV, it calculates the price_value out of it based on the product_tax_id of the product. And if the product_tax_id column is not in the CSV, it tries to load it from the database, and if there isn't any in the database, it takes the default tax category id.

Do you have other filters or actions in your mass action ?
Do you have other mass actions ? Like for example one which does things on the product_tax_id when a product is updated ?

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

  • Posts: 122
  • Thank you received: 3
  • Hikashop Business
5 years 4 days ago #313306

hi,

we work only whith prices whithout tax. i tested this morning many posibilities of the import columns. CSV with and without the price_tax-id. price and price whith tax.
First i made a Tax category default. This was maybe the problem it was not there, we use normaly the tax rule for Netherlands high 21%
But all variants show me that i need the column price_tax_id. Otherwise it went wrong. ( to none tax rule)

I disabled all mass actions and no other filters active.
thanks for your answer, i have to take care about my mass actions and keep always all important columns in the csv, so i don't lose something!

When i change the product codes by mass action "show results" everything works perfect, also whithout showing tax, but that is slower than a csv
to change a lot codes.

regards,

Marius
ps. installed also today the newest buss hika 4.2.2

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
5 years 3 days ago #313310

Hi,

I'm not following you.
There is no price_tax_id column.
The column where you need to fill the tax category id is called product_tax_id.

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

  • Posts: 122
  • Thank you received: 3
  • Hikashop Business
5 years 3 days ago #313352

sorry my mistake, indeed the column product_tax_id
because i was also testing the columns price_value and price_value_with_tax both, then the result is one price whith tax
like in the code at the end }
unset($data->elements[$id]->price_value_with_tax);
}
so my result is that i need "always" the column product_tax_id with csv import. test i mde on local sites and online site. Hika 4.2.2 and i think it was no so in earlier versions??

so i work on and see if you want to tell more about this but not necessarily

regards, Marius

Attachments:

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
5 years 2 days ago #313355

Hi,

If you only specify the price_value column you shouldn't need the product_tax_id column. However, if you use the price_value_with_tax column, the product_tax_id column is necessary since only the untaxed price is stored in the database.
And we didn't change the import since a long time so I don't see why something would be different regarding all that between the 4.2.1 and the 4.2.2.

Actually the last change we made to the import was 1 year ago. It was to make sure to get the product_tax_id from the template product if any selected instead of blindly using the default one. It was a fix added for that error:
www.hikashop.com/forum/content-creation/...category.html#300917
So, if you are using a template product with your import and that this template product doesn't have a tax category configured, and supposing that you updated your HikaShop from a version older than 1 year ago to a recent one, it's possible that you saw a change in behavior as before it would use the default tax category and now it's not setting the tax category as it is not set in the template product. In such case, you would have to properly set the tax category in the template product in order to not have to set the product_tax_id column in your CSV.

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

  • Posts: 122
  • Thank you received: 3
  • Hikashop Business
5 years 2 days ago #313382

Thank you, now it's clear, when i use a template product (whitout a image) by the import csv everything works fine!
In all the years i know that the template was there but i never used it.

i made a not published clean product with default tax, is that correct? Or can i find more about a template product in the documentation?

Marius

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
5 years 1 day ago #313383

Hi,

We talk a bit about this option there: www.hikashop.com/support/documentation/7...import.html#generate
But you won't find much.

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

  • Posts: 122
  • Thank you received: 3
  • Hikashop Business
5 years 1 day ago #313409

yes i know that documentation already, indeed it is petit. So i am happy with the template product new and have good results!

So thank you and close this item OK.

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

Time to create page: 0.073 seconds
Powered by Kunena Forum