Exemple #1
0
    $num_rows = $tax_result->RecordCount();
    $tax_rule = array();
    for ($j = 0; $j < $num_rows; $j++) {
        $tax_result->MoveNext();
        $rate = (double) $tax_result->fields['tax_rate'] / 100.0;
        $GDtaxRule = new GoogleDefaultTaxRule($rate, 'true');
        if ($tax_result->fields['countries_iso_code_2'] == 'US') {
            if ($tax_result->fields['zone_code'] == 'All Areas') {
                $GDtaxRule->SetCountryArea('ALL');
            } else {
                $GDtaxRule->SetStateAreas($tax_result->fields['zone_code']);
            }
        } else {
            $GDtaxRule->AddPostalArea($tax_result->fields['countries_iso_code_2']);
        }
        $Gcart->AddDefaultTaxRules($GDtaxRule);
    }
} else {
    $GDtaxRule = new GoogleDefaultTaxRule(0, 'false');
    $GDtaxRule->SetWorldArea(true);
    $Gcart->AddDefaultTaxRules($GDtaxRule);
}
if (sizeof($tax_class_unique) > 1 || sizeof($tax_class_unique) == 1 && sizeof($module_info_enabled) != sizeof($tax_class)) {
    $Gcart->SetButtonVariant(false);
    $Gwarnings[] = GOOGLECHECKOUT_STRING_WARN_MULTIPLE_SHIP_TAX;
}
$i = 0;
$tax_tables = array();
foreach ($tax_array as $tax_table) {
    $tax_result = $db->Execute("select distinct countries_name, coalesce(zone_code, 'All Areas') zone_code, tax_rate, countries_iso_code_2\n                               from " . TABLE_TAX_RATES . " as tr " . " inner join " . TABLE_ZONES_TO_GEO_ZONES . " as ztgz on tr.tax_zone_id = ztgz.geo_zone_id " . " inner join " . TABLE_COUNTRIES . " as c on ztgz.zone_country_id = c.countries_id " . " left join " . TABLE_ZONES . " as z on ztgz.zone_id=z.zone_id\n                               where tr.tax_class_id= '" . $tax_array[$i] . "'");
    $num_rows = $tax_result->RecordCount();