Our site has a commerce shipping 1 and the flat rate module enabled with a few flat rate options. I have been trying to upgrade to shipping 2.0 (like documented in the release notes), but the database update fails:
# drush updatedb
The following updates are pending:
commerce_shipping module :
7100 - Upgrade from Commerce Shipping 1.x by renaming the commerce_shipping_method field on the shipping line item type to commerce_shipping_service and converting price components on shipping line items to the generic Shipping price component type. Before proceeding, ensure that any shipping method modules designed to work with Commerce Shipping 1.x have been disabled but not uninstalled. They may be uninstalled after the update is complete.
Do you wish to run all pending updates? (y/n): y
WD commerce_order: EntityMalformedException: Missing bundle property on entity of [error]
type commerce_order. in entity_extract_ids() (line 7562 of
/data/www/7dev/includes/common.inc).
Missing bundle property on entity of type commerce_order. [error]
Performed update: commerce_shipping_update_7100 [ok]
Finished performing updates.
(same problem if I run update.php in a browser)
Any idea what may cause this? I suppose it can be hard to find out which entity is malformed...
Another question: are there any negative side-effects if you don't run the database upgrade and just configure my new shipping services in 2.0? I tried to uninstall all shipping 1.x modules and I'm still able to see my shipping line items in old orders. This might be a quick fix for our problem, since we have very simple shipping rules.
Comments
Comment #1
rszrama commentedHmm, yeah, for some reason it looks like you have a bad order or something - can you look in your commerce_order table and see if any orders are missing a type value?
Comment #2
stroobl commentedI've been looking through the table and the only thing strange I find for now is a few orders with an empty hostname field.
Comment #3
rszrama commentedcommerce_order should be the only one available. Would a SELECT DISTINCT show empty values as well?
Comment #4
stroobl commentedYes, i does. (I tried it on the hostname field)
Comment #5
fonant commentedI get this too. Will see what I can find.
Comment #6
fonant commentedAha, in my database I have some commerce line items that reference deleted orders. This leads to the update trying to load a non-existent order, and then fails trying to save a null object with commerce_order_save().
So I fixed the update function 7100 by replacing:
with:
Comment #7
stroobl commentedSolution in #6 works for me. Thanks, Fonant!
Comment #8
makangus commentedSame issue, patch from #6
Comment #9
rszrama commentedCommitted the patch; I'd recommend cleaning out those line items that reference non-existent orders.