Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Add region/state of the country in magento

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 223
    Comment on it

    Sometime we need to have dropdown for states related to countries just as we have for United States by default, for that we need to add states of particular country. To add custom states we need to modify the tables of magento. There are two tables involved in the addition of states -

    1) directory_country_region
    2) directory_country_region_name

    To add states we have to run this query -

    e.g. To add India states in database -

    INSERT INTO directory_country_region (region_id, country_id, code, default_name) VALUES
        (NULL, 'IN', 'DEL', 'NEW DELHI');
    
    INSERT INTO directory_country_region_name( locale, region_id, name ) 
    SELECT 'en_US' AS "language", region_id, default_name
    FROM directory_country_region
    WHERE country_id = 'IN';
    

    Where directory_country_region is used to show states for a specified country_id in the State/Province drop box on the address forms.

    We need to add corresponding record to directory_country_region_name , in which we enter the region_id generated by inserting record in directory_country_region , this entry create new region shown in email or order summary.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: