Remarks // Returns function taxCalculateTaxByClass2( $taxClassID, $shippingAddress, $billingAddress ) { $class = taxGetTaxClassById( $taxClassID ); // get address if ( $class["address_type"] == 0 ) { $address = $shippingAddress; } else { $address = $billingAddress; } if ( $address == null ) return 0; // get tax rate $address["countryID"] = (int) $address["countryID"]; $q = db_query( "select value, isByZone from ".TAX_RATES_TABLE. " where classID=".(int)$taxClassID." AND countryID=".(int)$address["countryID"] ); if ( $row=db_fetch_row($q) ) { $value = $row["value"]; $isByZone = $row["isByZone"]; } else { $q = db_query( "select value, isByZone from ".TAX_RATES_TABLE. " where isGrouped=1 AND classID=".(int)$taxClassID); if ( $row=db_fetch_row($q) ) { $value = $row["value"]; $isByZone = $row["isByZone"]; } else return 0; } if ( $isByZone == 0 ) return $value; else { $res = _getBestZipRate( $taxClassID, $address["countryID"], $address["zip"] ); if ( !is_null($res) ) return $res; else { if ( is_null($address["zoneID"]) || trim($address["zoneID"]) == "" ) return 0; $q = db_query( "select value from ".TAX_RATES_ZONES_TABLE. " where classID=".(int)$taxClassID." AND zoneID=".(int)$address["zoneID"] ); if ( ($row=db_fetch_row($q)) ) return $row["value"]; else { $q = db_query("select value from ".TAX_RATES_ZONES_TABLE. " where classID=".(int)$taxClassID." AND isGrouped=1" ); if ( ($row=db_fetch_row($q)) ) return $row["value"]; else return 0; } } } } ?>