1b.app
Link copied -

How to fill process options automatically?

I have filters that affect the price of a product, for each product it can be a different filter.
The order arrives from cs-cart - the additional field of the product of the process is filled. I configured to display all additional fields that are associated with the filter (there are 50 such pieces) + removed the display of empty ones.
For manual creation - solves the "Process Options" field + it fills in all the options in the additional process field through a separator.
Now my task is:
There is a document in which you need to display product options. I can fill them in from additional fields, but this is only when manually created, because when an order arrives from the site, only additional fields are filled in, and the options are not filled.
So, the question is how to fill in the options if the order came from the site?
Original question is available on version: ru

Answers:

You need to write a filter in them: value, for each from a new line like?
You can do an action that will take a list of selected additional fields and based on them (for those where there are values) - write everything in the options.
17.09.2021, 14:40
Original comment available on version: ru

Суханіцький Андрій OneBox CORP
OneBox Corp - Інтегратор
Personal license

Tyndyk Maxim Vadimovich
OneBox production
Administrator wrote:
You need to write a filter in them: value, for each from a new line like?
You can do an action that will take a list of selected additional fields and based on them (for those where there are values) - write everything in the options.

the option is suitable, but I don’t know what to do with the price, that is, whether to take it from the markup or not to change it, since the price is already recorded ... Here you need to think about the logic, it’s possible to provide just 2 options either to take it from the markup, or not to change it what is already entered
17.09.2021, 17:45
Original comment available on version: ru

Суханіцький Андрій OneBox CORP
OneBox Corp - Інтегратор
Personal license

Sukhanitsky Andrey
Integrator
Client
Integrator CRM wrote:

Tyndyk Maxim Vadimovich
OneBox production
Administrator wrote:
You need to write a filter in them: value, for each from a new line like?
You can do an action that will take a list of selected additional fields and based on them (for those where there are values) - write everything in the options.

the option is suitable, but I don’t know what to do with the price, that is, whether to take it from the markup or not to change it, since the price is already recorded ... Here you need to think about the logic, it’s possible to provide just 2 options either to take it from the markup, or not to change it what is already entered

Today I found a problem with the options:
They are filled in on the site in two languages, respectively, when importing an order https://crm.stylesalon.com.ua/admin/customorder/order/32778/edit/ a new additional field and filter is added

Here is the field that was created https://crm.stylesalon.com.ua/admin/shop/orderproductfield/132/
And here is the field that you need to fill in https://crm.stylesalon.com.ua/admin/shop/orderproductfield/9/
There are also 2 filters:
https://crm.stylesalon.com.ua/admin/shop/products/filters/889/control/ - Palette
https://crm.stylesalon.com.ua/admin/shop/products/filters/34/control/ - Color palette
If I understand correctly, then it takes the names in Ukrainian only from the import of orders, since in receiving product options there are only Russian names.
Can we get the parameter name not from the order, but from option_id ?
By option_id gives the name in Russian since they are given when requesting products, thus there will be no duplicates in different languages and the action that we will do will set the option correctly, because in the current example it is not will work.
19.09.2021, 23:15
Original comment available on version: ru


the option is suitable, but I don’t know what to do with the price, that is, whether to take it from the markup or not to change it, since the price is already recorded ... Here you need to think about the logic, it’s possible to provide just 2 options either to take it from the markup, or not to change it what is already entered

Decide for yourself what you need.

Today I found a problem with the options:
They are filled in on the site in two languages, respectively, when importing an order https://crm.stylesalon.com.ua/admin/customorder/order/32778/edit/ a new additional field and filter is added
Here is the field that was created https://crm.stylesalon.com.ua/admin/shop/orderproductfield/132/
And here is the field that you need to fill in https://crm.stylesalon.com.ua/admin/shop/orderproductfield/9/
There are also 2 filters:
https://crm.stylesalon.com.ua/admin/shop/products/filters/889/control/ - Palette
https://crm.stylesalon.com.ua/admin/shop/products/filters/34/control/ - Color palette
If I understand correctly, then it takes the names in Ukrainian only from the import of orders, since in receiving product options there are only Russian names.
Can we get the parameter name not from the order, but from the option_id ?
By option_id, it gives the name in Russian, as they are given when querying for products, so there will be no duplicates in different languages and the action that we will do will set the option correctly, because in the current example it will not work.

