Magento Extensions:Magento Product Export Module

From XTENTO Support Wiki
Jump to: navigation, search
This is a guide for Magento 1. For Magento 2 extensions and guides, please refer to Magento 2 Guides.

Prodexport450 noborder.png
Buy-now.png

Contents

Overview

Product Export functionality for Magento, integrated into the Magento Backend, including an export manager and a highly flexible output creation technique. Export your products in almost any format and connect your store to ERPs, stock systems, marketplaces, shopping engines, price comparison sites and more. Supports an unlimited amount of export profiles, exporting to an unlimited amount of remote/local destinations, including FTP Servers, SFTP Servers, E-Mail Recipients, HTTP Servers and Webservices/APIs.

Interested in this Magento Extension?

Head over to our store to purchase this extension: Magento Product Export Module

Got questions? Feel free to contact us! Contact Form

Setting up the extension

After installing the extension as instructed in our general installation guide, please go to System > XTENTO > Product Export Configuration. Please enter your license key there and set Module Enabled to "Yes".

Configuring the extension

Export Profiles

Export Profiles
Editing an export profiles

Export profiles can be set up for manual and automatic exports. Every profile contains information about the data to export (i.e. products/categories), the output format, when, how, and where to export to, as well as some other settings. The extension supports an unlimited amount of different profiles.

To set up new export profiles or to modify existing export profiles, please go to Catalog > Product Export > Export Profiles.

Setting up a new export profile is easy. Press the "Add New Profile" button. You will then be asked to select the entity (date type, i.e. products/categories) to export, as well as to assign a name to the profile which can be used to identify the export profile in export logs. Press the Continue button.

You will then be presented with the profile configuration. The configuration of export profiles is split into several different sections ("tabs") which are explained below.

1) General Settings

General Configuration
Name: Enter the name of the profile. This name will show up in execution logs and will be used to identify the profile when exporting manually.
Enabled: If set to "No", this profile won't show up for manual exports nor will automatic exports be made.
Export Type: Can't be changed after profile creation. Defines which entity (data type) gets exported. Available entities:

 Entity  Description
Products Export products
Categories Export categories

Export Settings
Save local copies of exports: If set to yes, a copy of every export made will be saved in the ./var/product_export_bkp/ directory. This is especially useful if you're exporting to FTP destinations, because only then if this is set to "Yes" a local copy of the exported file will be kept so you can download it in Magento from the execution log or directly from the Magento server for whatever reason. Default value is "Yes".

2) Export Destinations

Select the export destinations where exported files should be saved/sent to after exporting simply by checking the checkbox right before the Destination ID.

Please refer to the Export Destinations section below to get an idea how to configure and set up destinations.

3) Output Format

This section defines the output format the profile will create. The extension uses so called XSL Templates to create output formats.

XSL Template

>>> Don't want to create the XSL Template yourself? Have us create the XSL Template for you - we will take care of the output format creation for you. Check out our XSL Template Creation Service. Please contact us before you purchase the XSL Template Creation Service. <<<

When exporting, internally a XML document is created by the module that contains ALL information about the exported objects: product data, links, image links and so on. A so called XSL Template then gets applied to this XML document, transforming the XML data into (almost) any other output format. The XSL Template basically "translates" the XML document into whatever output format you require. It is possible to create CSV, XML, ASCII, TXT, ... formats - just any format that is based on text.

The fields available for export (and thus the names used to access them in XSL Templates) can be found by clicking the Show fields available for export button in the Output Format section. A new window will open where the fields and the level they are on (object level, product level, ...) can be seen. At the very top of the window that was opened, a link called "Show raw XML" can be found which shows the internal XML we talked above. This is the XML document that gets "transformed" by the XSL Template.

A basic XSL introduction can be found here: http://www.w3schools.com/xsl/

Template Structure

We have modified the concept of XSL Templates slightly. In order to be able to create multiple output files with one profile, we have added <file> nodes to the XSL Template structure. Each XSL Template is contained in a <file> node, and multiple <file> nodes under the <files> node will create multiple output formats. Your XSL Templates structure should look like this:

<?xml version="1.0"?>
<files>
<file filename="export-%exportid%.csv">
...XSL Template here...
</file>
</files>

This would create one output file named export-%exportid%.csv where %exportid% is a variable and would get replaced with the export ID. If you wanted to create multiple output files, you would simply add another <file> node so it would look like this:

<?xml version="1.0"?>
<files>
<file filename="export-%exportid%.csv">
...1st XSL Template here...
</file>
<file filename="export2-another-file.csv">
...2nd XSL Template here...
</file>
</files>

Variables in the <file> node

