1) Go to checkout.
2) Submit the page without filing the required address fields (page reloads with errors of missing values)
3) Select "My xxxinformation is the same as my xxx information. ".

I get this exception through ajax:
EntityMetadataWrapperException: Unable to get the data property commerce_total as the parent data structure is not set. in EntityStructureWrapper->getPropertyValue() (442 von /entity/includes/entity.wrapper.inc).

I'm using current dev (2012-Jul-04). Can someone reproduce this error?

Comments

checker’s picture

Title: Address copying does not work if there are form errors before you activate the checkox » Address copying does not work if there are form errors before you activate the checkkox

edit issue title

checker’s picture

Title: Address copying does not work if there are form errors before you activate the checkkox » Address copying does not work if there are form errors before you activate the checkbox

edit issue title again...

checker’s picture

Status: Active » Closed (cannot reproduce)

I tested this with a fresh new installation and I can't reproduce my issue.

checker’s picture

Status: Closed (cannot reproduce) » Active

This bug happens on the following situation:
- using commerce_shipping
- using a rule that fires commerce_shipping_rate_apply() on "update existing commerce order"

So perhaps it is a commerce_shipping bug.

See:
commerce_shipping.module
commerce_shipping_add_shipping_line_item()
$order_wrapper->commerce_line_items[] = $line_item;

This line is not the root but causes the fatal error.

checker’s picture

Project: Commerce Core » Commerce Shipping
Component: Checkout » Code
checker’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
googletorp’s picture

Project: Commerce Shipping » Commerce Core
Version: 7.x-2.x-dev » 7.x-1.x-dev
Component: Code » Customer

Address copying use what's created in Drupal Commerce core now - which is in dev. I don't know if that is what you do use - but moving it there for it to get resolved.

checker’s picture

Sorry, the issue title is obsolete I guess. As I mentioned in #4 I 'm not sure if it is a address copying bug anymore.

The bug is similar to drupal.org/node/1379046#comment-6149814 #1379046: Getting a 'EntityMetadataWrapperException' error at checkout and on update.php

I will test it on a fresh installation again.

rszrama’s picture

Project: Commerce Core » Commerce Shipping
Version: 7.x-1.x-dev » 7.x-2.x-dev
Component: Customer » Code

Yeah, from the looks it was originally based around Commerce's address copying but then transformed into a potential Shipping issue. Can you update the issue title when you recheck the problem?

checker’s picture

StatusFileSize
new61.33 KB
new384 bytes

This issue is reproduceable on a fresh installation.

Drupal Commerce 7.x-1.x-dev 2012-Aug-19
Commerce Shipping 7.x-2.x-dev 2012-Jul-25
Commerce Flat Rate 7.x-1.x-dev 2011-Dec-15

No customization.

  • add a flat rate shipping
  • enable copying address
  • add rule "Apply shipping rate to an order" -> "After updating an existing commerce order"
  • add product
  • add product to cart
  • go to checkout
  • submit
  • come back with errors because of missing fields
  • click "My shipping information is the same as my billing information."
  • error

Use case: If an order is updated also shipping costs should be recalculated.

Auto shipping issue

rszrama’s picture

Status: Active » Closed (cannot reproduce)

On further testing, I can't confirm this bug. If I do the same process without using your rule to automatically apply shipping to orders on update, it works just fine. I think the problem is with your rule. The way the module works, you're not really supposed to be adding shipping like this, and especially not on an event that's going to be so constantly used as "After an order has been updated." Note that this is going to reapply shipping every single time the order is saved, even if the customer selected a different service or long after the order has completed checkout.

The particular error you're getting doesn't make sense if your order does in fact have the commerce_total price field on it (see the "Field list" report to confirm). If that field is there, then all I can figure is there's something jinky in the combination of rules you're creating, since there's another default rule that manually deletes shipping line items under certain conditions. The fact that this centers around address copying feels like a red herring, but it could be that in my work on address copying with respect to automatic recalculation of shipping services I have changed something that removes this error.

ivanbueno’s picture

I encountered this issue also. The error occurs inside the validation callback of the checkbox:

function commerce_customer_profile_copy_validate($element, &$form_state, $form)

The issue is that the $form_state['order'] inside this function is already stale. The order inside this $form_state may contain commerce_line_items (shipping) that already has been deleted / "order updated" in the other form hooks in commerce_shipping.checkout_pane.inc.

Here's a temporary patch:

Index: profiles/commerce_kickstart/modules/contrib/commerce/modules/customer/commerce_customer.module
===================================================================
--- profiles/commerce_kickstart/modules/contrib/commerce/modules/customer/commerce_customer.module	(revision 3818)
+++ profiles/commerce_kickstart/modules/contrib/commerce/modules/customer/commerce_customer.module	(working copy)
@@ -1300,6 +1300,7 @@
  * Element validate callback: Pertaining to the "copy profile" checkbox.
  */
 function commerce_customer_profile_copy_validate($element, &$form_state, $form) {
+  $form_state['order'] = commerce_order_load($form_state['order']->order_number);
   $triggering_element = end($form_state['triggering_element']['#array_parents']);
   $pane_id = reset($element['#array_parents']);

A better solution may be having a proper $form_state['rebuild'] = TRUE in one of the checkout panes.

checker’s picture