We already get them from the product options API https://docs.cs-cart.com/latest/developer_guide/api/entities/options.html, after which we fill in the product
Well, after that it is already assembled on the basis of the order - an array of corresponding additional fields and is filled in the process product
20.09.2021, 09:18
Original comment available on version: ru

Суханіцький Андрій OneBox CORP
OneBox Corp - Інтегратор
Personal license

Tyndyk Maxim Vadimovich
OneBox production
Administrator wrote:
We already get them from the product options API https://docs.cs-cart.com/latest/developer_guide/api/entities/options.html, after which we fill in the product
Well, after that it is already assembled on the basis of the order - an array of corresponding additional fields and is filled in the process product

Then where does the name in Ukrainian come from? When requesting product options, there are only Russian names

Tyndyk Maxim Vadimovich
OneBox production
Administrator wrote:
the option is suitable, but I don’t know what to do with the price, that is, whether to take it from the markup or not to change it, since the price is already recorded ... Here you need to think about the logic, it’s possible to provide just 2 options either to take it from the markup, or not to change it what is already entered
Decide for yourself what you need.

What's the score?
20.09.2021, 10:38
Original comment available on version: ru


Then where does the name in Ukrainian come from? When requesting product options, there are only Russian names

No idea, maybe they imported it somehow before?

What's the score?

Evaluation of what? I don’t see any logic in that phrase of yours - only reasoning that you yourself don’t know how you are and what needs to be done)
21.09.2021, 16:23
Original comment available on version: ru

Суханіцький Андрій OneBox CORP
OneBox Corp - Інтегратор
Personal license

Tyndyk Maxim Vadimovich
OneBox production
Administrator wrote:
Evaluation of what? I don’t see any logic in that phrase of yours - only reasoning that you yourself don’t know how you are and what needs to be done)

Make an action that will take a list of selected additional fields and based on them (for those where there are values) - write everything in the option.
+ setting to change the sale price and the incoming price (without setting - does not change the price)
+ Write options in the process product additional field similar to the setting in the products block using the table

Sukhanitsky Andrey
Integrator
Client
Integrator CRM wrote:
Tyndyk Maxim Vadimovich
OneBox production
Administrator wrote:
We already get them from the product options API https://docs.cs-cart.com/latest/developer_guide/api/entities/options.html, after which we fill in the product
Well, after that it is already assembled on the basis of the order - an array of corresponding additional fields and is filled in the process product
Then where does the name in Ukrainian come from? When requesting product options, there are only Russian names

This is a fairly recent order https://crm.stylesalon.com.ua/admin/customorder/order/32778/edit/ we talked about filling in additional fields when creating a new order, and not importing products (everything is ok with options there)
Here, the name of the additional field for the process product is taken exactly and a filter is created for it from the order - only the name in Ukrainian is indicated there. If, when creating an order and adding products to it, the system took the name by the option ID, then there would be a "Palette of colors" field.
Can you check it out?
If it works like this, then you need to redo it so that it takes the name of the option when creating a product from a product, that is, we receive an order, it contains a product, the product has "option_id": "8617"
We make an additional request in the form https://stylesalon.com.ua/api/2.0/options/8617 , we get "option_name": "Palette of colors", we are looking for such an additional field of the process product in the box, then it should work as it is now - if any fill in the value (add the option to the drop-down list), if not, create a field for it. On the issue of creating fields and writing values, I'm not sure that it works as I wrote, but now everything is correct, only the field itself takes another.
21.09.2021, 17:05
Original comment available on version: ru


Make an action that will take a list of selected additional fields and based on them (for those where there are values) - write everything in the option.
+ setting to change the sale price and the incoming price (without setting - does not change the price)
+ Write options in the additional field of the process product in the same way as setting in the product block with a table

5h

This is a fairly recent order https://crm.stylesalon.com.ua/admin/customorder/order/32778/edit/ we talked about filling in additional fields when creating a new order, and not importing products (everything is ok with options there)
Here, the name of the additional field for the process product is taken exactly and a filter is created for it from the order - only the name in Ukrainian is indicated there. If, when creating an order and adding products to it, the system took the name by the option ID, then there would be a "Palette of colors" field.