There are two parameters for <file> nodes:

 Variable  Description
 %d% Todays Date: Day (Two-Digit)
 %m% Todays Date: Month (Two-Digit)
 %y% Todays Date: Year (Two-Digit)
 %Y% Todays Date: Year (Four-Digit)
 %h% Current Time: Hour (Two-Digit)
 %i% Current Time: Minute (Two-Digit)
 %s% Current Time: Second (Two-Digit)
 %lastentityid% The entity_id of the last/newest object contained in the output file
 %collectioncount% The count of objects contained in the output file
 %uuid% Random Unique ID, refer to: http://php.net/manual/en/function.uniqid.php
 %exportid% The ID of the export / execution log. Ever-incrementing and unique.

search="," replace=";"

<file filename="MyFileName.csv" quotes="remove">

This would remove all quotes from field values.

XSL Template Structure

As explained above, XSL Templates are contained in <file> nodes. The XSL Template will create the actual output file created for the <file> node. Let's have a look at every line of a sample XSL Template in detail, explanations after every line. A (simple) CSV export template for the extension could look like this:

<?xml version="1.0"?> <!-- XML Declaration, leave as is -->
<files> <!-- Files node, can contain multiple <file> nodes, each defining one output format -->
<file filename="export_%d%_%m%_%Y%.csv"> <!-- File node, contains the actual XSL Template, with parameters filename and encoding (optional) -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:php="http://php.net/xsl"> <!-- The XSL Template begins here. Namespaces get defined. Leave as is. -->
<xsl:output method="text" encoding="UTF-8"/> <!-- The xsl:output directive defines settings that apply to the whole XSL Template. Method can be set to xml for example, encoding will be output for XML files into the XML declaration of the file. More parameters can be found here: http://www.w3schools.com/xsl/el_output.asp -->

<xsl:variable name="sepstart" select="'&#34;'"/> <!-- A variable that can be accessed using $sepstart in the XSL Template. It contains &#34; which is the representation of the " character. -->
<xsl:variable name="sepend" select="'&#34;,'"/> <!-- Again, a variable. This time with the " character as well as a comma. Whenever it is called, it will output: ", -->

<xsl:template match="/">

<xsl:text>"SKU","Quantity"&#xD;&#xA;</xsl:text> <!-- This is the header line of the CSV file. It gets output once only, the &#xD;&#xA; characters represent a line break that gets output after the header line. -->

<xsl:for-each select="products/product"> <!-- for-each means that the template will loop through the products/product nodes in the XML processed. So for every object (product, ...) the code below will be applied. -->
<!-- Output the following on a separate line for each object exported: -->

<xsl:value-of select="$sepstart" /><xsl:value-of select="sku"/><xsl:value-of select="$sepend" /> <!-- The $sepstart variable outputs " to start a new field in the CSV file. Then using xsl:value-of select="sku" the "sku" field is pulled from the object level. The $sepend variable then outputs ", to denote the end of the field in the CSV file. -->
<xsl:value-of select="$sepstart" /><xsl:value-of select="round(qty)"/> <!-- Get the "qty" (in stock) field on item level and apply the round() function to it. --><xsl:value-of select="$sepend" />

<xsl:text>&#xD;&#xA;</xsl:text> <!-- Output a line break. -->
</xsl:for-each> <!-- End object foreach -->

</xsl:template>
</xsl:stylesheet>
</file>
</files>

This template would create one output file, called export_day_month_year.csv. It would contain one header row (defining the fields, it's optional, just so you can view column names in Excel for example), and would then loop through each <object>s <item> in the XML processed, creating one line in the CSV file for each item ordered.

Calling PHP functions in XSL Templates

Attention: When upgrading the module to version 1.9.11 or newer: The ability to execute PHP functions via XSL has been restricted. PHP functions must be whitelisted now, and only certain functions are allowed out of the box. If you want to whitelist your own functions, you can do so in the ProductExport/Model/Output/Xsl.php file - look for "$allowedPhpFunctions" there. If you don't do this, php:functionString will simply return an empty string for not-whitelisted functions. To do this in an extendable way, use the "xtento_productexport_load_allowed_php_functions" event in the GLOBAL area. Important: Any functions you want to call from within XSL must be defined as public static functions in your helper file.


It is possible to call PHP functions in XSL Templates.

Important: In order to be able to call PHP functions in the XSL Template, please make sure your <xsl:stylesheet> tag in the XSL Template looks like this: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:php="http://php.net/xsl">

You can now call PHP functions in your XSL Template.

Sample call for PHP function "FUNCTIONNAME" with two parameters:

<xsl:value-of select="php:functionString('FUNCTIONNAME', 'parameter1', 'parameter2')"/>

Examples:

<xsl:value-of select="php:functionString('number_format', price, 2, '.', '')"/> <!-- This would call the PHP number_format function on the price field --> <xsl:value-of select="php:functionString('substr', sku, -10)"/> <!-- This would call the PHP substr function on the sku field -->


An often used function is date, to format the date the product was created for example.

<xsl:value-of select="php:functionString('date', 'd/m/Y H:i:s', created_at_timestamp)"/>

It is also possible to call Mage::getStoreConfig from the XSL Template. Example:

<xsl:value-of select="php:functionString('Mage::getStoreConfig', 'tax/display/type', store_id)"/>

Static values

It is possible to output text (for example static values) like this in the XSL Template:

<xsl:text>Whatever you want to output goes here.</xsl:text>

This will be output as-is in the output file.

Mapping fields (if then, if then, ... else)

It is also possible to map fields and output other values based on the results of the "if" conditions.

A sample mapping would look like this: <xsl:choose>
<xsl:when test="field='abc'"><xsl:text>output this text</xsl:text></xsl:when>
<xsl:when test="field='xyz'"><xsl:text>output something else</xsl:text></xsl:when>
<xsl:otherwise><xsl:text>nothing matches, output this</xsl:text></xsl:otherwise>
</xsl:choose>

This evaluates the value of the "field" field. If it's abc or xyz, it matches one of the xsl:when lines. If it doesn't match any condition, the xsl:otherwise value is output.

Conditional statements (if then ...)

For "if then, if then, ... else" conditions have a look at "Mapping fields" above.

A simple if then condition can be set up like this: <xsl:if test="attributexyz='abc'"><xsl:text>output this text if attribute with attribute code 'attributexyz' is exactly abc</xsl:text></xsl:if>


A condition to output a value if the price is greater or equals 10 and lower or equals 20: <xsl:if test="price &gt;= 10 and price &lt;= 20"><xsl:text>the price is between 10 and 20</xsl:text></xsl:if>

Sample for a negotiated condition: <xsl:if test="not(attributexyz='abc')"><xsl:text>output this text if attributexyz is NOT abc</xsl:text></xsl:if>

Arithmetic operations / Calculations

It is possible to calculate values based on fields in the XSL Template. The following arithmetic operations can be used:

 Arithmetic Operator  Description
+ Addition, e.g. <xsl:value-of select="subtotal + custom_field"/>
- Subtraction, e.g. <xsl:value-of select="grand_total - tax_amount"/>
* Multiplication, e.g. <xsl:value-of select="subtotal * 1.19"/>
div Division, e.g. <xsl:value-of select="subtotal div custom_field"/>
Note: You cannot use / for divisions. The "div" operator must be used.
mod The "modulo" operator can be called like this to get the remainder of a division: <xsl:value-of select="position() mod 2"/>
Replacing characters in all fields

You can define certain characters that get replaced in ANY field. This can be important for example if you want to set up a CSV format, where no comma or semi-colon may show up in field values.

Setting this up is easy. In your XSL Template, modify your <file> node like this: <file filename="file_name.csv" search=",;" replace="--">

This would replace both commas as well as semi-colons with dashes. The first parameter search defines which characters you want to replace. The second parameter replace defines with which character these characters get replaced.

Using the parameter "indent" to not to get the XML output format exported on one line

Simply add the "indent="yes" to the <xsl:output> tag like this: <xsl:output method="xml" encoding="utf-8" indent="yes"/>

Sorting the elements in the output

Using xsl:sort you can sort the elements in the output. This sample code would sort the products by price, from the highest price to the lowest price using the parameter order="descending".

<xsl:for-each select="items/item">
<xsl:sort select="price" order="descending"/>
<xsl:value-of select="$sepstart" /><xsl:value-of select="price" /><xsl:value-of select="$sepend" />
</xsl:for-each>

To use xsl:sort to output the price of the cheapest child product:

<xsl:for-each select="child_products/child_product">
<xsl:sort select="price"/>
<xsl:if test="position()=1">
<xsl:value-of select="price" />
</xsl:if>
</xsl:for-each>

Outputting custom date/time formats

If you want to output the product creation date in a custom date format, do it like this:

<xsl:value-of select="php:functionString('date', 'Y-m-d', created_at_timestamp)"/>

You can pass any parameters of the date variable there.

Date calculations

It is also possible to add 1 day to the product creation date for example.

<xsl:value-of select="php:functionString('strftime', '%Y-%m-%d', php:functionString('strtotime', concat(php:functionString('date', 'Y-m-d', created_at_timestamp), ' +1 day')))"/>

Currency Converter

Converting prices/amounts in the XSL Template into a different currency is possible.

Attention: The export will fail silently if the currency you try to convert to does not exist as a "allowed currency" at System > Configuration > Currency Setup. Also, you need to import currency rates at System > Manage Currency Rates.

If your base currency (i.e. the currency in which prices are stored) is EUR, and you would like to convert the "price" field to GBP, you'd do it like this:

<xsl:value-of select="php:functionString('number_format', php:functionString('Xtento_ProductExport_Helper_Xsl::currencyConvert', price, 'EUR', 'GBP'), 2, '.', '')"/>

If you want to convert from the base currency into the stores currency (the currency of the store the profile is exporting) automatically, use this:

<xsl:value-of select="php:functionString('number_format', php:functionString('Xtento_ProductExport_Helper_Xsl::currencyConvert', price, php:functionString('Mage::getStoreConfig', 'currency/options/base', '0'), php:functionString('Mage::getStoreConfig', 'currency/options/default', store_id)), 2, '.', '')"/>

Creating CSV formats using XSL

Please refer to the sample XSL Templates.

Creating TAB delimited formats using XSL

Use a CSV XSL Template to start. You only have to replace the delimiter in the header line and adjust the sepstart and sepend variables.

The sepstart and sepend variables located at the top of the template need be set like this: (&#09; is the tab character)

<xsl:variable name="sepstart" select="''"/>
<xsl:variable name="sepend" select="'&#09;'"/>

Also if this was your header line: <xsl:text>SKU,Qty,Color</xsl:text><xsl:text>&#xD;&#xA;</xsl:text>

You would simply replace all the commas with &#09; as well so it would look like this:

<xsl:text>Sku&#09;Qty&#09;Color</xsl:text><xsl:text>&#xD;&#xA;</xsl:text>

Creating XML formats using XSL

Please refer to the sample XSL Templates.

Creating ASCII formats using XSL

Creating fixed-length formats is possible as well using XSL.

Using the PHP sprintf function which can be called from the XSL Template, fixed length fields can be set up. Example:

<xsl:value-of select="php:functionString('sprintf', '%-10.10s', 'ABC')"/> <xsl:value-of select="php:functionString('sprintf', '%-7.7s', ../../sku)"/>

This would output two fields, the first being 10 characters long (and cut off if longer than 10 chars) and expanded with spaces, and the second being 7 characters long containing the sku cut off after 7 characters, and if shorter, expanded with spaces.

Testing your template

When editing your profile and working on your XSL Template, you can easily test the template you created by going to Output Format > XSL Template . Just paste your XSL Template and press the Test XSL Template button. Errors will be displayed, if the template is well-formed, the output file(s) created will be displayed. You can also use the editor there to develop your XSL template.

Don't want to create the XSL Template yourself? Have us create the XSL Template for you - we will take care of the output format creation for you. Check out our XSL Template Creation Service.

Ready-to-use and sample XSL Templates
Sample XSL Templates

Sample XSL Templates can be downloaded here: Sample Templates

Use them as references to learn XSL and to build your own XSL Template.

Free ready-to-use XSL Templates

NEW: Use our 1-click-wizard to set up your feeds! Simply go to Catalog > Product Export > Export Profiles and set up a new profile. Feed wizard will guide you through the process.

The template wizard requires an authentication, you have to be logged in to xtento.com or you can use the composer user name as described here: Feed Wizard Composer Authentication

Our free templates can be downloaded and installed in your Magento store easily. Please click here: All integrations

Simply click on the integration logo you're interested in and download the XSL Template at the bottom of the page.

Then simply go to Catalog > Product Export > Export Profiles, set up a new export profile, and paste the XSL Template into the "Output Format" tab. That's it!

A guide on how to set up the Google Shopping Feed can be found here: Google Shopping Setup

Adding own export classes / Rewriting existing export classes

You can create own export class and register them in the export module.

Take a look at the \app\code\local\Xtento\ProductExport\Model\Export\Data\Custom\Product\ folder to see how custom classes can be set up.

Rename the file etc/xtento/export_data.own.xml.sample to etc/xtento/export_data.own.xml and insert the following export class:

<config>
<data>
...
<custom123>
<class>xtento_orderexport/export_data_custom_product_custom123</class>
</custom123>
...
</data>
</config>

This would call the Custom123 class in the above "Custom\Product" folder.

This file manages registered export classes. Make sure to not use identifiers which already exist in the export_data.xml file, unless you want to rewrite export classes.

4) Stores & Filters

Filters

Filters set up will be applied to both manual as well as automatic exports.

Filters
Item filters

Hidden Product Types: The selected product types won't be exported and won't show up in the output format for this profile. You can still fetch information from the parent product in XSL using the parent_item/ node.

"Export only if the following conditions are met" filter

It is possible to set up almost any filter in addition to the above filter using the "Export only if the following conditions are met" section. You can set up complex filters there, for example only export if an item was found where the price is greater than 0 and if the color is Green.

It is also possible to set up filters in XSL, which is faster:

<xsl:if test="manufacturer='X'">...whole value-of select fields go here...</xsl:if> <!-- This will only output products where the product attribute manufacturer is "X". -->


If you have memory/performance issues, here are our recommendations:
- If memory usage is a problem, do NOT use XSL filters for large product catalogues. Instead, use the "Export product only if..." filter in the Stores & Filters tab. This will make the export slower, but there are no memory issues. Good for large catalogues.
- If memory usage is no problem and you want a fast export, filter via XSL instead. It's faster, but requires more RAM. Good for smaller catalogs.

Performance Settings

Using the "Product attributes to export" selector you can select which product attributes are *available* for exporting. Please note this does not control the fields exported, instead, fields exported are controlled by your XSL Template. This setting is only used to load less attribute when loading the product collection, and thus to speed up the export. In general, you won't need to use this setting unless you have performance issues. Attention, if used, only the selected product attributes can be used in your XSL Template.

5) Manual Export

