3

We migrated from 1.4 to 1.6 I am not sure if this is a problem in the migration but our table rate shipping is not worked.

I have this 2 examples;

This one works

Country    Region/State     Zip/Postal Code    Weight (and above)   Shipping Price
USA        *                *                  80                   145

This one does not work

Country    Region/State     Zip/Postal Code    Weight (and above)   Shipping Price
USA        AL               *                  80                   145

I have checked blogs, etc, and I dont see a problem on the files. Any idea?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Luis Valencia
  • 32,619
  • 93
  • 286
  • 506

1 Answers1

2

the condition sql for tablerate checks (among other thing) that dest_zip = '' (cfr Mage_Shipping_Model_Mysql4_Carrier_Tablerate line 135).
As you have * for this field the condition isn't met.
Best solution would be to edit the db, replacing * by nothing (empty field).
In my case I couldn't (dunno why, the db kept replacing my empty string with 0), so I had to override the class to add one line:

"dest_country_id = :country_id AND dest_region_id = :region_id AND dest_zip = :postcode",
"dest_country_id = :country_id AND dest_region_id = :region_id AND dest_zip = ''",
"dest_country_id = :country_id AND dest_region_id = 0 AND dest_zip = ''",
"dest_country_id = :country_id AND dest_region_id = 0 AND dest_zip = '0'",//added line
"dest_country_id = :country_id AND dest_region_id = 0 AND dest_zip = :postcode",
"dest_country_id = '0' AND dest_region_id = 0 AND dest_zip = ''",

HTH

OSdave
  • 8,538
  • 7
  • 45
  • 60
  • Hi, Indeed it works, after I remove the * and put empty it works fine, however,even if I remove the * from the file, the * appears again on the database. You said u had to override the class, can you please explain what you mean? I am not a php developer or magento developer – Luis Valencia Oct 14 '11 at 14:00
  • what class should I override? – Luis Valencia Oct 14 '11 at 14:40
  • @developers, please don't look at this. you're not a php developer, so let go with the easy-and-nasty way. Copy your file `app/code/core/Mage/Shipping/Model/Mysql4/Carrier/Tablerate.php` to `app/code/local/Mage/Shipping/Model/Mysql4/Carrier/Tablerate.php`, find in it the code I've pasted in my answer and add the line I indicate as the one I added. – OSdave Oct 14 '11 at 16:20
  • I can turn dest_zip to "" in my DB but still the table rate doesnt work. I upgraded from 1.4 to 1.7 and the $0+ rate shows fine, but the $100+ rate etc wont work. If I upload the csv enough times it works, and then stops working a few days later. Any ideas? – Jon Jul 03 '12 at 11:15