90 likes | 155 Views
My experience with Spree Commerce Product Import using Datashift Spree<br>
E N D
Overview • Recently we worked on re-platforming an E-commerce store that we wanted to move to SpreeCommerce to expand their offering & to cater to existing customers better. • As we analysed their ambitious requirements and the desire to launch in a very short period of time, we evaluated existing Spree Commerce extensions that we could use to get work done in the shortest possible period of time.
One big task in the migration, was moving over their existing product catalog to SpreeCommerce. • Our search for an already proven solution for this led us to datashift_spree which looked very promising. datashiftspree is a part of datashift which is a set of tools which help import and export from generic Ruby on Rails application. Datashift has very well defined conventions across representation of data in various cases.
The Run - Warmup • As we started evaluating datashift_spree for the capabilities it mentions, we started seeing some roadblocks as with any integration. Thankfully the roadblaocks were code-critical which we are most comfortable dealing with:
Just to mention few: • datashifthas undergone drastic refactoring which has rendered datashift_spree incompatible with latest datashift 0.40.0 version. • Next datashift 0.16.0 version posed some challenges while running thor list commands and datashift_spree:product:load • Refer datashift-branch-diff • Refer datashift-spree-branch-diff
Spree Product Import Usecases • Dummy Run helps to find & fix errors without corrupting database with invalid values • In case of errors, a detailed report of what/when/how related to steps execution is invaluable for the developer and operations guy for the confidence in import process and its correctness. • A uniform convention for data representation catering to different usecases makes the api/changes intuitive for not documented cases and help extend with minimum effort. • Syntax-summary • Defining-and-importing-Complex-Associations • Spree-Import-Export-Tips • Spree-Specific-Loader-Syntax
Dev Setup with updated branches on Githubforks • Ruby 2.2.1 • Spree 3.0.4 • Rails 4.2.5 • Rails Engine to wrap datashift_spree functionality and add Admin interface • datashift_spree 0-2-stable github branch • datashift0-16-stable github branch • Though above is tested with above setup, it should work on latest ruby and latest Spree 3.0.x version
Let us know any difficulties in comments • To see in live action without much effort • Clone Spree Store AT https://github.com/vinsol-spree-contrib/spree_datashift_store • Run bundle install • Run bundle exec rake db:create && bundle exec rake db:migrate && bundle exec rake db:seed
Run bundle exec rails • Log on to Admin Section using credentials as entered during seed above • Open http://localhost:3000/admin/product_import • See more at - http://vinsol.com/blog/2016/10/20/import-product-data-spree-commerce/