These settings only apply to manual exports.

Save files on destinations for manual exports: Do you want to save exported files on the configured export destinations when exporting manually? Or do you just want them to be saved on the configured export destinations for automatic exports? This is especially useful if you want to use the manual export without sending export files to the configured FTP/HTTP/whatever destinations.

6) Automatic Export

Any filters set in the "Filters / Actions" section will be applied when exporting automatically. It is possible to set up cronjob exports as well as event-based exports for one profile.

Cronjob Export

If you want to automate exports, you can set up cronjobs for profiles which execute the export for this profile at certain times automatically. First of all, make sure to set up your Magento cronjob as explained here. You can easily control the cronjob status right from the export module, by going to "Cronjob Export" when editing a profile. The Cronjob Status field will contain information about the status of the cronjob and whether any action is required or not.

To enable cronjob exports for this profile, simply set Enable Cronjob Export to "Yes". Select the Export Frequency of how often you want the export to run. That's it.

It is also possible to set up multiple, different cronjobs for one profile, for example if you wanted the cronjob to run at certain times during the week and only at 10pm on weekends. To do so, select "Use custom export frequency" from the Export Frequency dropdown, and enter one or more cron expressions separated by a semi-colon (;) in the Custom Export Frequency field. You can enter an unlimited amount of cron expressions there separated by semi-colons, just make sure they are valid cron expressions.

