Esempio n. 1
0
    $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();
    $tax_rule = array();
    $GAtaxTable = new GoogleAlternateTaxTable(!empty($tax_name_array[$i]) ? $tax_name_array[$i] : 'none', 'false');
    for ($j = 0; $j < $num_rows; $j++) {
        $tax_result->MoveNext();
        $rate = (double) $tax_result->fields['tax_rate'] / 100.0;
        $GAtaxRule = new GoogleAlternateTaxRule($rate);
        if ($tax_result->fields['countries_iso_code_2'] == 'US') {
            if ($tax_result->fields['zone_code'] == 'All Areas') {
                $GAtaxRule->SetCountryArea('ALL');
            } else {
                $GAtaxRule->SetStateAreas($tax_result->fields['zone_code']);
            }
        } else {
            // TODO here should go the non use area
            $GAtaxRule->AddPostalArea($tax_result->fields['countries_iso_code_2']);
        }
        $GAtaxTable->AddAlternateTaxRules($GAtaxRule);
    }
    $i++;
    $Gcart->AddAlternateTaxTables($GAtaxTable);
}
if (!(MODULE_PAYMENT_GOOGLECHECKOUT_ANALYTICS == 'NONE')) {
    $Gcart->AddGoogleAnalyticsTracking(MODULE_PAYMENT_GOOGLECHECKOUT_ANALYTICS);
}