• Resolved wacosta

    (@wacosta)


    if (!function_exists('eshop_get_tax_rate')) {
            function eshop_get_tax_rate($band, $pzone){
    		global $wpdb, $blog_id, $eshopoptions;
    		$area='country';
    
    		if('yes' != $eshopoptions['hide_shipping'] && (isset($_SESSION['shiptocountry'.$blog_id]) && $_SESSION['shiptocountry'.$blog_id] == $eshopoptions['location'])||(isset($_POST['country']) && $_POST['country'] == $eshopoptions['location'])){
    			$area='state';
    		}
    
    		//if(isset($_SESSION['shiptocountry'.$blog_id]) && $_SESSION['shiptocountry'.$blog_id] == $eshopoptions['location'])
    		//	$area='state';
    
    		//rehash the zone to make sure we're picking up the correct tax rates!
    		$tablecountries=$wpdb->prefix.'eshop_countries';
    		$tablestates=$wpdb->prefix.'eshop_states';
    		if($area=='country'){
    			if(isset($_POST['ship_country']) && $_POST['ship_country']!='' && 'yes' != $eshopoptions['hide_shipping']){
    				$pzoneid=$_POST['ship_country'];
    			}elseif(isset($_POST['country']) && $_POST['country']!=''){
    				$pzoneid=$_POST['country'];
    			}
    			if($eshopoptions['etax']['zonal']== 1)
    				$pzone=$wpdb->get_var("SELECT zone FROM $tablecountries WHERE code='$pzoneid' LIMIT 1");
    			else
    				$pzone = 1;
    		}else{
    			if(isset($_POST['ship_state']) && $_POST['ship_state']!='' && 'yes' != $eshopoptions['hide_shipping']){
    				$pzoneid=$_POST['ship_state'];
    			} else if(isset($_POST['state']) && $_POST['state']!=''){
    				$pzoneid=$_POST['state'];
    			}
    			if(isset($pzoneid))
    				$pzone=$wpdb->get_var("SELECT zone FROM $tablestates WHERE id='$pzoneid' LIMIT 1");
    
    			if($eshopoptions['etax']['zonal']== 0)
    				$pzone = 1;
    		}
    		$ratetable = $wpdb->prefix.'eshop_rates';
    		$band=$wpdb->escape($band);
    		$zone='zone'.$wpdb->escape($pzone);
    		$taxrate = $wpdb->get_var("SELECT $zone FROM $ratetable WHERE id > 0 && class='$band' && area='$area' && rate_type='tax' ");
    
    		return $taxrate;
    }
    }
    ?>

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. Or better still – use a pastebin. As it stands, your posted code may now have been permanently damaged/corrupted by the forum’s parser.]

    http://wordpress.org/extend/plugins/eshop/

Viewing 1 replies (of 1 total)
  • Please not that we cannot support any hacked copies of the core eShop plugin. If you want to make changes to the plugin, create an add-on plugin.

Viewing 1 replies (of 1 total)
  • The topic ‘here is Plugin changes for eshop to tax on shipping’ is closed to new replies.