I am developing a module that connects to an API of a transport company that sends me the calculation of shipments. I'm Sending the product data and destination.

Currently I have three dropdowns 1 for countries, 1 for regions and one for cities. (Using data from my bdd working properly, now I want to do with the data from the API)

The process is simple, the user chooses a country, the regions dropdown are updated with the provinces that I have in the "directory_country_region 'table.

Now I'm in the step of sending to the API the region code and want to recieve the list of cities that I will put in the dropdown city.

I'm considering the option to add 2 columns to the table "directory_country_region" called api_region_id and api_region_name, with the IDs and names that gives me the carrier. I will add this fields manually so they are well synchronized (magento region id / api region id)

Do you consider its a good choice? or add these two fields can create problems?


Do you think that it would be better to remove all current regions and insert only the regions that API returns me? What would happen in a future magento update?

Edit: I think one good option is create a new table only with the IDS "magento region id" and the "api region id". And in my helper make a query before to send the data to the API.

Thanks in advance, I hope I've explained well.

| improve this question | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.