Example custom cron expression calling the cronjob for a profile at 8am, 1pm, 3pm at every full hour from Monday to Friday: 0 8,13,15 * * 1-5

Further examples:

Minute Hour Day Month Weekday Cron Expression Description
0 0 * * * 0 0 * * * Every day at 00:00
5 * * * * 5 * * * * Five minutes after every full hour
*/5 * * * * */5 * * * * Every 5 minutes
59 23 * * 0 59 23 * * 0 Every Sunday (Sunday can be 0 or 7) at 11:59pm
20,30 1 * * 1-5 20,30 1 * * 1-5 Monday to Friday at 01:20am and 01:30am
0 1 1-7 12 1 0 1 1-7 12 1 From Dec 1 to Dec 7, as well as on every Monday in December at 00:00

Important: Automated exports will only be made if the profiles status (under General Configuration) is "Enabled".

Event-based Export

Magento dispatches events to Magento modules when certain things happen. For example, Magento would dispatch an event after the product has been saved. The export module is able to "listen" and wait for these events, and once they've been called, to export data.

In the Automatic Export tab of a profile you can select the events the profile should be exporting upon. Simply select the checkboxes of events you want to export upon and save the profile. Whenever one of these events get called, the profile will export just this one object that the event refers to: For example the product that was created. In addition, any filters set up at Filters / Actions in the profile will be taken into account.

The following events are available for exporting out of the box:

 Event  Available for exports of  Description
catalog_product_save_after Products Called whenever a product is saved in Magento, i.e. also when it's modified. Note: Products get saved in Magento quite often. To avoid multiple exports using this event, set Export only new products at Filters / Actions to "Yes".
catalog_category_save_after Categories Called once after a category has been saved.

Important: Automated exports will only be made if the profiles status (under General Configuration) is "Enabled".

7) Profile Execution Log

The profile execution log shows any exports made using this profile, be it manual or automatic. It is also possible to download the exported files, however, only if Save local copies of exports is set to "Yes" under General Configuration.

8) Profile Export History

This section shows which objects (products, categories) were exported by this profile and when. If the Export only new objects filter is set to "Yes", you should only see every object once per profile there. If you want to re-export an object that has been already exported and is not exported because Export only new objects is set to "Yes", you can remove the entry from the export history grid by selecting Delete Entry.

Export Destinations

Export Destinations
Editing an export destination

Export destinations are the actual "destinations" where exported files will be sent to/saved on. If your only goal is to manually export and download products from the Magento backend, you won't need to set up any export destinations. If you have to send exported files to remote FTP servers or certain local directories on the Magento servers, you will have to set up export destinations.

The module supports an unlimited amount of different export destinations. The following destination types are supported:

 Destination Type  Description
