The store information is stored as variables, so there is no need to write a new source plugin. And the destination is an entity, so all the ground work is there. Just need to get the processing correct.

The variables:

  • uc_store_name --> name
  • uc_store_owner --> ??
  • uc_currency_code --> default_currenyc_code
  • uc_store_street1 --> address/??
  • uc_store_street2 --> address/??
  • uc_store_zone --> address/??
  • uc_store_city --> address/??
  • uc_sotre_postal_code --> address/??
  • uc_store_country --> address/??
  • uc_store_phone --> ??
  • uc_store_fax --> ??
  • uc_store_email --> mail
  • uc_store_email_include_name

The owner seems to be just a name in Ubercart D6, but D8 Commerce looks for a user with the name. Tried, a destination of 'address/' for the address but that didn't work.

Comments

quietone created an issue. See original summary.

quietone’s picture

StatusFileSize
new594.24 KB

This is not complete, the address, owner and billing_countries need to be figured out.

If you want to work on this patch, and you want to use a test fixture, use the one at #2871811: New complete fixture for Ubercart D6 schema.

quietone’s picture

Grrr, this is the wrong patch.

quietone’s picture

StatusFileSize
new2.42 KB

Here is the right patch. Still needs some variables, namely the address, migrated. Not sure why the address isn't being saved.

quietone’s picture

Parent issue: » #2872836: [Meta] Ubercart 6
quietone’s picture

Status: Active » Needs review
StatusFileSize
new3.84 KB

Adding the address migration. To run the tests get the latest patch at #2871811: New complete fixture for Ubercart D6 schema.

Still to investigate: owner, billing countries and adding the store migration as a dependency on other d6 ubercart migrations.

quietone’s picture

Title: [Ubercart D6] Migrate store » [Ubercart] Migrate store
Component: Ubercart D6 » Commerce Migrate Ubercart
StatusFileSize
new9.64 KB

Merged d6 and d7 store migration.

To run the tests get the latest patch at #2871811: New complete fixture for Ubercart D6 schema and #2871812: New complete fixture for Ubercart D7 schema.

Still to investigate: owner, billing countries and adding the store migration as a dependency on other ubercart migrations.

quietone’s picture

+++ b/migration_templates/d6_ubercart_store.yml
@@ -0,0 +1,42 @@
+  default_currency: uc_currency_code

The currency code is migrated, but the currency may not be installed. Maybe a new migration to add all the currencies that exist on the source site.

quietone’s picture

StatusFileSize
new8.21 KB

Adding the dependency to currency here.

quietone’s picture

Status: Needs review » Needs work

These migrations need a source provider defined. And there are new line errors in the patch.

quietone’s picture

StatusFileSize
new8.2 KB

Add the source provider.

Next, is to add this as a dependency of other migrations.

quietone’s picture

StatusFileSize
new15.11 KB
new7.76 KB

I seem to be all thumbs today, let's see if this passes tests.

quietone’s picture

StatusFileSize
new15.11 KB

How to run tests? Or is this another manifestation of my 'all thumbs' day?

quietone’s picture

Status: Needs work » Needs review

Yep, all thumbs,

The last submitted patch, 11: 2872255-11.patch, failed testing.

The last submitted patch, 12: 2872255-12.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 13: 2872255-12.patch, failed testing.

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new15.19 KB

That was not my fingers, HEAD moved at the same minute I uploaded the patch.

Here is the reroll.

Status: Needs review » Needs work

The last submitted patch, 18: 2872255-18.patch, failed testing.

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new15.21 KB
new351 bytes

Forgot to test d7. Just needed to add the currency migration to the test.

quietone’s picture

StatusFileSize
new15.37 KB
new2 KB

Fix comments, add the uid migration to the d7 store migration and update the test.

mglaman’s picture

  1. +++ b/migration_templates/d6_ubercart_product_variation.yml
    @@ -25,3 +25,6 @@ process:
    +migration_dependencies:
    +  required:
    +    - d6_ubercart_store
    

    Shouldn't all Ubercart migrations have this dependency?

  2. +++ b/tests/src/Kernel/d6/Ubercart/OrderItemTest.php
    @@ -34,12 +34,9 @@ class OrderItemTest extends Ubercart6TestBase {
    -    $this->createDefaultStore();
    +    $this->migrateStore();
    ...
    -      'd6_filter_format',
    -      'd6_user_role',
    -      'd6_user',
    

    Why not add the store migration here instead of another helper?

  3. +++ b/tests/src/Kernel/d6/Ubercart/OrderTest.php
    @@ -32,7 +32,6 @@ class OrderTest extends Ubercart6TestBase {
    -    $this->createDefaultStore();
    

    Orders technically must belong to a store.

  4. +++ b/tests/src/Kernel/d6/Ubercart/ProductTest.php
    @@ -30,7 +30,7 @@ class ProductTest extends Ubercart6TestBase {
    -    $this->createDefaultStore();
    +    $this->migrateStore();
    

    See previous, why we don't add store to migration. Or does it now resolve dependencies and run them?

quietone’s picture

StatusFileSize
new15.45 KB
new937 bytes

1,3,4. About dependencies, migrate will figure it out. We don't need to add d6_ubercart_store to every migrations. Just thinking about having to add every needed migration to a new migration makes my head hurt.

2. The migrate helpers can be rather useful. There appear in the D6 migrations and work well. For example if one needs users, the simply use $this->migrateUsers(FALSE); saving having to remember or search for all the migrations, entities and schemas that need to be installed for the user migrations. In this case, it makes sense to me to have this since every migration will need a store and even though it is only two migrations it seem natural to think in terms of give me a store, without worrying about the details.
And thats for the question, I spotted that the currency migration was done twice.

Status: Needs review » Needs work

The last submitted patch, 23: 2872255-23.patch, failed testing. View results

mglaman’s picture

In this case, it makes sense to me to have this since every migration will need a store and even though it is only two migrations it seem natural to think in terms of give me a store, without worrying about the details.

That's not how Commerce works though. It always assumes a store is present. We need to make sure all migrated data has relationships to the store (products, orders.)

mglaman’s picture

Status: Needs work » Needs review

Tests pass

bojanz’s picture

We always need a store, so this migration is absolutely required. Otherwise we can't migrate products or orders, both of which need a store reference.

quietone’s picture

Issue tags: +blocker

  • mglaman committed aa6b5eb on 8.x-2.x authored by quietone
    Issue #2872255 by quietone, mglaman: [Ubercart] Migrate store
    
mglaman’s picture

Status: Needs review » Fixed

Thanks, quietone!

Made a few changes in commit:

  • Moved store migration depndency from uc6 variants to product (technically _is_ there.)
  • Added store dependency to orders (and to test for createStore)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.