ah, well, there, based on the order data for the product $itemProduct['extra']['product_options_value'] creates / looks for a filter / additional field by option_name name and variant_name value
well, in what language it came - in that it searched / created
22.09.2021, 15:44
Original comment available on version: ru

Суханіцький Андрій OneBox CORP
OneBox Corp - Інтегратор
Personal license

Tyndyk Maxim Vadimovich
OneBox production
Administrator wrote:
ah, well, there, based on the order data for the product $itemProduct['extra']['product_options_value'] creates / looks for a filter / additional field by option_name name and variant_name value
well, in what language it came - in that it searched / created

So, the question is, can we search not by the order array, but send an additional request for each product order and get option_name and variant_name from there? Because we now have x2 filters and options that do not match the actual product options, which will not give us the opportunity to close the issue completely, because upon receipt of an order in Ukrainian, we will not be able to fill in the options
22.09.2021, 16:10
Original comment available on version: ru


So, the question is, can we search not by the order array, but send an additional request for each product order and get option_name and variant_name from there? Because we now have x2 filters and options that do not match the actual product options, which will not give us the opportunity to close the issue completely, because upon receipt of an order in Ukrainian, we will not be able to fill in the options

That is, you want based on this output:
[product_options_value] => Array
(
[0]
(
[option_id] => 18294
[product_id] => 119351
[company_id] => 1
[option_type] => S
[inventory] => N
[regexp] =>
[required] => N
[multiupload] => N
[allowed_extensions] =>
[max_file_size] => 0
[missing_variants_handling] => M
[status] => A
[position] => 0
[value] => 52163
[google_export_name_option] => not_option
[yml2_type_options] =>
[yml2_option_param] =>
[option_name] => Tone
[option_text] =>
[description] =>
[inner_hint] =>
[incorrect_message] =>
[internal_option_name] => Tone
[modifier] => 0
[modifier_type] => A
[variant_name] => Honey
[cost_price] => 0.00
)
[1]
(
[option_id] => 18295
[product_id] => 119351
[company_id] => 1
[option_type] => S
[inventory] => N
[regexp] =>
[required] => N
[multiupload] => N
[allowed_extensions] =>
[max_file_size] => 0
[missing_variants_handling] => M
[status] => A
[position] => 0
[value] => 52165
[google_export_name_option] => not_option
[yml2_type_options] =>
[yml2_option_param] =>
[option_name] => Volume
[option_text] =>
[description] =>
[inner_hint] =>
[incorrect_message] =>
[internal_option_name] => Volume
[modifier] => 0
[modifier_type] => A
[variant_name] => 40 ml
[cost_price] => 0.00
)
)
take not option_name - but make a knock at https://docs.cs-cart.com/latest/developer_guide/api/entities/options.html#get-a-... - and the value already in the order comes variant_name?
if yes, then you can make a setting in the import of orders, it will take 2 hours
22.09.2021, 16:45
Original comment available on version: ru

Суханіцький Андрій OneBox CORP
OneBox Corp - Інтегратор
Personal license
If we take the product from an example, then here at this request https://stylesalon.com.ua/api/2.0/options/8617
Will be in issue
{
"option_id": "8617",
"product_id": "67328",
"company_id": "1",
"option_type": "S",
"inventory": "N",
"regexp": "",
"required": "N",
"multiupload": "N",
"allowed_extensions": "",
"max_file_size": "0",
"missing_options_handling": "M",
"status": "A",
"position": "0",
"value": "",
"google_export_name_option": "not_option",
"yml2_type_options": "",
"yml2_option_param": "",
"option_name": "Palette of colors",
"internal_option_name": "Color Palette",
"option_text": "",
"description": "<p></p>\r\n<script>// <!--[CDATA[\r\n// ]]--></script>\r\n<p> </p>",
"inner_hint": "",
"incorrect_message": "",
"comment": "",
options: {
22.09.2021, 16:52
Original comment available on version: ru

So, did I understand you correctly? If yes, score for both items is given.
22.09.2021, 17:06
Original comment available on version: ru

Суханіцький Андрій OneBox CORP
OneBox Corp - Інтегратор
Personal license
Okay thanks
22.09.2021, 18:40
Original comment available on version: ru

Please join the conversation. If you have something to say - please write a comment. You will need a mobile phone and an SMS code for identification to enter. Log in and comment