Local Directory Exports get saved in a local directory on the Magento server
FTP Server Exports get sent to a remote FTP(S) server
SFTP Server Exports get sent to a remote SFTP server. Supports SFTPv3 only.
HTTP Server Exports get sent to remote HTTP servers by sending a POST request for example
E-Mail Recipient(s) Exports get sent to email recipients, with the exported files attached
Webservice/API Exports get sent to webservices/API. The webservice/API code must be set up by you.
Custom Code / Custom Class Exports can be handled by a custom class you can set up. This class could parse and modify, and then send the exports for example.

Setting up Export Destinations

To set up export destinations, go to Catalog > Product Export > Export Destinations. You can modify existing destinations there or add new destinations.

Setting up a new export destination is easy. Press the "Add New Destination" button. You will then be asked to select the destination type (to which type of "server" the exported files will be sent to) to create, as well as to assign a name to the destination which can be used to identify the destination in export profiles and logs. Press the Continue button. You will then be presented with the destination configuration.

Destination Types

Local Directory

This destination type will simply save the exported file in a local directory on the Magento server.

If you begin the path with a dot in front of it, for example ./var/productexport/ the path will be relative to the Magento root directory. This means the file would be saved in the /var/productexport/ directory located in the root directory of Magento.

Supplying an absolute path is possible by beginning the path with a dash, for example: /var/www/tmp/export/

Please make sure the path you enter is writable by the webserver. It must be possible for the webserver to save the file in that directory, otherwise a warning will be shown/logged.

How to get a "(HTTP) Link" to your feed

Assuming you have set up your export profile already, your shopping engine may now request the link to your feed, from where they can download it. Setting this up is easy.

Now whenever you run an export, the file that was exported gets saved in the "feeds" folder in the root directory of Magento. Assuming the file created by your export profile is called "test.xml", the URL to your feed would then be: http://www.yourshop.com/feeds/test.xml

You can of course automate creation using a cronjob, see below in the wiki for more information.

FTP Server

The FTP destination type supports uploading files to FTP servers.

The following configuration must be entered for FTP servers:

 Field Name  Description
IP or Hostname Enter the hostname (address) or IP address of the FTP server you want to upload files to
Server Type You can select FTP or FTPS server types. Please note that FTPS (FTP "with SSL") is only supported if PHP has been compiled with OpenSSL support and also the PHP implementation is quite picky with regards to which servers it supports.
Port Enter port of FTP server. This is port 21 usually.
Username Enter the username used to log into the FTP server
Password Enter the password used to log into the FTP server
Timeout Connection timeout in seconds after which the connection will fail
Enable Passive Mode If your server is behind a firewall, or if the extension has problems uploading the exported files, please set this to "Yes".
Export Directory Enter the directory into which files should be uploaded to
Potential issues: Connection/upload fails
SFTP Server

