Not sure if its because Im not using the same D6 Ubercart version as others but in 2 sites I maintain, the currency field in the order_products table does not exist, the currency is defined at a website level. This causes an error when running the Drupal migrate process. I've managed to code a "fix" but need help replacing the hard coded EUR currency to the store's default. Right now for me this could be the D6 default currency or the d8 commerce default currency, I don't really care.

Comments

willeaton created an issue. See original summary.

willeaton’s picture

StatusFileSize
new1.03 KB

Sorry, was missing some code, attached latest version. I still get some errors so I think there is more work to do also.

willeaton’s picture

StatusFileSize
new1.03 KB

Sorry, was missing some code, attached latest version. I still get some errors so I think there is more work to do also.

quietone’s picture

@willeaton, thanks for the patch. You mention you are running different Ubercart versions. Can you say which versions have this problem and which ones don't?

willeaton’s picture

Ubercart 6.x-2.4

Not sure it was a ubercart version issue...

mglaman’s picture

Status: Active » Needs review

Marking for review so we can see what the tests say.

Status: Needs review » Needs work

The last submitted patch, 3: OrderProduct.php2_.patch, failed testing. View results

willeaton’s picture

Hey, this patch isn't ready to launch as it is anyway. It needs some work to apply the proper the currency. My patch just hard codes it to euros at the moment. I'm not sure how to query the currency, I imagine it needs to be a separate query call.

mglaman’s picture

I'm not sure either.

  'price/currency_code':
    plugin: migration_lookup
    migration: ubercart_currency
    source: currency_name

Won't quite work. Since Ubercart isn't multi-currency, I suppose we could just load the first available currency and default to that.

willeaton’s picture

First available currency in D6 or D8? I think from D6 would be sufficient if possible. Have you got a patch to test this?

heddn’s picture

Seems like a duplicate to #2888764: Process plugin for default store currency. Or at least pended on that issue. Someone make a call.

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new8.05 KB

We can get the currency from the variable, uc_currency.

The source plugin now works when the currency column is present and when it is not. When it is not there it will get the currency from the variable and add it the query so the columns remain the same. Since the change is on the source plugin there are two new test for the source plugin. One with a currency column and one without.

Status: Needs review » Needs work

The last submitted patch, 12: 2854052-12.patch, failed testing. View results

quietone’s picture

Status: Needs work » Needs review

Previous CI st aborted. Test pass and ready for review.

mglaman’s picture

Status: Needs review » Reviewed & tested by the community

Tests look great, like the workaround. +1 from me!

willeaton’s picture

Patch tested on a real case, order products imported correctly and set to correct currency. I'd say this is good to release.

  • quietone committed d7254f8 on 8.x-2.x
    Issue #2854052 by willeaton, quietone: D6 ubercart OrderProduct currency...
quietone’s picture

Status: Reviewed & tested by the community » Fixed

Thanks all!

Status: Fixed » Closed (fixed)

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