When trying to import products, it failed giving the following error for each attempted import:
Illegal offset type in isset or empty File /home/quickstart/websites/sooper74.dev/sites/www.sooperthemes.com/modules/commerce/commerce.module, line 414
This error resulted from passing an array into the price field for product entities instead of a string.
This happens in product.inc line #73:
$arguments = MigrateCommercePriceFieldHandler::arguments(array('USD'));
Even if this worked it would be bad for every shop that uses a currency other than USD.
I think this is easily fixed by simply removing the argument here, because in the price field handler it does this:
$currency_code = isset($arguments['currency_code']) ? $arguments['currency_code'] : commerce_default_currency();
So when the argument is omitted it loads the default currency that is configured for the Commerce installation.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | commerce_migrate-1446898-0-use-default-currency.patch | 2.08 KB | dwkitchen |
Comments
Comment #1
vaccinemedia commentedI get the same error. I'm trying to upgrade my Ubercart 2 store to a commerce Drupal 7 installation. I've imported my users from the old store and now I;m trying to import products with this error message. What's the solution?
Comment #2
dwkitchen commentedfortina: I deleted line 73 and then changed every reference to USD to (in my case) GBP
Comment #3
dwkitchen commentedHere is a patch that removes the enabling of USD and will save the incoming values as your stores default currency instead of USD.
I might be possible to go further and and do this based on the currency used in Ubercart.
Comment #4
pianomansam commentedI also ran into this issue, and the patch from #3 fixed my problem.
Comment #5
mandreato commented#3 worked for me too
Comment #6
torgospizzaSo glad I found this issue, as I ran into it as well. The patch in #3 solved it and allowed me to import my products.
The patch makes sense because the value that commerce_currency_load() seems to always be a string, and not an array; using an array as a key to another array results in Illegal offset error as described in http://php.net/manual/en/language.types.array.php
Please consider committing this!
Comment #7
mariagwyn commented+1 to patch, made my import work.
Comment #8
rfayCommitted, http://drupalcode.org/project/commerce_migrate.git/commitdiff/dd12268
Thanks so much!
Comment #9
rfay