Jump to content
gusman126

Problem with taxes, does not associate country. Bug prestashop? V. 1.7.4.2

Recommended Posts

Problem with taxes, does not associate country

Prestashop version 1.7.4.2


Hello everyone, I am developing a module.

This module reads the product taxes

$product = new Product($id_product);
$id_group= $product->id_tax_rules_group;
$taxes = TaxRule::getTaxRulesByGroupId($id_lang, $id_group);



Check the country and choose the tax for that country

foreach($taxes as $taxs){
	if($taxs["country_name"] == 'spain' or $taxs["country_name"] == 'españa'){
		$tax = ($taxs['rate'] /100) + 1;
	}else{
		$tax = 1;
	}
}

The problem is that in the information read, it is always null in the country field

var_dump($taxes);

[0]=>
  array(10) {
    ["id_tax_rule"]=>
    string(3) "270"
    ["country_name"]=>
    NULL
    ["state_name"]=>
    NULL
    ["rate"]=>
    string(6) "21.000"
    ["zipcode_from"]=>
    string(1) "0"
    ["zipcode_to"]=>
    string(1) "0"
    ["description"]=>
    string(0) ""
    ["behavior"]=>
    string(1) "0"
    ["id_country"]=>
    string(2) "36"
    ["id_state"]=>
    string(1) "0"
  }
  [1]=>
  array(10) {
    ["id_tax_rule"]=>
    string(3) "249"
    ["country_name"]=>
    NULL
    ["state_name"]=>
    NULL
    ["rate"]=>
    string(6) "21.000"
    ["zipcode_from"]=>
    string(1) "0"
    ["zipcode_to"]=>
    string(1) "0"
    ["description"]=>
    string(0) ""
    ["behavior"]=>
    string(1) "0"
    ["id_country"]=>
    string(1) "3"
    ["id_state"]=>
    string(1) "0"
  }
......

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More