I have a pretty vanilla Commerce Shipping 1.0 install, and I have about 18 months worth of accumulated shipping data that I would like to preserve. If I upgrade to Commerce 2.0, what happens to my shipping history? I have heard conflicting reports.

The only odd thing I did was add a flat rate for shipping. I didn't do any extensive modification to the rules for the shipping system.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rszrama’s picture

It would be great if you could run an update test in a dev site and let us know, to be honest. : )

crazybutable’s picture

alright, give me a few days to create my dev site. (I have three kids, I'll try to get to it this weekend.) ;)

googletorp’s picture

The shipping info should be maintained - but since we haven't had a lot of sites to run tests on - and the shipping methods doesn't work in both 1.x and 2.x, this has been a bit complicated to test.

crazybutable’s picture

Alright, I will test it on my cloned dev site and I will report back (it's mostly working, but I need to configure MAMP a bit more.)

cvangysel’s picture

Assigned: Unassigned » cvangysel
Status: Active » Needs review
FileSize
3.19 KB

First shot at a patch that makes use of the Batch API so that the upgrade doesn't fail on large installations.

The patch also updates the price components of the line items to the general 'shipping' type, all old data is stored in the data array of the component so that custom shipping modules can also upgrade.

cvangysel’s picture

Woops, there was still some non-working code in there.

crazybutable’s picture

Hmm, I haven't used that patch, but on the other hand, I don't have any custom shipping modules.

Here, let me explain what I've done so far.

I set up my dev site, and I deleted the old 1.x commerce shipping and commerce shipping flat rate modules. Then I just installed the 2.x version of those modules. I also installed Physical fields and Commerce Physical so I can add ship by weight support.

Unfortunately, now I have no UI to configure any shipping methods! When I go to Store->Configuration there is absolutely nothing there related to shipping at all. I am trying to follow this video (http://vimeo.com/33838479) and I am stuck 43 seconds in.

Anyway, is something broken? Am I missing something obvious?

rszrama’s picture

Sounds like you just need to clear the cache to reset the menu items. Sometimes they don't get generated on install for one reason or another.

rszrama’s picture

Component: Miscellaneous » Documentation
Assigned: cvangysel » Unassigned
Status: Needs review » Fixed

Alrighty guys, I just spent a few hours on this and think I've got it sorted out. cvangysel's patch was a great starting point. The need for a batch process is clear, and we definitely needed to update price components as well. I also noticed in testing that Commerce Shipping Flat Rate was using the quantity on the shipping line item when a flat rate was defined that priced the shipping per product or product line item. Since cvangysel's patch was already taking the line item total price and setting that to the unit price, I've gone the extra step to reset the quantity to 1 so we don't end up multiplying the shipping cost of past orders when the line item is saved. I also updated the comments and return value for the update function to provide more context and instruction.

The full update process is:

  1. Ensure you're running the latest version of Commerce Shipping 1.x. (I'll tag a 1.1 before rolling the 2.0 tonight.)
  2. Backup your site - particularly the database.
  3. Disable (but to not uninstall) any shipping method module you have that works with Commerce Shipping 1.x.
  4. Replace the commerce_shipping module folder with the new Commerce Shipping 2.x module; don't just copy one into the other as files have been added / removed.
  5. Run update.php.
  6. Uninstall the shipping method modules you disabled earlier.
  7. If you were using Commerce Shipping Flat Rate, install Commerce Flat Rate and rebuild your flat rate shipping services in the new interface.
  8. Delete the rules created for those shipping methods after copying any necessary logic over to the new shipping method / service rule configurations.

We can save existing shipping line item data, but we cannot translate rules pertaining to Commerce Shipping 1.x shipping methods into the rules required to evaluate shipping methods and calculate shipping service rates in Commerce Shipping 2.x. Any existing shipping line item that had a custom price component type has been converted to the generic "Shipping" price component type, but the old price component type has been saved in the unit price array if necessary for historical purposes. Additionally, the commerce_shipping_method field on the shipping line item type has been replaced with one called commerce_shipping_service, so any code, Rules, or Views configured to read that field need to be updated.

All of this information will be in the Commerce Shipping 2.0 release notes.

Finally, I was able to reproduce the menu item issue and implemented hook_modules_enabled() in commerce_shipping.module to check for newly enabled modules that define shipping methods or services. If one is found, default rules and the menu are rebuilt.

Final update patch: http://drupalcode.org/project/commerce_shipping.git/commitdiff/52ed804

Status: Fixed » Closed (fixed)

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

crazybutable’s picture

Status: Closed (fixed) » Active

Sorry for being away for a bit. Yesterday I fired up a new dev site, updated all installed modules to the latest versions, and attempted to follow all of the instructions listed on this page: http://drupal.org/node/1841266

Everything looks like it worked but I got to the end of the steps and I do not have a shipping methods configuration menu item. I flushed all caches and it still does not show up. I can configure permissions for modifying Commerce Flat Rate shipping rules, but I have no menu item to do so.

Up above I noticed you linked to a "final patch". My question is, do I need to apply the patch you linked to anything? I wasn't sure because Commerce Shipping and Commerce Flat Rate have both been updated since you posted. Also there is no mention of patching on the Commerce Shipping page.

If I need to apply the patch, what package do I apply the patch to? And when (at what step in the above steps) do I apply the patch?

Let me know if you need any more information. I'm pretty handy with the SQL and the PHPs so if you need to know any information about my site to track this problem down I can provide it.

rszrama’s picture

Status: Active » Closed (fixed)

Sorry, it's been too long for me to do much more than affirm that you don't need to apply any additional patches for this to work. On tests, it was working fine. If the menu item is missing, just try browsing directly to the URL and going from there.

crazybutable’s picture

Thank you! After digging into it a bit more, I think I figured out what is going on. I will try to reproduce the problem and will open a new issue if necessary.