[NEWS] Wprowadzamy zmiany w obsłudze parametrów zależnych / We are introducing changes to the handling of dependent parameters
- Lingua principale
- Nessun dato sulla lingua
- Stelle
- 244
- Fork
- 40
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Parametry zależne to parametry:
* dla których zbiór dostępnych wartości jest uzależniony od wartości innego parametru. Przykładem może być Model, ponieważ dostępne wartości będą uzależnione od tego, jaką wartość wybierzesz dla parametru **Marka**, np. jeśli jako Markę wskażesz Samsung, dostępne wartości dla parametru **Model** zawęzimy do modeli Samsunga,
* które będą wymagane lub widoczne w zależności od wyboru wartości (lub jej braku) innego parametru, np. jeżeli wystawiasz Bransoletkę i jako wartość parametru **Materiał** wybierzesz złoto, pojawi się parametr **Próba złota**. Inny przykład - jeśli wystawiasz np. buty, wartość dla GTIN będziemy wymagać wyłącznie wtedy, gdy zostaną spełnione oba warunki:
* dla parametru **Stan** wybrano wartość Nowy,
* wybrana **Marka** znajduje się na liście marek, dla których wymagamy GTIN.
**Jak parametry zależne obsługiwaliśmy dotychczas?**
Za obsługę parametrów zależnych były do tej pory odpowiedzialne poniższe pola, które zwracamy w ramach [GET /sale/categories/{categoryID}/parameters](https://developer.allegro.pl/documentation/#operation/getFlatParametersUsingGET_2):
* w sekcji options:
* **dependsOnParameterId** - wskazujemy w nim identyfikator parametru “A”, od którego zależne są wartości parametru “B”, np. dla parametru Model (parametr “B”) zwrócimy identyfikator parametru Marka (parametr “A”). Identyfikator parametru w tym polu zwracamy tylko dla parametrów typu dictionary;
* **requiredDependsOnValueIds** - w którym zwracamy identyfikator wartości parametru warunkującego, od którego zależy, czy dany parametr będzie wymagany, np. w przypadku parametru GTIN może się tutaj znaleźć identyfikator wartości “Nowy” parametru “Stan”,
* **displayDependsOnValueIds** - w którym zwracamy identyfikator wartości parametru warunkującego, od którego zależy, czy dany parametr będzie widoczny, np. jeżeli to pole dotyczy parametru “Pojemność” w kategorii “Mydła”, to zwrócimy tutaj identyfikatory wartości “Płyn i “Pasta” dla parametru “Rodzaj”.
* w sekcji dictionary - **dependsOnValueIds**. Zwracamy w nim identyfikator wartości parametru “A”, od którego zależna jest dana wartość parametru “B”, np. dla wartości Galaxy A54 (wartość parametru “B”) zwrócimy ID, które odpowiada wartości Samsung (wartość parametru “A”), ponieważ wybór konkretnego modelu uzależniony jest od wybranej marki.
**Jakie zmiany wprowadziliśmy?**
Pola:
- **options.requiredDependsOnValueIds**,
- **options.displayDependsOnValueIds**
oznaczyliśmy jako **deprecated** i w przyszłości zamierzamy je usunąć.
Zastępujemy je polami:
- **requiredIf**,
- **displayedIf**,
które zawierają poniższą strukturę danych:
* **parametersWithValue** - w którym w polach:
* **id** - zwrócimy ID parametru, od którego zależy wymagalność/wyświetlanie danego parametru,
* **oneOfValueIds** - zwrócimy konkretne wartości tego parametru, które będą warunkować, czy dany parametr jest wymagany/wyświetlany,
np. dla parametru **GTIN** możemy zwrócić poniższą strukturę:
```json5
"requiredIf": {
"parametersWithValue": [
{
"id": "11323", - ID parametru Stan
"oneOfValueIds": [
"11323_1" - ID wartości Nowy parametru Stan
]
},
{
"id": "246705", - ID parametru Marka
"oneOfValueIds": [
"246705_598637" - ID konkretnych wartości parametru Marka
"246705_598638"
]
}
],
```
* **parametersWithoutValue.id** - gdzie zwrócimy ID parametru, którego brak będzie oznaczać wymagalność/wyświetlanie danego parametru, np. dla parametru GTIN możemy zwrócić ID parametru Kod producenta, ponieważ jeśli nie wskażesz nam żadnej wartości dla Kodu producenta, musisz przekazać nam GTIN.
Kombinacje wartości w polach:
* **options.dependsOnParameterId**,
* **dictionary[].dependsOnValueIds**
pozostaną bez zmian.
**Dlaczego wprowadzamy zmiany?**
W dotychczasowej strukturze danych nie mieliśmy technicznej możliwości, aby zaprezentować wszystkie zależności parametrów, jakie mogą wystąpić. Dzięki zmianom, każdy scenariusz, jaki występuje na naszej stronie internetowej, będzie również mógł zostać odpowiednio obsłużony w aplikacji.
-----
Dependent parameters are parameters:
* for which a set of available values depends on the value of the another parameter. Dependent parameter can be **Model**, because available values will depend on value provided in **Brand** parameter, e.g. if you select Samsung as Brand, Model parameter values will be limited to Samsung models only,
* which will be required or displayed depending on the choice of another parameter value (or lack thereof), e.g. if you list a bracelet and as a value for **Material** parameter you will select gold, there will be displayed another parameter - **Millesimal fineness**. Another example - if you list shoes, for example, we will only require a value for **GTIN** if both conditions are met:
* you have selected the value New for the **Condition** parameter,
* the selected **Brand** is on the list of brands for which we require GTIN.
**How did we handle dependent parameters so far?**
The following fields, which we return in the [GET /sale/categories/{categoryID}/parameters](https://developer.allegro.pl/documentation/#operation/getFlatParametersUsingGET_2), have so far been responsible for handling dependent parameters:
* in the options section:
* **dependsOnParameterId** - in which we return ID for parameter “A”, on which the values of the parameter "B" depend, e.g. for the Model parameter (parameter "B") we will return the ID of the parameter Brand (parameter "A"). Parameter ID in this field is returned only for dictionary type parameters,
* **requiredDependsOnValueIds** - in which we return the value of the conditioning parameter, which determines whether a parameter will be required, e.g. for the GTIN parameter, the ID of the “New" value of the "Condition" parameter can be returned here,
* **displayDependsOnValueIds** - in which we will return value ID of the conditioning parameter, which determines whether a parameter will be visible, e.g. if this field applies to the “Volume” parameter in the “Soaps” category, we will return IDs of the “liquid” and “paste” values for the “Type” parameter.
* in the dictionary section - **dependsOnValueIds**. In which we return the ID of the value of the "A" parameter on which the value of the "B" depends on. For example - for the Galaxy A54 value (parameter “B” value) we will return the ID that corresponds to the Samsung value (parameter “A” value), because the choice of a specific model depends on the selected brand.
**What changes have we made?**
We have marked the following fields as deprecated and we will remove them in the future:
* **options.requiredDependsOnValueIds**,
* **options.displayDependsOnValueIds**
We replace them with the fields:
* **requiredIf**,
* **displayedIf**,
which contain the following data structure:
* **parametersWithValue** - in which in fields:
* **id** - we will return the ID of the parameter on which the requiredness/display of a given parameter depends,
* **oneOfValueIds** - we will return specific values of this parameter, which will condition whether a given parameter is required/displayed,
e.g. for the **GTIN** we will return the following structure:
```json5
"requiredIf": {
"parametersWithValue": [
{
"id": "11323", - ID of the Condition parameter
"oneOfValueIds": [
"11323_1" - ID of the New value from Condition parameter
]
},
{
"id": "246705", - ID of the Brand parameter
"oneOfValueIds": [
"246705_598637" - IDs of the specific values from Brand parameter
"246705_598638"
]
}
],
```
* **parametersWithoutValue.id** - where we will return the ID of the parameter, the absence of which will mean that the given parameter is required/displayed, e.g. for the GTIN parameter, we can return the ID of the Manufacturer's code parameter, because if you do not provide us with any value for the Manufacturer's code, you need to send us the GTIN.
Value combinations in the following fields:
* **options.dependsOnParameterId**,
* **dictionary[].dependsOnValueIds**
will remain unchanged.
**Why are we implementing the change?**
In the previous data structure, we did not have the technical possibility to present all the dependencies of parameters that may occur. Thanks to the changes, each scenario that occurs on our website will also be able to be properly handled in the application.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.