Hi,
in the previous release I was able to import table rates from a csv file.
It seems that it doesn’t work at all in this version.
Am I the only one getting in trouble while trying to import table rates ?
Actually the import table rate doesn’t work so I had to export the shipping_tablerate table from the database of my previous installation, then import it directly in the new database.
I’ve inserted new regions in the directory_country_regions table, then inserted table rates rules in the shipping_tablerate table. I have 4 categories of conditions.
Subset 1 of all regions
-> have tax $10 for subtotals of 0 - 100
-> have tax $0 for subtotals of 100+
Subset 2 of all regions
-> have tax $5 for subtotals of 0 - 50
-> have tax $0 for subtotals of 50+
I’ve tried several approaches, but the shipping rate in the checkout process is always the lowest in the tablerate table.
Let’s assume Subset1 = {region_id_1, region_id_2}, Subset2 = {region_id_3, region_id_4}
What I’ve done:
I’ve inserted 2 rules for each region_id, first the ones from 0 to 100 and 50, respectively, and then for a subtotal greater than 100 or 50, respectively.
Hi guys, I think I found the reason why table rates weren’t working as expected. I’ve checked app/code/core/Mage/Shipping/Model/Mysql4/Carrier/Tablerate.php and noticed this SQL was usually being generated:
SELECT `shipping_tablerate`.* FROM `shipping_tablerate` WHERE ( (dest_zip='') OR (dest_region_id='223' AND dest_zip='') OR (dest_country_id='RO' AND dest_region_id='0' AND dest_zip='') OR (dest_country_id='0' AND dest_region_id='0' AND dest_zip='') ) AND (condition_name='package_value') AND (condition_value<='155') AND (website_id='1') ORDER BY `condition_value` DESC LIMIT 1
The thing is, I’m building the quotation based on Country (Romania only) and Region (two classes of regions). The zip/postal code is not mandatory and often users leave it blank (but this is true event if it’s not blank). The first condition in the OR group is always true for rules that don’t have ZIP specific rules. I think that part should only be added if $zip is not empty string. Just a thought.
I’ve removed the ”(dest_zip=’’) OR” part and quotes are being displayed ok.