0

I'm implementing an endpoint where the users can create products from a CSV, using the same logic that Magento implements in the backend to import CSV seems to work great but I have a problem, the options for the attributes came in another language and the validation says that the value is wrong.

For example the visibility options are defined in here:

public static function getOptionArray()
{
    return [
        self::VISIBILITY_NOT_VISIBLE => __('Not Visible Individually'),
        self::VISIBILITY_IN_CATALOG => __('Catalog'),
        self::VISIBILITY_IN_SEARCH => __('Search'),
        self::VISIBILITY_BOTH => __('Catalog, Search')
    ];
}

When it returns to the validation function instead of saying "Catalog, Search" it says "Catálogo, Búsqueda" translating the value to es_ES when I need it in en_US which is the native option.

I tried setting in the URL the {{host}}/rest/all/V1/import/custom-products but keeps giving me the es_ES is the locale defined to the store view and not the global locale

Another thing that I tried was to set the store in the store management but didn't work.

If I remove the translation of the value works, but now when I access to the backend and change the language has the wrong translation

Does any have an idea?

1 Answer 1

0

To access different stores you should specify the store code in the URL. Try

{{host}}/rest/es_ES/V1/import/custom-products or {{host}}/rest/en_US/V1/import/custom-products

instead of "all"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.