It is possible to create and update digital products and products with file attachments using the built-in import feature.
Here’s how to do it:
1. Prepare the files that will be used as downloadable attachments for the products that you are going to import:
- If the files you need to use as attachments are stored locally, put them in the folder
<XCART-DIRECTORY>/files/attachments/. For better organization of the file structure, you may prefer to use a subfolder like
As an alternative, it is also possible to put the files in the folder
<XCART-DIRECTORY>/var/importOr its subfolders.
The ability to use this folder was implemented for compatibility with older X-Cart versions. Any files that will be imported from this folder will be automatically copied to a folder like
- If the files you need to import are located on another website available over the Internet, you do not have to upload them to your X-Cart server manually; to import such files, you will need to specify their location in the import CSV file as a URL, and they will be uploaded to the folder
<XCART-DIRECTORY>/files/attachments/automatically during the import process.
2. Prepare a products.csv file with information about the products and downloadable attachments you wish to import.
Depending on your needs and your store configuration, you may require a different set of fields to format the data in your CSV file. For a detailed reference on the fields' format in a CSV file for product import, see the section CSV Import: Products. Make sure your resulting file meets the requirements of the RFC 4180 standard.
At the minimum, your CSV file for the import of products with attachments will need to include the following information:
- Information required to properly identify a product (the fields sku, name).
- Information about the downloadable files associated with the said SKU and product name (the fields of the File attachments add-on: attachments, attachmentsTitle, and attachmentsDescription).
Note that the attachment file location may be specified in the attachments field either as a URL or as a local path.
Here’s an example of a CSV file for the import of a product (SKU 12026 Ollie - The App-Controlled Robot) with a free downloadable attachment (Ollie User Manual):
3. In your X-Cart store Admin area, go to the section Catalog > Import, select the CSV file you have prepared for import, specify the import settings as you require, and click Start import to upload your import CSV file.
As a result of import:
- A file that has been uploaded onto the X-Cart server to a folder within
<XCART-DIRECTORY>/files/attachments/will remain in the same folder. Its file path will be linked to the product as the attachment file location.
- A file from an external URL will be uploaded automatically to a folder like
<XCART-DIRECTORY>/files/attachments/[product_id]. The file's path within the
<XCART-DIRECTORY>/files/attachments/[product_id]folder will be linked to the product as the attachment file location.