Comments (9)
Spree added a whole new stock keeping layer to Spree 2
The old count_on_hand is no longer on Variant. Have you tried using the master branch ... I have been working to get full 2 support in master ..
If you still have issues, see from line 138 of https://github.com/autotelik/datashift_spree/blob/master/lib/loaders/spree/product_loader.rb - v.stock_items.first.count_on_hand
from datashift_spree.
I'm running from master (git assignment).
This is a row form my .xls:
sku | name | description | avaliable_on | cost_price | price | shipping_category | tax_category | taxons | taxons | taxons | taxons | product_properties | variants | stock_location_name | stock_items
3218 | Conjunto Gorro e Luvas | Conjunto Gorro e Luvas | 2015-02-12 | 6,28 | 13,82 | CTT - Correio Normal < 2kg | IVA | Secções>Bebé Menino | Marcas>Tuc Tuc | Categorias>Gorros e Bonés | Composição:100% Algodão | newborn-clothes-size:0M;color:branco | casa_susana | count_on_hand:1
My log states:
#<ActiveRecord::RecordInvalid: Validation failed: Stock location can't be blank, Variant can't be blank>
Cannot assign [#<Spree::StockItem id: nil, stock_location_id: nil, variant_id: nil, count_on_hand: 0, created_at: nil, updated_at: nil, backorderable: false, deleted_at: nil>] (Array) to has_many association [stock_items]
I'm trying to pass a column as "stock_location_name" before sotck_items one...
Will look into this code and thank you for your support :)
from datashift_spree.
To manage stock you need at least one Stock Location defined in your store. IF yuo cleared out the defautl seeds etc you may not have the default ... you can add one via the admin GUI ... .. see https://guides.spreecommerce.com/user/configuring_inventory.html
I did come across another potential call you might try..adjust_count_on_hand :
variant.stock_items.first.adjust_count_on_hand(quantity)
from datashift_spree.
I have 2 stock locations defined on my DB. I tried to select one in my .xls with column "stock_location" and value "name:casa_susana" to no avail.
I would have to replace product_loader.rb to accomplish that right? (variant.stock_items.first.adjust_count_on_hand(quantity))
from datashift_spree.
yes something like ... inherit from product_loader
implement ... your own def process(method_detail, value)
which just fixes for count on hand otherwise call super
if(current_value && (current_method_detail.operator?('count_on_hand') || current_method_detail.operator?('on_hand')) )
# NEW IMPLEMENTATION THAT WORKS FOR STOCK
else
super( file_name, opts )
end
from datashift_spree.
Forking your project and gonna try this.
Thanks for the pointers :)
from datashift_spree.
I've forked datashift_spree and made some changes so that we can load stock with Spree version >= 2.2.
already tested. sure it needs some code cleanup but it works, at least for me
https://github.com/redglory/datashift_spree/blob/master/lib/loaders/spree/product_loader.rb
Please check :)
from datashift_spree.
Hi .. thanks so much for contributing .. please submit a pull request, will be easier to visualize diffs and I will merge into main gem
cheers
tom
from datashift_spree.
Hey sure thing.
Not at home right nos but will pull request lateral at night.
Cheers
EDIT: #36
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
- 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.