• Resolved Robert Heller

    (@robertpheller)


    I found a couple of bugs in the tax handling code (in file zingiri-web-shop/fws/classes/tax.class.php)

    1) At line 18, there is a test to check if $this->taxByCategory[$category] is set — this test is not needed and messes things up later in the code.

    2) At line 101, the customer’s country is fetched. This is later compared to the tax country. The problem is, the country in the customer is stored as the 2-3 letter ISO name and the country in the tax database is stored as the full English name. I added code to look up the proper full english name so that the compare later will work correctly.

    Here is the patch:

    diff -c -r zingiri-web-shop/fws/classes/tax.class.php /var/www/trainstore/wordpress/wp-content/plugins/zingiri-web-shop/fws/classes/tax.class.php
    *** zingiri-web-shop/fws/classes/tax.class.php	2012-06-30 06:55:28.000000000 -0400
    --- /var/www/trainstore/wordpress/wp-content/plugins/zingiri-web-shop/fws/classes/tax.class.php	2012-07-23 14:04:05.000000000 -0400
    ***************
    *** 15,21 ****
      		global $dbtablesprefix,$no_vat,$db_prices_including_vat;
    
      		$taxtot=0;
    ! 		if (!isset($this->taxByCategory[$category])) $this->taxByCategory[$category]=array(); 
    
      		if ($no_vat == 1) {
      			$in_vat = $price;
    --- 15,21 ----
      		global $dbtablesprefix,$no_vat,$db_prices_including_vat;
    
      		$taxtot=0;
    ! 		//if (!isset($this->taxByCategory[$category])) $this->taxByCategory[$category]=array(); 
    
      		if ($no_vat == 1) {
      			$in_vat = $price;
    ***************
    *** 99,104 ****
    --- 99,109 ----
      			$state="";
      		} else {
      			$country=$customer->data['COUNTRY'];
    + 			$country_q = "select <code>NAME_EN</code> from <code>&quot;.$dbtablesprefix.&quot;country</code> WHERE <code>ISO</code>='".$country."' LIMIT 1";
    + 			$sql_country = mysql_query($country_q) or die(mysql_error());
    + 			if ($c_country = mysql_fetch_array($sql_country)) {
    + 				$country = $c_country['NAME_EN'];
    + 			}
      			$state=$customer->data['STATE'];
      		}

    https://www.ads-software.com/extend/plugins/zingiri-web-shop/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Zingiri Web Shop] Bugfix patch for tax code’ is closed to new replies.