The SFTP (Secure File Transfer Protocol) destination type is identical with the FTP destination type, except that it sends files to a SFTP server. This destination type supports SFTPv3 servers only. To find out which SFTP server version your server is using, connect to it using WinSCP (download here and look at the very bottom status bar. It will show the SFTP server version.

Most of the time port 22 is used for SFTP servers.

Potential issues: Connection/upload fails
HTTP Server

To export data to a HTTP server, please follow the following steps:

  1. Go into the app/code/local/Xtento/ProductExport/Model/Destination/ directory and rename the file "Http.php.sample" to "Http.php"
  2. Enter the function name you want to call in the Http.php class in the field below.
  3. Open the Http.php file and add a function that matches the function name you entered. This function will be called by this destination upon exporting then.

Example: If you enter server1 in the function name field below, a method called server1($fileArray) must exist in the Http.php file. This way multiple HTTP servers can be added to the HTTP class, and can be called from different export destination, separated by the function name that is called. The function you add then gets called whenever this destination is executed by an export profile.

Important: Please make sure the function you enter exists like this in the app/code/local/Xtento/ProductExport/Model/Destination/Http.php file: public function yourFunctionName($fileArray) { ... }

Potential issues: Connection fails
  1. Please go through the steps above one or two more times again to make sure you really set it up exactly as explained.
  2. Please make sure there is no firewall blocking outgoing HTTP connections. Get in touch with your hoster if in doubt.
E-Mail Recipient(s)

This destination type simply sends an email to the configured recipients, with the exported files attached.

The following configuration must be entered for this destination type:

 Field Name  Description
E-Mail From Address Enter the email address that should be set as the sender of the email, i.e. what shows up in the "From" field
E-Mail Recipient Address Enter the email address where exported files should be sent to. Separate multiple email addresses using a comma. Example for two email addresses: [email protected],[email protected]
E-Mail Subject Subject of email. Available variables: %d%, %m%, %y%, %Y%, %h%, %i%, %s%, %exportid%
E-Mail Text Email text (body text). Available variables: %d%, %m%, %y%, %Y%, %h%, %i%, %s%, %exportid%, %content% (%content% contains the data generated by the export)
Potential issues: No emails are sent
  1. Please make sure whether normal Magento emails are sent or not. If you don't receive an order confirmation from Magento either, the email function is probably broken and this is a problem not related to the extension
  2. Please try to send the export emails to your email address instead to test if you receive them or if it's a problem with the intended recipient of the email.
Webservice/API

To export data to a webservice, please follow the following steps:

  1. Go into the app/code/local/Xtento/ProductExport/Model/Destination/ directory and rename the file "Webservice.php.sample" to "Webservice.php"
  2. Enter the function name you want to call in the Webservice.php class in the field below.
  3. Open the Webservice.php file and add a function that matches the function name you entered. This function will be called by this destination upon exporting then.

Example: If you enter server1 in the function name field below, a method called server1($fileArray) must exist in the Webservice.php file. This way multiple webservices can be added to the Webservice class, and can be called from different export destination, separated by the function name that is called. The function you add then gets called whenever this destination is executed by an export profile.

Important: Please make sure the function you enter exists like this in the app/code/local/Xtento/ProductExport/Model/Destination/Webservice.php file:

public function yourFunctionName($fileArray) { ... }

Potential issues: No connection
  1. Please go through the steps above one or two more times again to make sure you really set it up exactly as explained.
  2. Please make sure there is no firewall blocking outgoing HTTP connections. Get in touch with your hoster if in doubt.
Sample Code / Sample Implementations

Please refer to this article for sample code & further information on how to connect Magento to custom REST/JSON/SOAP/... APIs.

Custom Code / Custom Class

You can set up an own class in our (or another) module which gets called when exporting. The saveFiles($fileArray) function would be called in your class. If your class was called Xtento_ProductExport_Model_Destination_Myclass then the identifer to enter here would be xtento_productexport/destination_myclass

Please make sure the following function exists in your custom class: public function saveFiles($fileArray) { ...your code here... }

Logging errors in the profile log for custom destinations

If you developed a custom class or set up a custom webservice/HTTP connection function, and in case of errors want to log them in the execution log, you can access the log entry like this to add a warning for example:

$logEntry = Mage::registry('product_export_log');
$logEntry->setResult(Xtento_ProductExport_Model_Log::RESULT_WARNING);
$logEntry->addResultMessage(Mage::helper('xtento_productexport')->__('Destination "%s" (ID: %s): %s', $this->getDestination()->getName(), $this->getDestination()->getId(), 'Something went wrong'));

Enabling Export Destinations in Profiles

To associate created export destinations to export profiles, open an export profile and go to the Export Destinations tab and select the export destinations where the file should be sent to by selecting the checkbox in front of it. Then save the profile.

You can associate an unlimited number of destinations to a profile.

Using the extension

The following functions can found at Catalog > Product Export.

Manual Export

Manual Export Screen

Exporting objects manually is easy. After configuring the extension and creating profiles, just go to Catalog > Product Export > Manual Export.

First of all, select the profile you want to export. You can select from product export profiles and category export profiles, depending on which profiles you set up.

There are several different filters available now to narrow down the exported objects.

 Filter  Description
Starting ID Allows to limit the exported objects by the product/category ID, for example 1. Starting ID means "export only objects placed after this ID, including the ID supplied"
Ending ID Allows to limit the exported objects by the product/category ID, for example 1. Ending ID means "export only objects placed before this ID, including the ID supplied"
Date Range From Limit the export by a date range. Only export objects created *after* date X, but also including date X.
Date Range To Limit the export by a date range. Only export objects created *before* date X, but also including date X.
Export only not yet exported objects If enabled, only objects that haven't been exported before will be exported. This overrides the profile filter "Export only new objects" and can be turned off here for example.

Please keep in mind that any filters you set up in the profile will also be taken into account when exporting manually.

If you're ready to export, just press the Export button. You will be presented with a file download dialogue and a success message if the export completed successfully.

Automatic Export

To set up automatic exports, please have a look at the Automatic Export section configurable for each export profile. You can check/control whether automatic exports were made or not in the Execution Log.

Execution Log

Execution Log

The profile execution log shows any exports made using all profiles, be it manual or automatic. It is also possible to download any exported files, however, only if Save local copies of exports is set to "Yes" under General Configuration of the profile the export was made with.

Export History

Export History

This section shows which objects (products/categories) were exported by which profile and when. If the Export only new objects profile filter is set to "Yes", you should only see every object once there for each profile. If you want to re-export an object that has been already exported and is not exported because Export only new objects is set to "Yes", you can remove the entry from the export history grid by selecting Delete Entry.

Tools

Import/Export Screen

Export Settings

The extension comes with functionality to export certain module configuration. All or certain export profiles as well as export destinations can be selected for exporting at Catalog > Product Export > Tools, and can be exported by simply pressing the Export Settings button then. The exported file (ending in .json) can then be imported into another Magento installation using the Import Settings functionality, making it very easy to transfer you settings between development/staging/test/live environments or for clients.

Import Settings

The extension comes with functionality to import certain module configuration from other Magento installations. This means if you've previously exported export profiles or export destinations using the Export Settings functionality, you can import it here again.

Please note no passwords of export destinations will be imported. These will have to be re-entered manually for destinations.

Example Setups - What's possible with this extension?

What kind of exports can be set up using this extension? The possibilities are almost endless.

The extension supports an unlimited number of export profiles, which means an unlimited number of different, completely customizable, output formats can be set up. The export profiles can be exported at different times using cron jobs automatically or after certain events have happened in Magento. The exported files can be sent to an unlimited number of remote/local destinations, including FTP Servers, SFTP Servers, E-Mail Recipients, HTTP Servers and Webservices/APIs.

There is no export extension more flexible.

Questions? Concerns?

Got questions? Feel free to contact us! Contact Form

Interested in this Magento Extension?

Head over to our store to purchase this extension: Magento Product Export Module

Troubleshooting

Or: How to fix the most common issues.

FTP Upload does not work

Only 100 products are exported

This is caused by a third party extension you have installed, called Simtech_Searchanise. The Simtech_Searchanise extension rewrites the class Mage_Catalog_Model_Resource_Product_Collection. They specifically overwrite the following function:

   public function getLastPageNumber()
   {
       return $this->_searchaniseCollection->getLastPageNumber();
   }

This destroys pagination for *all* product collections. Once this extension is disabled, product collections can be paginated again and the export works properly. We suggest you contact them about this bug or disable the extension if it's not required.

A temporary fix could look like this. Please replace the above function with the following in the file app\code\community\Simtech\Searchanise\Model\Resource\Product\Collection.php:

   public function getLastPageNumber()
   {
       if (stristr(Mage::app()->getRequest()->getControllerName(), 'productexport') || Mage::registry('xtento_cronjob_execution_called') !== null) {
           return parent::getLastPageNumber();
       }
       return $this->_searchaniseCollection->getLastPageNumber();
   }

Cannot save profile / XSL Template / Test XSL Template

If you get a "Forbidden" page when trying to save the export profile, or if the "Test XSL Template" function fails with an "AJAX request failed" message, some "server security module" is blocking the execution as it suspects the XSL template to be a "virus" or bad code. That's not the case of course.

We are aware of a couple known possible reasons for this:

Cannot filter in extension grids (Execution Log, Export History, ...)

This is caused by the BL_CustomGrid extension. Please go to System > Custom Grids > List (Manage Custom Grids) and disable all XTENTO related grids.

Item (Mage_Catalog_Model_Product) with the same id "x" already exist

Please disable all third party modules (except ours) and then turn on again each after each other. Then you'll figure out which module is causing it. Some module is modifying the product collection where it shouldn't.

Error: You cannot define a correlation name 'xyz' more than once

Can be caused by buggy modules. One example we are aware of is: Ameronix_Productimage_Model_Observer->appendCustomAttribute Disable the (for example) Ameronix_Productimage module and it should work.

They should not add this twice, and not be doing this with every product collection load.

Not sure which module is causing it? Open the file /lib/Zend/Db/Select.php and look for: throw new Zend_Db_Select_Exception("You cannot define a correlation name '$correlationName' more than once"); Exactly before this line add: debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); die(); Save the file. Run the export again. You will see which custom module adds stuff using an observer.

