Import / Export data via API CMS Horoshop
Downloading a product catalog from a site based on CMS Horosop using the API
To get your product catalog from the CMS Horoshop website, open the shortcut "Download products to catalog" on your desktop
Specify a link to access the API in the form https://your-domain/api/
Login and password - you need to create in the admin panel of the Horoshop site, tab Settings-Admins and then specify them in the program settings.
If you need to download data from the site also in Ukrainian, then add a new language if it is not available in the language directory
Uploading a product catalog from Elbuz to a site based on CMS Horosop using the API
To update the site running on the basis of CMS Horoshop, open the shortcut "Upload product catalog" on the desktop
Create a new template, to do this, click the + button and select "CMS Good API" from the list
Open template for editing
Specify a link to access the API in the form https://your-domain/api/
Login and password - you need to create in the admin panel of the Horoshop site, tab Settings-Admins and then specify them in the program settings.
To select the fields that will be updated on the site, click the "Fields unloading settings" button and check the "Update" flag for the required fields.
Required fields that are always updated when the site is updated, regardless of the "Update" flag set in the program settings:
- Product article (article)
- Parent article article (parent_article)
- Product name (title)
- Product modification name (mod_title)
- Product category (parent)
In the "Formula" column, you can specify logical conditions and macro substitutions of fields from where you want to take values for products, a list of all macro substitutions can be obtained in "Setting the grid of the base catalog". It is also possible to specify fields taking into account the language, two languages are available - Russian and Ukrainian, prefixes are used for them:
- pd_ru - Russian
- pd_ua - Ukrainian
and a list of fields for them:
- name - product name
- description_short - short product description
- description_full - full description of the product
- meta_description
- meta_keyword
- meta_title
- seo_h1
- tag
To specify a macro substitution in the "formula" field, taking into account languages, you must specify it in this form (prefix. field name)
pd_en. name
Please note that in order to use macro substitutions for the Ukrainian language, you need to add the Ukrainian language in the language reference.
Removing extra levels of product categories (sections) when updating the site
When receiving a product catalog from the site via the API, the entire structure of the site sections is loaded, as a result, the product categories are located along with such sections as "Contacts", "About Us", "News", in fact, the API gives not only the product categories, but also all the information about sections, while there is no mark that this is a section or category of goods, because of this there is a problem when updating the site and adding new products to the CMS Horosop site via the API.
An example of the structure obtained from the site
All products will be in the section "My site / Product catalog / . . . "
When refreshing the site, you will receive an error message "Category not found, or an invalid template was specified in the category. " As a result, we received the data in the form that the site gave, but the site does not accept the same data back!
To fix the problem, in the settings for uploading to the CMS Horoshop site, through the API, register the formula for removing extra levels of sections for the "Category" field
Formula: TRIM(REPLACE({BK product: Category}, "My site / Product catalog /", ""))
You need to substitute your values in the formula because they will differ from our example.