Giter Site home page Giter Site logo

Comments (6)

autotelik avatar autotelik commented on August 9, 2024

hi .. does it fail with an error ? or simply fail to assign the id ? did you try just using 'supplier' as the heading ?

from datashift_spree.

autotelik avatar autotelik commented on August 9, 2024

by the way you can generate a template for a model's import, with all available associations, via

thor datashift:generate:excel -m Spree::Product -r spree_product_template.xls -a

from datashift_spree.

gitrepo4koresol avatar gitrepo4koresol commented on August 9, 2024

Thank You very much for suggestions, using which we are able to make the progress ...
It's creating product record in database, even when we mention "suppliers" head and it's value in excel ...
But , now - it simply fail to assign the supplier id .to the product....

Please refer error log below, will appreciate your help =>

ActiveRecord::HasManyThroughNestedAssociationsAreReadonly: Cannot modify association 'Spree::Product#suppliers' because it goes through more than one other association

Cannot assign [#<Spree::Supplier id: 24, active: true, address_id: 197, commission_flat_rate: #BigDecimal:7f7971096d60,'0.0',9(36), commission_percentage: 0.0, email: "[email protected]", name: "lorem ipsum", url: "", deleted_at: nil, created_at: "2016-09-13 03:52:42", updated_at: "2016-09-13 03:52:42", tax_id: "", token: "rp_18t7yQAlxwPOUWS4XPhQ38t6", slug: "lorem-ipsum-da10a923-3a40-4f23-91e2-d9f879ac0d91", contact_number: nil, bank_name: "state", ..... LIKE MORE DETAILS ...]

(Array) to has_many association [suppliers]

from datashift_spree.

gitrepo4koresol avatar gitrepo4koresol commented on August 9, 2024

Hi - Further digging of "Supplier" model class, we found below associations for "Supplier" - your suggestions to progress further will highly be appreciated .. Thank you !

class Spree::Supplier < Spree::Base
extend FriendlyId
friendly_id :name, use: :slugged

attr_accessor :password, :password_confirmation

#==========================================

Associations

belongs_to :address, class_name: 'Spree::Address'
accepts_nested_attributes_for :address

if defined?(Ckeditor::Asset)
has_many :ckeditor_pictures
has_many :ckeditor_attachment_files
end

has_many :products, through: :variants

has_many :supplier_variants

has_many :variants, through: :supplier_variants

has_many :shipments, through: :stock_locations
has_many :stock_locations
has_many :users, class_name: Spree.user_class.to_s

from datashift_spree.

autotelik avatar autotelik commented on August 9, 2024

I think the issue is Supplier is not actually directly associated with the Parent Product class. Its via the child Variant.

So perhaps a two stage load where you load the products then dump out all the Variants and assign suppliers to those variants (and run new load with -m Spree::Variant)

Or over ride the Loader, process method and write some custom code to process the Supplier column

for example of this over loading see
https://github.com/autotelik/datashift_spree/blob/master/lib/loaders/spree/product_loader.rb

or writing a specific loader from scratch

https://github.com/autotelik/datashift_spree/blob/master/lib/loaders/spree/shopify_order_migrator.rb

from datashift_spree.

gitrepo4koresol avatar gitrepo4koresol commented on August 9, 2024

Hi - Sorry for replying late ...
Thank you for suggestions .. two stage load worked well ..
Thank You for your help!!

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.