Excel / CSV File / UTF-8 / Charset not recognized

Magento stores all data encoded in the UTF-8 charset. The default charset when exporting your data using this extension is UTF-8 thus. Now, if you want to open the exported CSV file in Excel, Excel won't recognize that charset by default, as Excel expects your local charset. To force excel into recognizing UTF-8, be sure to add addUtf8Bom="1" to the <file tag of your XSL Template. Check out the "Variables in the <file> node" section above for more details.


No Destination selected (error in the "Profile Execution Log") tab

This error shows up when you do not assign an export destination to your export profile. To do so, please go to "Catalog > Product Export > Export Destination" and create a destination. Back in the export profile, in the "Export Destinations" tab you can assign the destination to the profile by clicking the checkbox on the left side of the destination. Then save the profile afterwards and run the export again.

The strftime() PHP Function has been deprecated in PHP 8.1

Please use the date() function instead. For example: <xsl:value-of select="php:functionString('date','d.m.Y H:i:s',created_at_timestamp)" /> The function parameters can be found here: https://www.php.net/manual/en/function.date.php

Personal tools
Namespaces
Variants
Actions
General Information
Magento 2 Guides
Magento 2 Extensions
Magento 1 Guides
Magento 1 Extensions
Magento Integration Suite
Product Feed Guides
Toolbox