Giter Site home page Giter Site logo

Comments (5)

autotelik avatar autotelik commented on August 9, 2024

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.

LucaDev13 avatar LucaDev13 commented on August 9, 2024

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.

LucaDev13 avatar LucaDev13 commented on August 9, 2024

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.

autotelik avatar autotelik commented on August 9, 2024

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.

LucaDev13 avatar LucaDev13 commented on August 9, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.