Creating and updating digital products and products with file attachments is possible using the built-in import feature.
Here's how to do it:
1. Prepare the files that you will use as downloadable attachments for the products:
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<XCART-DIRECTORY>/files/attachments/[product_id].
As an alternative, it is also possible to put the files in the folder<XCART-DIRECTORY>/var/import
OR 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
<XCART-DIRECTORY>/files/attachments/[product_id]
during import.
If the files you need to import are located on another website available over the Internet, you do not have to manually upload them to your X-Cart server. 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 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 correctly 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 you can specify the attachment file location in the "attachments" field either as a URL or 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 uploaded to a folder within
<XCART-DIRECTORY>/files/attachments/
will preserve its location. 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.
Related pages: