Using the module with commerce_flat_rate I've defined a flat_rate service but on the shipping pane of the checkout, no option is shown and watchdog has the following errors:
Unable to get a data value. Error: Unknown data property commerce_shipping_service
Unable to evaluate action commerce_shipping_service_rate_order.

Comments

rszrama’s picture

Curious. Can you post a screenshot of the Rule so we can see if there are any error messages on that action. There's no particular reason it should be failing, to be honest. It just needs a proper Order parameter to work.

stevecowie’s picture

StatusFileSize
new24.71 KB
new23.58 KB
new71.34 KB

Here's the rules debug that displays on the checkout/x/shipping page, and a couple of screenshots of the flat rate rule and the shipping service I defined.

I did wonder if this might be related to the fact that I had commerce_shipping -7.1.x installed previously but upgraded to 7.2 in order to use commerce_flat_rate. So I disabled and uninstalled all commerce_shipping and flat_rate and then re-installed, but still no joy. I did also try using the shipping example that comes with commerce_shipping but that doesn't get picked up either. I'm not really up to speed on entities so the code below could be completely irrelevant but but it seems like the line_item variable that is in this function - commerce_shipping_line_item_populate - gets affected by the entity wrapper:

//dpm($line_item, "line item"); // This gets rendered
//dpm($line_item_wrapper, "line item wrapper"); //stc seems to be an empty object being rendered
$line_item_wrapper->commerce_shipping_service = $service;
$line_item_wrapper->commerce_unit_price = $unit_price;
dpm($line_item_wrapper, "line item wrapper check two"); //stc this only renders if previous two lines commented out
dpm($line_item, "line item at end of function"); //$line_item is now null

atlea’s picture

Sounds like your Shipping line item type is missing the commerce_shipping_service-field.

Go to admin/commerce/config/line-items/shipping/fields and check that you have a field named "Shipping Service".

If you don't, try the following:
- Disable Commerce Shipping module (and modules that depend on it)
- Uninstall Commerce Shipping
- (Re-)Enable Commerce Shipping
- Go to admin/config/development/performance and clear caches

Let us know if this helps. :)

Atle

stevecowie’s picture

Got this fixed by installing a different version of our database. I suspect therefore the problem arose by starting with the 1.x version of commerce_shipping and then doing an upgrade without uninstalling first. I'll try to compare dbs to see if I can find the difference - I'll post any useful information that comes up before closing this issue.

rszrama’s picture

Ok, thanks Steve. Once the upgrade path from 1.x to 2.x is tested and complete, we'll clean up the project page a bit. In fact, I'll go make a note of the incomplete upgrade path on the project page right now.

atlea’s picture

Status: Active » Needs review
StatusFileSize
new1.74 KB

Did a test from 7.x-1.0-beta4 to 7.x-2x-dev and had to resolve the following issues:

  1. update_7003 tries to rename the field shipping_method to commerce_shipping_method. commerce_shipping_service is the correct name.
  2. update.php calls flush_cache after each update_x, and therefore before the table is created in 7004.

Attached is a patch for review.

Atle

rszrama’s picture

Status: Needs review » Fixed

Hot diggety dog, thanks for the review! I'm not too enthused by leaving that check in the hook_flush_caches(), but I guess there's nothing we can do about it for now.

atlea’s picture

Yeah - me neither, but hook_flush_caches() is called so infrequent I think it will be ok..

googletorp’s picture

Project: Commerce Shipping » Commerce Flat Rate
Version: 7.x-2.x-dev » 7.x-1.x-dev

Moving this to flat rate module, since it probably belongs there.

Feel free to move it back if you find it fits commerce shipping better Ryan.

googletorp’s picture

Project: Commerce Flat Rate » Commerce Shipping
Version: 7.x-1.x-dev » 7.x-2.x-dev

Hmm, multiple windows open giving problems it seems.

googletorp’s picture

#6: The updates are in the 1.x branch and should be run there and never in the 2.x branch. The upgrades are made in such a way that they can be run in the 2.x branch, but that is only for the people who has a fully functional 2.x branch and to keep it for reference/history purpose.

In other words, this is not an error with the code, but an error in the way the site was attempted to be upgraded.

Your error is that you first need to update the 1.x branch, then you can update to 2.x branch and still this is not yet supported, so you are doing this at own risk.

I didn't see you committed this Ryan. I reverted the commit, though I kept a bit of the wording. To sum up, the 7003 and 7004 updates should be run in the 1.x branch before changing to the 2.x code, much like you upgrade other modules and major Drupal instances. If this is not done, it is an error in the upgrade path executed by the site builder.

rszrama’s picture

Ahh, I see. Sorry for screwing it up - I didn't realize those update functions were in the 1.x branch as well. If that's where they're supposed to be run, do they need to be in the 2.x branch at all?

googletorp’s picture

We need something for 7003 and 7004 to make sure all are on the same update step. The functions could be empty, but I added the actual code for history purpose. I did think it would work, so was a nice fallback to have. But since it doesn't I still think it's worth keeping for reference of the history of the module.

atlea’s picture

@googletorp: Sorry for missing this. I did not notice the field went from shipping_method to commerce_shipping_method in 1.x before finally becoming commerce_shipping_service in the 2.x branch. The comments on 7004, "Needed when upgrading from 1.x", had me thinking the updates was supposed to help migrate from 1.x to 2.x.

I suppose (at least part of) what is needed to support 1.x to 2.x is an update 7005 with the code from 7003 modified to rename commerce_shipping_method field to commerce_shipping_service? At least the patch helped me migrate from 1.x pre 7003 to 2.x-dev.

Status: Fixed » Closed (fixed)

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

ewyglend’s picture

I have this same issue. I originally had the version 7.1 installed. Doesn't sound like the patch is recommended? What would be the recommendation? To reiterate, the issue I am having is missing shipping options on the shipping page.

ewyglend’s picture

Status: Closed (fixed) » Active

Forgot to change the status to open in my previous comment

ressa’s picture

I was testing the Commerce shipping modules and got the same error after updating. I reinstalled everything using Flat Rate 7.x-1.0-beta1 and Shipping 7.x-2.0-beta1, and I can confirm that shipping now works fine.

googletorp’s picture

Status: Active » Postponed (maintainer needs more info)

Did you run the update with the code in dev, did you run the update just now?

ressa’s picture

I am not sure which version I was using to be honest. I was just testing the Commerce modules and throwing a lot of modules in my sandbox site, in rapid succession, sorry.

googletorp’s picture

Status: Postponed (maintainer needs more info) » Fixed

I'm marking this as fixed. My hunch is that the problem is not Commerce shipping itself but the shipping methods supplied by contrib modules which aren't upgradable. Since the API's have changed from 1.x to 2.x the contrib module won't work after the upgrade of commerce shipping.

ewyglend’s picture

Not sure if this makes a difference but I experience the issue with multiple methods. Either way, I am still unclear as to how to fix the issue. Clear out all shipping modules and sub-modules and reinstall?

googletorp’s picture

#22 You should take it to the sub modules instead. Like I said it requires API changes to upgrade from Shipping 1.x to 2.x. I don't know of any such module that provides an upgrade path from 1.x to 2.x. Also note it's the job of the sub module to perform the needed changes in the rule settings etc when upgrading from 1.x to 2.x.

ahimsauzi’s picture

Just solve the same issue with suggestion from #4 Thanks Steve! I went from 7.1.x to 7.2.0-beta. I unintinstall both Shipping Commerce and Flat Rate, reinstalled both and viola all worked fine following Randy's excellent tutorial.

ewyglend’s picture

Status: Fixed » Active

Still having this issue. I uninstalled everything related to shipping and reinstalled the 7.2 beta version. Is this an issue with the shipping module itself or the sub-module flat rate shipping?

googletorp’s picture

Status: Active » Fixed

This is not related to commerce shipping like I've mentioned above but sub modules.

When you upgrade from Drupal 6 to 7 you need to upgrade the contrib modules installed. The same goes when you upgrade from commerce shipping 1.x to 2.x.

Status: Fixed » Closed (fixed)

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

quardz’s picture

Randy's excellent tutorial.

The link is broken, Can you help by update it.

chanella’s picture

#18 worked for me. I uninstalled all the shipping modules and reinstalled everything using Flat Rate 7.x-1.x-dev1 and Shipping 7.x-2.0-beta1. Everything works fine now.

johns10’s picture

I am having the same issue with a fresh commerce kickstart install on an aegir host. I'm not entirely sure what's going on - haven't been able to uninstall the module, even after it's been disabled.

johns10’s picture

I was able to install commerce kickstart on the acquia development desktop stack. The modules work fine with that module. I'm going to try and get the shipping stuff working and then port it onto my public server.

speedyqueenie’s picture

Issue summary: View changes

#3 worked for me. I have been struggling with this issue for a while. I ended up fixing it by updating Commerce Shipping to 2.2 (currently the latest version), disabling the module and any dependencies, re-enabling the module and dependencies, and clearing cache. The problem was like atlea said - the Shipping line item type was missing the commerce_shipping_service field.