-
Notifications
You must be signed in to change notification settings - Fork 104
Home
Welcome to the Datashift Spree wiki
This is an extension to datashift gem providing **Spree **specific extensions and support
The Spree Products and Images specific loaders aim to simplify mapping your suppliers data into Spree. All associations on Product are supported, and multiple associations can be specified in multiple columns or through a DSL (embedded syntax/delimiters) within a single column. In cases where the association can take optional values, such as Product Properties, the optional values can be supplied on a per product basis.
Populate Spree Product/Variant data from .xls or CSV file.
Tip: In CSV files, use ',' as Field delimiter and " as Text delimiter
This task will automatically select the right loader depending on the input file type. Above are details of how to generate a suitable template ready for re-importing. Alternatively the spec/fixtures area has many examples.
For latest options and usage see :
bundle exec thor help datashift_spree:products
There are a number of facilitates for attaching images to Products.
Firstly, during Product creation via task datashift_spree:products
, an 'Images' column is supported, in the products input file, either CSV or .xls. The column should contain either a filesystem path to the image, or a full URL. When specifying an URL the image will be downloaded from the supplied URI, saved to a temp file and then attached as normal to the Product
Alternatively there are a number of tools to help load or attach new or multiple images to **existing **Products.
Usage:
thor datashift:spree:attach_images -i, --input=INPUT
Populate Products with images from Excel/CSV
You must provide a column containing the Product SKU or Name to attach to.
In another column called 'attachment' provide the full path to the Image(s)
Usage:
thor datashift:spree:images -i, --input=INPUT
Options:
-i, --input=INPUT # The import file (.xls or .csv)
-f, [--process-when-no-assoc] # Process image even if no Product found - force loading
-s, [--sku=SKU] # Lookup Product based on image name starting with sku
-p, [--sku-prefix=SKU_PREFIX] # Prefix to add to each SKU in import file
-d, [--dummy] # Dummy run, do not actually save Image or Product
-v, [--verbose] # Verbose logging
-c, [--config=CONFIG] # Configuration file for Image Loader in YAML
[--split-file-name-on=SPLIT_FILE_NAME_ON] # delimiter to progressivley split filename for Prod lookup
# Default: _
[--case-sensitive] # Use case sensitive where clause to find Product
[--use-like] # Use LIKE 'string%' instead of = 'string' in where clauses
Example :
bundle exec thor datashift:spree:images -i db/datashift/Megaman/imagebank -s -p ABC_ -d
Collections of useful data, such as Shipping Zones, can be found in the spree_databank folder.
Please feel free to contribute. Send a pull request.
You can generate blank templates for any model via
bundle exec thor datashift:generate:excel -m <model> -r <file>.xls --remove-rails
e.g. bundle exec thor datashift:generate:excel -m Spree::Zone -r spree_zone_template.xls --remove-rails
bundle exec thor datashift_spree:data_bank:uk_shipping:royal_mail --calc Spree::Calculator::FlatInRange --commit