Comments (5)
Hi ... sorry I do not work commercially with Spree at present so I think the gem is lagging behind the Spree data model but the bulk attach of images should work
It looks like it could not match the value in teh SKU field to a product
No matching owner found for file name : product_images
Could you share the images spreadsheet ? or just a couple of rows with the headers ?
from datashift_spree.
Hi and thanks!
The images spreadsheet can be represented as below. I can confirm that both sku values are present in the back-office.
sku | attachment |
---|---|
ABCD | /home/Downloads/coming-soon.jpg |
EFGHI | /home/Downloads/coming-soon.jpg |
Please let me know if I can provide more information on this.
from datashift_spree.
I further tested and was eventually able to upload a new product by adding an images
field in the spreadsheet.
However the problem persists when trying to update a product
thor datashift:paperclip:attach --attachment-klass=Spree::Image --attach-to-field=images --input=vendor/datashift/templates/product_images.xls --attach-to-klass=Spree::Variant --attach-to-find-by-field=sku
returns
Using Field sku to lookup matching [Spree::Variant] Logging going to target [log/datashift.log] WARNING : 1 of 1 files could not be attached to a Spree::Image For your convenience copying files with MISSING Spree::Variant to : MissingAttachmentRecords Created 0 / 1 attachments of type Spree::Image attached to Spree::Variant
logfile
`
D, [2017-09-17T12:59:11.268485 #21262] DEBUG -- : Catalogue - building operators information for Spree::Variant
I, [2017-09-17T12:59:11.284418 #21262] INFO -- : Loading attachments from vendor/datashift/templates/product_images.xls
I, [2017-09-17T12:59:11.313654 #21262] INFO -- : Loading objects of type Spree::Image
I, [2017-09-17T12:59:11.313711 #21262] INFO -- : Found 1 files - splitting names on delimiter [ ]
I, [2017-09-17T12:59:11.313734 #21262] INFO -- : Finding matching field/association [images] on class [Spree::Variant]
D, [2017-09-17T12:59:11.313915 #21262] DEBUG -- : Column [images] (0) - mapped to :
Class [Spree::Variant]
Operator Type [has_many]
Operator [images]
I, [2017-09-17T12:59:11.313939 #21262] INFO -- : Processing attachment file product_images.xls
I, [2017-09-17T12:59:11.313957 #21262] INFO -- : Attempting to find attachment owner (Spree::Variant for [product_images]
I, [2017-09-17T12:59:11.313972 #21262] INFO -- : Scanning for record where Spree::Variant.sku ~= product_images
D, [2017-09-17T12:59:11.315256 #21262] DEBUG -- : �[1m�[35mSpree::Variant Load (0.2ms)�[0m SELECT "spree_variants".* FROM "spree_variants" WHERE "spree_variants"."deleted_at" IS NULL AND (lower(sku) = 'product_images') ORDER BY "spree_variants"."id" ASC LIMIT 1
I, [2017-09-17T12:59:11.315372 #21262] INFO -- : Nothing found - trying split file_name to terms on [ ]
I, [2017-09-17T12:59:11.315392 #21262] INFO -- : Scanning by term for record where sku ~= product_images
D, [2017-09-17T12:59:11.315811 #21262] DEBUG -- : �[1m�[36mSpree::Variant Load (0.1ms)�[0m �[1mSELECT "spree_variants".* FROM "spree_variants" WHERE "spree_variants"."deleted_at" IS NULL AND (lower(sku) = 'product_images') ORDER BY "spree_variants"."id" ASC LIMIT 1�[0m
D, [2017-09-17T12:59:11.316255 #21262] DEBUG -- : �[1m�[35mSpree::Variant Load (0.1ms)�[0m SELECT "spree_variants".* FROM "spree_variants" WHERE "spree_variants"."deleted_at" IS NULL AND (lower(sku) = ' product_images') ORDER BY "spree_variants"."id" ASC LIMIT 1
E, [2017-09-17T12:59:11.316353 #21262] ERROR -- : Failure(s) reported :
E, [2017-09-17T12:59:11.316371 #21262] ERROR -- : No matching owner found for file name : product_images
I, [2017-09-17T12:59:11.316429 #21262] INFO -- : Copying vendor/datashift/templates/product_images.xls to MissingAttachmentRecords folder
`
from datashift_spree.
Ahhh I see the issue now, misunderstanding of use case - this Task is not driven by a spreadsheet
It's for a different use case, bulk uploading based on file names
Create paperclip attachments and attach to a Model from files in a directory.
-i, --input=INPUT # The input path containing images
The file name is used to lookup the instance of :attach_to_klass to assign the new attachment to
So the filenames should contain the SKU (somewhere) so these would work
e.g ABCD.jpg or coming_soon_ABCD.jpg or ABCD_coming_soon.jpg etc
So currently its treating vendor/datashift/templates/product_images.xls as the input image
I think you want -i /home/Downloads/
from datashift_spree.
Ok thanks! I will give a try to this method as you have mentioned.
Regarding spreadsheet usage is this syntax correct? thor datashift_spree:load:attach_images --input=vendor/datashift/templates/product_images.xls
. This still returns an ArgumentError.
from datashift_spree.
Related Issues (20)
- Spree verison 3.0.4 HOT 7
- Feature: spree_related_products support HOT 2
- No Thor commands available HOT 5
- #<NoMethodError: undefined method `stock_location_name=' for #<Spree::Product:0x00000007ecd9a0>> HOT 2
- change count_on_hand in templates to stock_items
- master price is reset if using variants
- Product assigned to every parent taxonomy
- thor datashift_spree:load:products fails to render values from xls formulas HOT 1
- Paperclip not working for spree 3? HOT 6
- Error to upload images using datashift_spree:load:images HOT 3
- how to upload order and users HOT 1
- Products price get a trailing zero in import
- Failed to import supplier_id (spree_drop_ship) HOT 6
- uninitialized constant DataShift::CsvLoading (NameError) HOT 3
- ERROR: "thor csv" was called with arguments ["-i,", "-m,"] Usage: "thor datashift:import:csv -i, --input=INPUT -m, --model=MODEL" HOT 9
- uninitialized constant DataShift::Spree HOT 1
- Failed to import Products. Error: undefined method `type_cast_from_database' HOT 10
- Variants are not updated with variant SKU
- how do i generate compatible csv files HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from datashift_spree.