This extension adds product import functionality to Spree, with a bunch of features that give it similar functionality to Shopify's importer.
It's been built to be as simple as possible while still doing it's job, and almost the entire workflow of the script beyond creating products from a CSV file is configurable.
This extension adds a tab to the administration area of Spree, allowing a logged-in user to select and upload a CSV file containing product information. The upload is then placed on queue for processing. Once it has been processed, the user who initiated the job is notified by email that their import has completed.
class_eval
, it can be extended or changed to do more, less, or something differently.sku
attribute of the Product model.permalink
attribute), and creates a variant of that product if it exists already. Custom fields are also supported if dynamic column mapping is enabled - simply having 'Color', 'Size', 'Material' columns in your CSV file for example, will automatically set the relevant custom fields on the variant to the values from the CSV.This gem will require (or will install for you), delayed_job.
Once the gem has installed and you have run migrations, you should also run rails generator delayed_job
to create the tables that delayed_job requires.
Delayed Job also requires that you run 'workers' in the background to pop jobs off the queue and process them. This setup may seem like extra work, but believe me, it pays off - with this method, users get an immediate confirmation that their import is on it's way, with a confirmation later on with full details - this is much better than the previous method where the actual processing was completed during the request, with no feedback reaching the user until after the import had finished.
Run rake jobs:work
to start Delayed Job, and rake jobs:clear
to clear all queued jobs. Also see delayed_job's Githut page for info on Capistrano support.
For more information on Delayed Job, and for help getting a worker running, see the Github Project Page
The columns of the CSV that contain taxonomies is configurable. Each of these columns can contain a number of formats that represent different hierarchies of taxonomies.
Furniture
Furniture & Clearance
Furniture > Dining Room > Tables
Furniture > Dining Room > Tables & Clearance > Hot this week
All the configuration for this extension is inside the initializer generated when you run rake import_products:install
. It's basically a big hash with manual column mappings (If you don't want to use dynamic column mapping), and a bunch of settings that control the workflow of the extension. Take a look at the initializer to see more details on each field.
In most cases, it's unlikely you will need to change defaults, but it's there is you need it.
Ttttteeeessssttttiiinnnggg!!
Add the gem to your Gemfile, and run bundle install.
gem 'import_products', :git => 'git://github.com/joshmcarthur/spree-import-products.git'
then bundle install
'Install' the extension - copy a migration and an initializer. rake import_products:install
Do a db migration. rake db:migrate
Configure the extension to suit your application by changing config variables in config/initializers/import_product_settings.rb
Run application!
The product import script was based on a simple import script written by Brian Quinn here. I've extended it quite a bit and tweaked it to fit my needs.
Copyright (c) 2010 Josh McArthur, released under the MIT License