WordPress.org

Ready to get started?Download WordPress

Forums

Zingiri Web Shop
[resolved] Bugfix patch for tax code (2 posts)

  1. Robert Heller
    Member
    Posted 1 year ago #

    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'];
      		}

    http://wordpress.org/extend/plugins/zingiri-web-shop/

  2. zingiri
    Member
    Plugin Contributor

    Posted 1 year ago #

    Thanks will get it fixed ASAP.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic