Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Table rates in 0.714800
 
Samson
Jr. Member
 
Total Posts:  11
Joined:  2008-01-08
 

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 ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Samson
Jr. Member
 
Total Posts:  11
Joined:  2008-01-08
 

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.

 
Magento Community Magento Community
Magento Community
Magento Community
 
firewizard
Member
 
Avatar
Total Posts:  43
Joined:  2007-11-22
Bucharest, Romania
 

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+

Ofc, Subset 1 + Subset 2 === Regions, Subset 1 & Subset 2 don’t share any region_id.

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.

In the end the table would look like this:

dest_country_id          dest_region_id         dest_zip     condition_name     condition_value     price     cost
RO                               region_id_1              
''                 package_value      0                               10        10
RO                               region_id_2              
''                 package_value      0                               10        10
RO                               region_id_3              
''                 package_value      0                                5          5
RO                               region_id_4              
''                 package_value      0                                5          5
RO                               region_id_1              
''                 package_value      100                            0          0
RO                               region_id_2              
''                 package_value      100                            0          0
RO                               region_id_3              
''                 package_value      50                              0          0
RO                               region_id_4              
''                 package_value      50                              0          0
My question is, what am I doing wrong, cause the rates are not working as I expected?
 
Magento Community Magento Community
Magento Community
Magento Community
 
firewizard
Member
 
Avatar
Total Posts:  43
Joined:  2007-11-22
Bucharest, Romania
 

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_valueDESC 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.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top