Google Checkout Solution
----
I have only tested this for about 5 minutes but it worked every time. :) Give this a shot to incorporate this mod into your Google Checkout.
In gcheckout.php (on or around line 719 there is a SQL query, I changed mine to:
$tax_result = $db->Execute("SELECT
zen_tax_rates_local.local_tax_id,
zen_tax_rates_local.zone_id,
zen_tax_rates_local.local_fieldmatch,
zen_tax_rates_local.local_datamatch,
zen_tax_rates_local.local_tax_rate,
zen_tax_rates_local.local_tax_label,
zen_tax_rates_local.local_tax_shipping,
zen_tax_rates_local.local_tax_class_id
FROM
zen_tax_rates_local
WHERE
zen_tax_rates_local.local_datamatch = " . SHIPPING_ORIGIN_ZIP . "");
on or around line 743 you should see
$rate = ((double)($tax_result->fields['tax_rate']))/100.0;
change that to
$rate = ((double)($tax_result->fields['local_tax_rate']))/100.0;
I also got rid of a few lines. You won't be able to copy/paste my changes but this will definitely get you 80% there. I have pasted the entire foreach below. Modify as necessary. I'm doing zip code lookups. It will only work with zip codes.
Code:
foreach($tax_array as $tax_table) {
$tax_result = $db->Execute("SELECT
zen_tax_rates_local.local_tax_id,
zen_tax_rates_local.zone_id,
zen_tax_rates_local.local_fieldmatch,
zen_tax_rates_local.local_datamatch,
zen_tax_rates_local.local_tax_rate,
zen_tax_rates_local.local_tax_label,
zen_tax_rates_local.local_tax_shipping,
zen_tax_rates_local.local_tax_class_id
FROM
zen_tax_rates_local
WHERE
zen_tax_rates_local.local_datamatch = " . SHIPPING_ORIGIN_ZIP . "");
$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['local_tax_rate']))/100.0;
$GAtaxRule = new GoogleAlternateTaxRule($rate);
$GAtaxRule->SetStateAreas("CA");
$GAtaxTable->AddAlternateTaxRules($GAtaxRule);
}
$i++;
$Gcart->AddAlternateTaxTables($GAtaxTable);
}
Bookmarks