How can I import and export Drupal Commerce Products?
I have a Drupal 7 site and installed the Drupal Commerce module. In which I have added Commerce Product with Category like:
- Software Products
- Hardware Products
- Electronics
- Others
I would like to Export those Commerce Products from My Development Server to Production Server.
So, for that we have any modules available in Drupal.org
so, I can export the Commerce Products
and Import to my server.
I found the Node_Export module, but it only applies to exporting the nodes
. It does not apply to Commerce Products
.
Anyone has an idea how I can Import/Export the Commerce Module Products? I think it is general problem who are using the Commerce Module of Product (but not sure).
Answers 6
You can look at the Commerce Feeds module in Drupal
You can use this Views Data Export module to Export in CSV or Excel Format. Further read more details on that module for installation and configuration.
You can also watch View Tutorial
Commerce Feeds multitype
There is a great explanation here about exporting from Views both the Products and the Product Displays and then importing using Feeds and associated modules.
So to export those products, we first create a view containing the products and then export this view via Views data export into CSV file.
Install views_data_export and dependent modules
Create a view with products you like to export.
Configure View for export (Data export).
Generate the file via drush command, e.g.
To import:
Install commerce_feeds module and its dependent modules, e.g.
Create New Feed Importer.
Run import.
Similar goes for Product Displays.
See also:
Another option that might work to export any data from any Drupal database table is to use the export capabilities of the Forena module (it comes with quite some community documentation).
About Forena: it is built of the idea of using SQL to get data out of a database (which can be the Drupal database or an external one such as My SQL, Oracle, MS SQL, ...) and use XHTML and CSS to format it into web reports. Visit the Forena HowTos page for some links (near the bottom) to some live demo / showcase links.
Exporting data
Any report can be exported (saved) in various file formats, such as CSV, XLS, PDF, DOC, ... To do so, just add an extention to the report (output) URL that corresponds to the format you want (like
.csv
for CSV format). That contains the equivalent of that report (in the requested format). As a sample, consider the sample report located at/reports/sample.states
(in your own site, one of the samples shipped with Forena). Change the URL to/reports/sample.states.csv
(= just add.csv
to it) to get the same report in.csv
format. If you'd add such.csv
to the URL of the Simple Table of States in the demo site, the result is like so ...Same technique applies for other supported extensions (export formats), such as adding
.html
,.xls
(MS Excell),.pdf
or.doc
(MS Word).By the way, all data blocks are accessible directly via their url also, provided you have permission to access that block. Here are a few samples of that, for the sample report located at
/reports/sample.states
:For short, to answer this specific answer I'd write the various (custom) SQLs I need, format it as reports that fit my needs, and then just save it as a CSV (Or XML? Or JSON?).
Importing data
Using the Forena integration with the Feeds module it is possible to import data blocks.
For a tutorial about the available features check out the video about How to import data and reports based on data as Drupal nodes.
Disclosure: I'm a co-maintainer of the forena module.
The best way to export/import products is features. You will need to use uuid, uuid_features and commerce_uuid modules to archive this.
Try the latest UUID Features and Commerce UUID modules which allows you to export the Commerce products (see:
uuid_commerce_product.features.inc
).Image source: #1982738 at DO