Comments (6)
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.
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.
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.
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.
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.
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)
- 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
- uninitialized constant DataShift::CsvLoading (NameError) HOT 3
- can't attach images on product update HOT 5
- 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.