Hi there, I downloaded a new version of 1.5.1 and I'm trying to set up taxes in the admin. I followed the tutorial for setting up UK VAT as usual and everything seems ok. But when I go to a product page and enter a product net price the gross just shows the exact same.
I can see from the page source that the javascript which holds the variable for the tax is set to 0 whereas it should be 20
tax_rates["2"] = 0;So I went and had a look at the collect_info file where that figure should come from and it seems that the query isn't picking up the tax rate properly.
It looks like the if ($tax->RecordCount() > 0) evaluates to false because if I change the else to {return 50;} then the 50 shows up inthe javascript ok.Code:function zen_get_tax_rate($class_id, $country_id = -1, $zone_id = -1) { global $db; global $customer_zone_id, $customer_country_id; if ( ($country_id == -1) && ($zone_id == -1) ) { if (!$_SESSION['customer_id']) { $country_id = STORE_COUNTRY; $zone_id = STORE_ZONE; } else { $country_id = $customer_country_id; $zone_id = $customer_zone_id; } } $tax = $db->Execute("select SUM(tax_rate) as tax_rate from (" . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za ON tr.tax_zone_id = za.geo_zone_id left join " . TABLE_GEO_ZONES . " tz ON tz.geo_zone_id = tr.tax_zone_id ) WHERE (za.zone_country_id IS NULL OR za.zone_country_id = 0 OR za.zone_country_id = '" . (int)$country_id . "') AND (za.zone_id IS NULL OR za.zone_id = 0 OR za.zone_id = '" . (int)$zone_id . "') AND tr.tax_class_id = '" . (int)$class_id . "' GROUP BY tr.tax_priority"); if ($tax->RecordCount() > 0) { $tax_multiplier = 0; while (!$tax->EOF) { $tax_multiplier += $tax->fields['tax_rate']; $tax->MoveNext(); } return $tax_multiplier; } else { return 0; } }
So I think it might be to do with the global $customer_country_id;
But I'm buggered if I can find where this is set. No mention of it in the files according to the search function of notepad++
I've been playing with this for hours now scratching my head. Whats going wrong? Any body know where the mysterious global comes from?


Reply With Quote
