A
A
Anastasia2018-06-19 16:32:34
1C-Bitrix
Anastasia, 2018-06-19 16:32:34

How to make the "location" property into 3 separate lists?

Good afternoon.
Bitrix has a list of order properties (in fact, these are the fields that the user fills in when placing an order). And there is a property with data type (location) in this list. Now this property is displayed as a single field in which you must fill in the country, city and street at the same time. Can this field be made into three lists? Those. in the first list, select a country, and depending on the choice, a city list is formed, and then a street.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Burlaka, 2018-06-19
@AlexeyGfi

Looking into the database, Locations 2.0 is actually three tables.
Just the other day I was raking everything for unpacking on D7 for the task.
The main list is in the b_sale_location table , which is actually a HUGE bunch of locations lumped together (countries, regions, cities, villages, and streets).
Main nodes:
--- Character code - CODE column. If we read the order and location with a clean query, we will often see not the location_id , but the location_code . This is not zip code bound, a string like "0000028023"
--- Parenthood (e.g. city belongs to state) is specified in the PARENT_ID
column It is either specified or null
--- The node type (for example, this city, region or country) is indicated in the TYPE_ID column In the b_sale_loc_type
table - decryption in codes: * 1 COUNTRY * 2 COUNTRY_DISTRICT * 3 REGION * 4 SUBREGION * 5 CITY * 6 VILLAGE * 7 STREET
-- - The depth of immersion (roughly speaking, a guide how many parents are up) is indicated in the DEPTH_LEVEL column (the topmost node in its branch has depth == 1)
=====
This heap has its own plus: by specifying in the order just the symbolic code "00000705506" (CODE of the street node), we thereby, by unwinding the chain up to DEPTH_LEVEL == 1, get absolutely everything: from the street to the country. Which, in principle, is done in the current version of orders.
=====
Now that you have an introduction, you can apply it to your task.
You need three selections:
• the first one is for first level nodes OR corresponding TYPE_ID (country);
• the second - those regions that have the selected country as a parent (if you dive into a region);
• the third - those cities that have the selected region as a parent.
Something like this =)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question