Editing XML Feed File
Adding a new field to the feed export file
To add a new field to the export file, you can use the reserved fields custom_label_0...custom_label_4 or add a new node to the XML file.
How to add a new node
Locate a feed configuration file in the folder on your computer:
c:\Users\%USERNAME%\appdata\Local\eMagicOne Store Manager for Magento\Feeds
Open the file and find the <Fields> </Fields> section where existing fields are written.
Add a new node with the basic default values:
<Field Name="My_new_field" FieldDataType="string" FieldUse="Optional" Entity="" MaxLength="2000" Direction=""> <FieldValue ValueType="DataField" ValueData=""></FieldValue><FieldValueRegEx/></Field>
4. Save changes to the file and close it.
Upon launching the Feed Generator wizard, the new node will appear in the Feed Fields list:
Selection of store custom attributes for the feed
How to add a store custom attribute to the feed:
Locate a feed configuration file in the folder on your computer:
c:\Users\%USERNAME%\appdata\Local\eMagicOne Store Manager for Magento\Feeds
Open the file and find the <Data> </Data> section.
Select your Magento version in <SQL DBVersion=
Go to the end of the SQL query and add your piece of query like a1.attribute_code = ‘custom attribute name’ to select the attribute from your store.
Note: Export of custom attributes only works for the option Filtered simple products.
Below are the examples of the selection of attributes for Magento 2.х for the following attribute types: text_field, text_area, date, dropdown, multiplay selected, yes_no, price.
/* attribute_type_text text */
(SELECT IFNULL(N1.value, D1.value)
FROM /*PREFIX*/catalog_product_entity_varchar D1
LEFT JOIN /*PREFIX*/catalog_product_entity_varchar N1 ON (N1./*CURR_ENTITY_ID_FIELD_NAME*/ = D1./*CURR_ENTITY_ID_FIELD_NAME*/) AND
(N1.attribute_id = D1.attribute_id) AND (N1.store_id = /*SELECTED_STORE_ID*/)
WHERE (D1./*CURR_ENTITY_ID_FIELD_NAME*/ = e./*CURR_ENTITY_ID_FIELD_NAME*/) AND
(D1.attribute_id IN (SELECT a1.attribute_id
FROM /*PREFIX*/eav_attribute a1
WHERE (a1.entity_type_id = /*PRODUCT_ENTITY_TYPE_ID*/) AND
(a1.attribute_code = 'text_field') ))
AND (D1.store_id = /*ADMIN_STORE_ID*/) ) AS My_text_field,
/* attribute_type_text_area text */
(SELECT IFNULL(N1.value, D1.value) FROM /*PREFIX*/catalog_product_entity_text D1 LEFT JOIN /*PREFIX*/catalog_product_entity_text N1 ON (N1./*CURR_ENTITY_ID_FIELD_NAME*/ = D1./*CURR_ENTITY_ID_FIELD_NAME*/) AND (N1.attribute_id = D1.attribute_id) AND (N1.store_id = /*SELECTED_STORE_ID*/)
WHERE (D1./*CURR_ENTITY_ID_FIELD_NAME*/ = e./*CURR_ENTITY_ID_FIELD_NAME*/) AND(D1.attribute_id IN (SELECT a1.attribute_id FROM /*PREFIX*/eav_attribute a1 WHERE (a1.entity_type_id = /*PRODUCT_ENTITY_TYPE_ID*/) AND (a1.attribute_code = 'text_area') )) AND (D1.store_id = /*ADMIN_STORE_ID*/)
) AS My_area_field,
/* special_from_date datetime */
(SELECT IFNULL(N1.value, D1.value)
FROM /*PREFIX*/catalog_product_entity_datetime D1
LEFT JOIN /*PREFIX*/catalog_product_entity_datetime N1 ON (N1./*CURR_ENTITY_ID_FIELD_NAME*/ = D1./*CURR_ENTITY_ID_FIELD_NAME*/) AND
(N1.attribute_id = D1.attribute_id) AND (N1.store_id = /*SELECTED_STORE_ID*/)
WHERE (D1./*CURR_ENTITY_ID_FIELD_NAME*/ = e./*CURR_ENTITY_ID_FIELD_NAME*/) AND
(D1.attribute_id IN (SELECT a1.attribute_id FROM /*PREFIX*/eav_attribute a1
WHERE (a1.entity_type_id = /*PRODUCT_ENTITY_TYPE_ID*/) AND (a1.attribute_code = 'date') )) AND
(D1.store_id = /*ADMIN_STORE_ID*/)
) AS My_date,
/* attribute_type_dropdown int */
(SELECT IFNULL(N1.value, D1.value)
FROM /*PREFIX*/catalog_product_entity_int D1
LEFT JOIN /*PREFIX*/catalog_product_entity_varchar N1 ON (N1./*CURR_ENTITY_ID_FIELD_NAME*/ = D1./*CURR_ENTITY_ID_FIELD_NAME*/) AND
(N1.attribute_id = D1.attribute_id) AND (N1.store_id = /*SELECTED_STORE_ID*/)
WHERE (D1./*CURR_ENTITY_ID_FIELD_NAME*/ = e./*CURR_ENTITY_ID_FIELD_NAME*/) AND
(D1.attribute_id IN (SELECT a1.attribute_id FROM /*PREFIX*/eav_attribute a1
WHERE (a1.entity_type_id = /*PRODUCT_ENTITY_TYPE_ID*/) AND (a1.attribute_code = 'dropdown') )) AND
(D1.store_id = /*ADMIN_STORE_ID*/)
) AS My_dropdown,
/* attribute_type_multiselect varchar */
(SELECT IFNULL(N1.value, D1.value)
FROM /*PREFIX*/catalog_product_entity_varchar D1
LEFT JOIN /*PREFIX*/catalog_product_entity_varchar N1 ON (N1./*CURR_ENTITY_ID_FIELD_NAME*/ = D1./*CURR_ENTITY_ID_FIELD_NAME*/) AND
(N1.attribute_id = D1.attribute_id) AND (N1.store_id = /*SELECTED_STORE_ID*/)
WHERE (D1./*CURR_ENTITY_ID_FIELD_NAME*/ = e./*CURR_ENTITY_ID_FIELD_NAME*/) AND (D1.attribute_id IN (SELECT a1.attribute_id FROM /*PREFIX*/eav_attribute a1
WHERE (a1.entity_type_id = /*PRODUCT_ENTITY_TYPE_ID*/) AND (a1.attribute_code = 'multiplay') )) AND
(D1.store_id = /*ADMIN_STORE_ID*/)
) AS My_multiplay,
/* attribute_type_yes_no */
(SELECT IFNULL(N1.value, D1.value)
FROM /*PREFIX*/catalog_product_entity_int D1
LEFT JOIN /*PREFIX*/catalog_product_entity_int N1 ON (N1./*CURR_ENTITY_ID_FIELD_NAME*/ = D1./*CURR_ENTITY_ID_FIELD_NAME*/) AND
(N1.attribute_id = D1.attribute_id) AND (N1.store_id = /*SELECTED_STORE_ID*/)
WHERE (D1./*CURR_ENTITY_ID_FIELD_NAME*/ = e./*CURR_ENTITY_ID_FIELD_NAME*/) AND
(D1.attribute_id IN (SELECT a1.attribute_id FROM /*PREFIX*/eav_attribute a1
WHERE (a1.entity_type_id = /*PRODUCT_ENTITY_TYPE_ID*/) AND (a1.attribute_code = 'yes_no') )) AND (D1.store_id = /*ADMIN_STORE_ID*/)) AS My_yes_no,
/*attribute_type_price */
(SELECT IFNULL(N1.value, D1.value)
FROM /*PREFIX*/catalog_product_entity_decimal D1 LEFT JOIN /*PREFIX*/catalog_product_entity_decimal N1 ON (N1./*CURR_ENTITY_ID_FIELD_NAME*/ = D1./*CURR_ENTITY_ID_FIELD_NAME*/) AND
(N1.attribute_id = D1.attribute_id) AND (N1.store_id = /*SELECTED_STORE_ID*/)
WHERE (D1./*CURR_ENTITY_ID_FIELD_NAME*/ = e./*CURR_ENTITY_ID_FIELD_NAME*/) AND
(D1.attribute_id IN (SELECT a1.attribute_id FROM /*PREFIX*/eav_attribute a1 WHERE (a1.entity_type_id = /*PRODUCT_ENTITY_TYPE_ID*/) AND
(a1.attribute_code = 'price_sale') )) AND (D1.store_id = /*ADMIN_STORE_ID*/)) AS My_price,
5. Save changes to the file and close it.
Upon launching the Feed Generator wizard, the added custom attributes will appear in the Field Value dropdown list:
Custom attributes in the exported feed file:
Note: In case your database is customized in a specific way or attributes have some specifics, the standard SQL query may not work. In this case, you will have to adapt the query for your database.
Macros used for the feed generation
To create a custom SQL, you can substitute specific values for the extracts from the database.
'/PREFIX/' - store prefix;
'/SELECTED_WEB_ID/' - to specify a website;
'/DEFAULT_WEB_ID/' - to specify the default website;
'/SELECTED_GROUP_ID/' - to specify a store;
'/SELECTED_STORE_ID/' - to specify the default;
'/ID_ATTRIBUTES/' - list attributes separating them by a coma. (9,12,13,17, ...);
'/USE_SKIP_LINK/' - IsSkip = ' OR (e.type_id <> "configurable")';
Not IsSkip = ' OR (e.type_id = "configurable")';
'/website_id = DEF_WEB_ID/' - to support websites in the Inventory;
'/website_id = SELECTED_WEB_ID/' - to support websites in the Inventory;
'/PRODUCT_ENTITY_TYPE_ID/' - to specify entity_type_id //* By default entity_type_id = 4;
'/*ATTR_MEDIA_GALLERY_ID/'* - to specify attribute "media_gallery" //* By default attribute_id = 90
'/ADMIN_WEB_ID/' - Admin Website = 0;
'/DEF_WEB_ID/' - Default Website;
'/ADMIN_GROUP_ID/' - Admin Store = 0;
'/DEF_GROUP_ID/' - Default Store;
'/ADMIN_STORE_ID/' - Admin StoreView = 0;
'/DEF_STORE_ID/' - Default StoreView;
'/DEF_STOCK_ID/' - Default Stock = 0;
'/DEF_STOCK_CODE/ - Default Stock code = 'Default';
'/NOW/' - returns current time and date as the SQL function = NOW() );
'/STATE_FILTER/' - for the Magento version with MSI, returns '(alias.created_in = 1)';
'/CURR_ENTITY_ID_FIELD_NAME/' - depends on the Magento version with 'Sequence', returns - 'row_id';
'/DEFF_ENTITY_ID_FIELD_NAME/' - always 'entity_id';
/<PRODUCT_ENTITY_TYPE_[name]>/ - returns "Entity Type" for the "name" attribute, [text|varchar]
/<PRODUCT_ENTITY_TYPE_[short_description]>/ - returns "Entity Type" for the "short_description" attribute, [text|varchar]
/<PRODUCT_ENTITY_TYPE_[description]>/ - returns "Entity Type" for the "description" attribute, [text|varchar]
/<PRODUCT_ATTRIBUTE_NAME>/ - returns SQL, to return value for the "name" attribute
/<PRODUCT_ATTRIBUTE_SHORT_DESCRIPTION>/ - returns SQL, to return value for the "short_description" attribute
/<PRODUCT_ATTRIBUTE_DESCRIPTION>/ - returns SQL, to return value for the "description" attribute
/<PRODUCT_MSI>/ - Multi Stock Inventory (MSI), returns complete SQL