Giter Site home page Giter Site logo

Comments (3)

autotelik avatar autotelik commented on August 9, 2024

superficially can't see anything wrong with the Taxon data

from log wonder if the issue is occurring before and throwing a spanner in the works somehow

have you tried a more simple line with just basic product plus taxons

I won't have time to look at this till the weekend

cheers tom

albums : http://aqwan.bandcamp.com
all music:http://soundcloud.com/aqwan


From: Chris Carpenter [email protected]
To: autotelik/datashift_spree [email protected]
Sent: Thursday, 25 September 2014, 20:46
Subject: [datashift_spree] Taxons keep failing to import (#31)

From all the docs indicate it is just "categories>test"
id,sku,price,map,name,description,available_on,deleted_at,slug,meta_description,meta_keywords,tax_category_id,shipping_category_id,created_at,updated_at,product_option_types,option_types,properties,product_properties,classifications,taxons,variants,variants_including_master,prices,stock_items,line_items,orders,variant_images,promotion_rules
,test3,3.99,5.99,test3,test3,,,test3,test3,test3,1,1,,,,,"name:test_name|presentation:Name","test_name:This is a test",,"categories>test>sub-test",,,,,,,,
My log
Spree Loading initialised with:
{:verbose=>true}
Product load from File [spree_products.csv]
Product load using forced operators: [["images", "variant_price", "variant_sku", "price"]]
Starting load from file [spree_products.csv]
Perform Load Options:
{"input"=>"spree_products.csv", "verbose"=>true, "mandatory"=>["sku", "name", "price"], "force_inclusion"=>["images", "variant_price", "variant_sku", "price"]} [1m[36m (39.1ms)[0m [1mBEGIN[0m
Processing default value available_on : 2014-09-25 15:43:42
Processing default value cost_price : 0.0
Processing default value price : 0.0
Processing value: []
Populator assigning data via id
Assignging => [id](CAST 2 TYPE 0)
Processing value: [test3]
Populator assigning data via sku
Brute force assignment of value test3 => [sku]
Processing value: [3.99]
Populator assigning data via price
Brute force assignment of value 3.99 => [price]
Processing value: [5.99]
Populator assigning data via map
Brute force assignment of value 5.99 => [map]
Processing value: [test3]
Populator assigning data via name
Assignging test3 => [name](CAST 2 TYPE)
Processing value: [test3]
Populator assigning data via description
Assignging test3 => [description](CAST 2 TYPE)
Processing value: [2014-09-25 15:43:42]
Populator assigning data via available_on
Assignging 2014-09-25 15:43:42 => [available_on](CAST 2 TYPE 2014-09-25 15:43:42 UTC)
Processing value: []
Populator assigning data via deleted_at
Assignging => [deleted_at](CAST 2 TYPE nil)
Processing value: [test3]
Populator assigning data via slug
Assignging test3 => [slug](CAST 2 TYPE)
Processing value: [test3]
Populator assigning data via meta_description
Assignging test3 => [meta_description](CAST 2 TYPE)
Processing value: [test3]
Populator assigning data via meta_keywords
Assignging test3 => [meta_keywords](CAST 2 TYPE)
Processing value: [1]
Populator assigning data via tax_category_id
Assignging 1 => [tax_category_id](CAST 2 TYPE 1)
Processing value: [1]
Populator assigning data via shipping_category_id
Assignging 1 => [shipping_category_id](CAST 2 TYPE 1)
Processing value: []
Populator assigning data via created_at
Assignging => [created_at](CAST 2 TYPE nil)
Processing value: []
Populator assigning data via updated_at
Assignging => [updated_at](CAST 2 TYPE nil)
Processing value: []
Trying to find operator class with Parent Namespace Spree [1m[35mSpree::Product Exists (37.6ms)[0m SELECT 1 AS one FROM spree_products WHERE spree_products.slug = BINARY 'test3' LIMIT 1 [1m[36mSpree::Product Exists (33.8ms)[0m [1mSELECT 1 AS one FROM spree_products WHERE spree_products.slug = BINARY 'test3' LIMIT 1[0m [1m[35mSQL (38.0ms)[0m INSERT INTO spree_products (available_on, created_at, description, id, meta_description, meta_keywords, name, shipping_category_id, slug, tax_category_id, updated_at) VALUES ('2014-09-25 15:43:42', '2014-09-25 19:43:43', 'test3', 0, 'test3', 'test3', 'test3', 1, 'test3', 1, '2014-09-25 19:43:43') [1m[36mSpree::Variant Exists (39.9ms)[0m [1mSELECT 1 AS one FROM spree_variants WHERE spree_variants.sku = BINARY 'test3' AND spree_variants.deleted_at IS NULL LIMIT 1[0m [1m[35mSQL (37.2ms)[0m INSERT INTO spree_variants (cost_currency, cost_price, map,
product_id, sku, updated_at) VALUES ('USD', 0.0, 5.99, 0, 'test3', '2014-09-25 19:43:43') [1m[36mSpree::Variant Load (40.1ms)[0m [1mSELECT spree_variants.* FROM spree_variants WHERE spree_variants.id = 40 LIMIT 1[0m [1m[35mSQL (35.1ms)[0m INSERT INTO spree_prices (amount, currency, variant_id) VALUES (3.99, 'USD', 40) [1m[36mSQL (37.4ms)[0m [1mUPDATE spree_variants SET spree_variants.updated_at = '2014-09-25 19:43:43' WHERE spree_variants.id = 40[0m [1m[35mSpree::Product Load (44.4ms)[0m SELECT spree_products.* FROM spree_products WHERE spree_products.id = 0 LIMIT 1 [1m[36mSpree::StockLocation Load (39.6ms)[0m [1mSELECT spree_stock_locations.* FROM spree_stock_locations[0m [1m[35mSpree::StockLocation Load (51.9ms)[0m SELECT spree_stock_locations.* FROM spree_stock_locations WHERE spree_stock_locations.id = 1 LIMIT 1 [1m[36mSpree::StockItem Exists (36.0ms)[0m [1mSELECT 1 AS one FROM
spree_stock_items WHERE (spree_stock_items.variant_id = BINARY 40 AND spree_stock_items.stock_location_id = 1 AND spree_stock_items.deleted_at IS NULL) LIMIT 1[0m [1m[35mSQL (35.8ms)[0m INSERT INTO spree_stock_items (backorderable, created_at, stock_location_id, updated_at, variant_id) VALUES (1, '2014-09-25 19:43:44', 1, '2014-09-25 19:43:44', 40) [1m[36mSQL (43.5ms)[0m [1mUPDATE spree_variants SET spree_variants.updated_at = '2014-09-25 19:43:44' WHERE spree_variants.id = 40[0m [1m[35mSQL (36.2ms)[0m UPDATE spree_products SET spree_products.updated_at = '2014-09-25 19:43:44' WHERE spree_products.id = 0 [1m[36m (41.1ms)[0m [1mSELECT MAX(spree_variants.position) AS max_id FROM spree_variants WHERE spree_variants.deleted_at IS NULL AND spree_variants.product_id = 0 AND spree_variants.is_master = 0[0m [1m[35mSQL (40.5ms)[0m UPDATE spree_variants SET spree_variants.position = 1
WHERE spree_variants.id = 40 [1m[36m (43.5ms)[0m [1mSELECT SUM(spree_stock_items.count_on_hand) AS sum_id FROM spree_stock_items INNER JOIN spree_stock_locations ON spree_stock_locations.id = spree_stock_items.stock_location_id WHERE spree_stock_items.deleted_at IS NULL AND spree_stock_items.variant_id = 40 AND spree_stock_locations.active = 1[0m [1m[35mSQL (37.5ms)[0m UPDATE spree_products SET spree_products.updated_at = '2014-09-25 19:43:44' WHERE spree_products.id = 0 [1m[36mSpree::Variant Exists (41.6ms)[0m [1mSELECT 1 AS one FROM spree_variants WHERE (spree_variants.sku = BINARY 'test3' AND spree_variants.id != 40) AND spree_variants.deleted_at IS NULL LIMIT 1[0m [1m[35mSQL (41.2ms)[0m UPDATE spree_variants SET is_master = 1, updated_at = '2014-09-25 19:43:44' WHERE spree_variants.id = 40 [1m[36mSQL (54.8ms)[0m [1mUPDATE spree_products SET spree_products.updated_at =
'2014-09-25 19:43:44' WHERE spree_products.id = 0[0m [1m[35mSpree::Taxon Load (78.0ms)[0m SELECT spree_taxons.* FROM spree_taxons INNER JOIN spree_products_taxons ON spree_taxons.id = spree_products_taxons.taxon_id WHERE spree_products_taxons.product_id = 0 [1m[36mSQL (39.6ms)[0m [1mUPDATE spree_taxons SET spree_taxons.updated_at = '2014-09-25 19:43:45' WHERE 1=0[0m [1m[35mSQL (43.2ms)[0m UPDATE spree_taxonomies SET spree_taxonomies.updated_at = '2014-09-25 19:43:45' WHERE 1=0 ORDER BY spree_taxonomies.position
Processing value: []
add_options_variants []
Processing value: [name:test_name|presentation:Name]
Trying to find operator class with Parent Namespace Spree
Parsed inbound data into name << test_name
Scan for multiple has_many associations ["test_name"] [1m[36mSpree::Property Load (41.2ms)[0m [1mSELECT spree_properties.* FROM spree_properties WHERE spree_properties.name IN ('test_name')[0m
Scan result #<ActiveRecord::Relation []>
Association properties with key(s) ["test_name"] NOT found - Not added.
Parsed inbound data into presentation << Name
Scan for multiple has_many associations ["Name"] [1m[35mSpree::Property Load (37.9ms)[0m SELECT spree_properties.* FROM spree_properties WHERE spree_properties.presentation IN ('Name')
Scan result #<ActiveRecord::Relation []>
Association properties with key(s) ["Name"] NOT found - Not added.
Processing value: [test_name:This is a test]
Parsed inbound data into test_name << This is a test [1m[36mSpree::Property Load (43.7ms)[0m [1mSELECT spree_properties.* FROM spree_properties WHERE spree_properties.name = 'test_name' LIMIT 1[0m [1m[35mSQL (38.4ms)[0m INSERT INTO spree_properties (created_at, name, presentation, updated_at) VALUES ('2014-09-25 19:43:45', 'test_name', 'Test name', '2014-09-25 19:43:45')
Created New Property #<Spree::Property id: 20, name: "test_name", presentation: "Test name", created_at: "2014-09-25 19:43:45", updated_at: "2014-09-25 19:43:45"> [1m[36mSQL (36.5ms)[0m [1mINSERT INTO spree_product_properties (created_at, property_id, updated_at, value) VALUES ('2014-09-25 19:43:45', 20, '2014-09-25 19:43:45', 'This is a test')[0m [1m[35mSQL (39.2ms)[0m UPDATE spree_product_properties SET product_id = 0, updated_at = '2014-09-25 19:43:45' WHERE spree_product_properties.id = 75 [1m[36mSQL (33.1ms)[0m [1mUPDATE spree_products SET spree_products.updated_at = '2014-09-25 19:43:45' WHERE spree_products.id = 0[0m
Created New ProductProperty #<Spree::ProductProperty id: 75, value: "This is a test", product_id: 0, property_id: 20, created_at: "2014-09-25 19:43:45", updated_at: "2014-09-25 19:43:45", position: 0>
Processing value: []
Trying to find operator class with Parent Namespace Spree
Processing value: [categories>test>sub-test]
Failed to process row [0]([nil, "test3", "3.99", "5.99", "test3", "test3", nil, nil, "test3", "test3", "test3", "1", "1", nil, nil, nil, nil, "name:test_name|presentation:Name", "test_name:This is a test", nil, "categories>test>sub-test", nil, nil, nil, nil, nil, nil, nil, nil]) [1m[35m (47.2ms)[0m COMMIT
The Product, Variant and Properties are working, but I cannot get Taxons working.

Reply to this email directly or view it on GitHub.

from datashift_spree.

chriscarpenter12 avatar chriscarpenter12 commented on August 9, 2024

Did some digging in the product_loader.rb last night and found a few things.
Line 388: I think find_or_create_by_* was deprecated. Maybe should be:

parent_taxonomy = @@taxonomy_klass.find_or_create_by(name: parent_name)

Line 398: I think find_or_create_by_* was deprecated. Maybe should be:

taxon = @@taxon_klass.find_or_create_by(name: name, parent_id: parent.id, taxonomy_id: parent_taxonomy.id)

The taxon assigned to the product doesn't seem to be correct either. It is generating a product_id of 0 on every line in spree_products_taxons.

Also from what I understand of spree if a product is in Category > Clothing > Shirts then it belongs to Shirts not Shirts, Clothing and Category. It should only be assigned to the last taxon. If you want multiple taxons then define Category > Clothing > Shirts | Category > Clothing

Where does @@taxon_klass come from? I can't seem to find it defined anywhere? Is it the Spree Class related to the function being run?

from datashift_spree.

macah1 avatar macah1 commented on August 9, 2024

I'm having the same problem here. Trying with products with a simple hierarchy of taxons, same issue, products are imported ok (properties too, etc), but taxons are not created, here is what I've got in logs:

Processing value: [Rubros>Guitarras|Marcas>Fender]
  Spree::Taxonomy Load (0.8ms)  SELECT "spree_taxonomies".* FROM "spree_taxonomies" INNER JOIN "spree_taxonomy_translations" ON "spree_taxonomy_translations"."spree_taxonomy_id" = "spree_taxonomies"."id" WHERE "spree_taxonomy_translations"."name" = 'Rubros' AND "spree_taxonomy_translations"."locale" = 'es' AND (spree_taxonomy_translations.name IS NOT NULL) ORDER BY spree_taxonomies.position LIMIT 1
  Spree::Taxonomy::Translation Load (0.5ms)  SELECT "spree_taxonomy_translations".* FROM "spree_taxonomy_translations" WHERE "spree_taxonomy_translations"."spree_taxonomy_id" IN (1)
  Spree::Taxon Load (0.9ms)  SELECT "spree_taxons".* FROM "spree_taxons" WHERE "spree_taxons"."taxonomy_id" = $1 AND "spree_taxons"."parent_id" IS NULL ORDER BY "spree_taxons"."id" ASC LIMIT 1  [["taxonomy_id", 1]]
#<NoMethodError: undefined method `id' for nil:NilClass>
Cannot assign Taxon [''] to Product ['SST-01 - Stratocaster']
  Spree::Taxon Load (1.0ms)  SELECT "spree_taxons".* FROM "spree_taxons" INNER JOIN "spree_products_taxons" ON "spree_taxons"."id" = "spree_products_taxons"."taxon_id" WHERE "spree_products_taxons"."product_id" = $1  [["product_id", 14683]]
Product assigned to Taxons : []
  Spree::Taxonomy Load (0.6ms)  SELECT "spree_taxonomies".* FROM "spree_taxonomies" INNER JOIN "spree_taxonomy_translations" ON "spree_taxonomy_translations"."spree_taxonomy_id" = "spree_taxonomies"."id" WHERE "spree_taxonomy_translations"."name" = 'Marcas' AND "spree_taxonomy_translations"."locale" = 'es' AND (spree_taxonomy_translations.name IS NOT NULL) ORDER BY spree_taxonomies.position LIMIT 1
  Spree::Taxonomy::Translation Load (0.8ms)  SELECT "spree_taxonomy_translations".* FROM "spree_taxonomy_translations" WHERE "spree_taxonomy_translations"."spree_taxonomy_id" IN (2)
  Spree::Taxon Load (0.6ms)  SELECT "spree_taxons".* FROM "spree_taxons" WHERE "spree_taxons"."taxonomy_id" = $1 AND "spree_taxons"."parent_id" IS NULL ORDER BY "spree_taxons"."id" ASC LIMIT 1  [["taxonomy_id", 2]]
#<NoMethodError: undefined method `id' for nil:NilClass>
Cannot assign Taxon [''] to Product ['SST-01 - Stratocaster']
Product assigned to Taxons : []

I've tried with only "Rubros>Guitarras" hierarchy and same issue.

UPDATE:
Now it's working ok, I had an issue with the database, the root taxon wasn't created.

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.