I've set a pickup service, but when the customer look at the order confirmation the shipping address is still there. Any chance to resolve this issue?
thanks in advance

{ "rules_hide_shipping_address_from_order_when_pickup_method" : {
    "LABEL" : "Hide Shipping Address From Order When Pickup Method",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "commerce_shipping", "commerce_rules_extra", "rules", "entity" ],
    "ON" : [ "commerce_order_view" ],
    "IF" : [
      { "commerce_shipping_compare_shipping_service" : {
          "commerce_order" : [ "commerce_order" ],
          "service" : "commerce_pickup__node__50"
        }
      }
    ],
    "DO" : [
      { "commerce_rules_extra_change_pane" : {
          "pane_id" : "customer_profile_billing",
          "page_id" : "\u003Csame\u003E",
          "enabled" : 0
        }
      },
      { "drupal_message" : { "message" : "test messaggio to check if rule works" } }
    ]
  }
}

Comments

MarcElbichon’s picture

Does Drupal message is printed ?
Can you have a look to rules debug trace to see if commerce_rules_extra_change_pane action is fired ?

Anonymous’s picture

yes the message is printed, how do look at rules debug trace?
thanks

MarcElbichon’s picture

In admin/config/workflow/rules/settings, check Log debug and select always in Show debug information

Anonymous’s picture

Rules debug information:
" Reacting on event Commerce Order is viewed.

0 ms Reacting on event Commerce Order is viewed.
9.643 ms Evaluating conditions of rule Hide Shipping Address From Order When Pickup Method. [edit]
12.567 ms The condition commerce_shipping_compare_shipping_service evaluated to TRUE [edit]
12.578 ms AND evaluated to TRUE.
" Rule Hide Shipping Address From Order When Pickup Method fires. [edit]
0 ms Rule Hide Shipping Address From Order When Pickup Method fires.
0.157 ms Evaluating the action commerce_rules_extra_change_pane. [edit]
0.383 ms Evaluating the action drupal_message. [edit]
2.198 ms Rule Hide Shipping Address From Order When Pickup Method has fired.
14.824 ms Finished reacting on event Commerce Order is viewed.

MarcElbichon’s picture

Can you tried with 1.x version ?

Anonymous’s picture

here the log for version 1.x

Rules debug information:
" Reacting on event Commerce Order is viewed.

0 ms Reacting on event Commerce Order is viewed.
9.887 ms Evaluating conditions of rule Hide Shipping Address From Order When Pickup Method. [edit]
12.501 ms The condition commerce_shipping_compare_shipping_service evaluated to TRUE [edit]
12.513 ms AND evaluated to TRUE.
" Rule Hide Shipping Address From Order When Pickup Method fires. [edit]
0 ms Rule Hide Shipping Address From Order When Pickup Method fires.
0.146 ms Evaluating the action commerce_rules_extra_change_pane. [edit]
1.749 ms Evaluating the action drupal_message. [edit]
3.593 ms Rule Hide Shipping Address From Order When Pickup Method has fired.
16.155 ms Finished reacting on event Commerce Order is viewed.

MarcElbichon’s picture

I haven't seen you used commerce_order_view event.
commerce_rules_extra_change_pane only works with process checkout pane event.

I've tried to do the work, but hooks in commerce_order_view don't have infos for panes.
You can do this by your own by implementing hook_commerce_order_view_alter(&$infos, $entity_type).

function yourmodule_commerce_order_view_alter(&$infos, $entity_type) {
   if (.....) {
     unset($infos["commerce_customer_billing"]);
  }
}
MarcElbichon’s picture

I maybe found a solution.
Can you add these lines at the end of includes/commerce_rules_extra_change_pane.inc

Clear caches and retry

function commerce_rules_extra_commerce_order_view_alter(&$infos, $entity_type) {
    global $pane_changes;
    if (! $pane_changes)
        $pane_changes = array ();

    foreach ( $pane_changes as $pane_id => $changes ) {
       $field_name = variable_get('commerce_' . $pane_id . '_field', '');
       if (empty($field_name)) {$field_name = $pane_id;}
       if ($changes ["enabled"] == false) {
           unset($infos[$field_name]);
       }
    }
    
}
Anonymous’s picture

yessss, it works!!!
many thanks
grazie mille!!!

MarcElbichon’s picture

Do you have declare a rule for Process checkout pane event ?
I think this could be interesting to trigger this event when viewing order so you should have to declare rule only one time.
I can add too a parameter to event meaning if this event should be fired when viewing order.
What do you think of that ?

Anonymous’s picture

sorry I'm not expert, I'm trying to show pickup address into order page. I'll send you rule exports asap.

MarcElbichon’s picture

Status: Active » Closed (fixed)

If you want to share rule config for "Process checkout pane" and "Order is viewed" events, create a component (rule type) with your conditions and "change pane properties" action.
Create 2 rules for "process checkout pane" and "order is viewed" events and select the component as action.

Only enabled and weight properties can be used for Order is viewed event.

Anonymous’s picture

ciao Marc, here are the two rules I'm using to show/hide shipping/pickup addresses.

{ "rules_nascondi_shipping_address_se_pickup" : {
    "LABEL" : "Nascondi Shipping Address se Pickup",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "commerce_shipping", "commerce_rules_extra", "entity" ],
    "ON" : [ "process_checkout_pane", "commerce_order_view" ],
    "IF" : [
      { "NOT commerce_shipping_compare_shipping_service" : {
          "commerce_order" : [ "commerce_order" ],
          "service" : "commerce_pickup__node__38"
        }
      }
    ],
    "DO" : [
      { "commerce_rules_extra_change_pane" : {
          "pane_id" : "extra_pane__node__38",
          "page_id" : "\u003Csame\u003E",
          "enabled" : 0
        }
      },
      { "commerce_rules_extra_change_pane" : {
          "pane_id" : "customer_profile_shipping",
          "page_id" : "\u003Csame\u003E",
          "enabled" : 1
        }
      }
    ]
  }
}
{ "rules_nascondi_pickup_address_se_shipping" : {
    "LABEL" : "Nascondi Pickup Address se Shipping",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "commerce_shipping", "commerce_rules_extra", "entity" ],
    "ON" : [ "process_checkout_pane", "commerce_order_view" ],
    "IF" : [
      { "commerce_shipping_compare_shipping_service" : {
          "commerce_order" : [ "commerce_order" ],
          "service" : "commerce_pickup__node__38"
        }
      }
    ],
    "DO" : [
      { "commerce_rules_extra_change_pane" : {
          "pane_id" : "customer_profile_shipping",
          "page_id" : "\u003Csame\u003E",
          "enabled" : 0
        }
      },
      { "commerce_rules_extra_change_pane" : {
          "pane_id" : "extra_pane__node__38",
          "page_id" : "\u003Csame\u003E",
          "enabled" : 1
        }
      }
    ]
  }
}
Anonymous’s picture

ciao Marc, do you know how to display pickup address into order confirmation at http://example.com/user/[uid]/orders/[orderid]

and also how to show pickup address into the emailed order confirmation?

thanks in advance

MarcElbichon’s picture

Anonymous’s picture

ciao Marc, I've a budget to implement this hack. So if you would like to help me in coding I'll be happy to pay you for that. I had a look into panels, pm_existing_pages modules, but I can't override order page with "user/%uid/orders/%order-id". thanks in advance

MarcElbichon’s picture

Sorry, but I do not have time to investigate further. Maybe you can have a look to http://drupal.stackexchange.com/questions/40307/how-to-customize-commerc...

Anonymous’s picture

Status: Closed (fixed) » Active

since last update the rule in not honored anymore:

{ "rules_hide_shipping_address_from_order_when_pickup_method" : {
    "LABEL" : "Hide Shipping Address From Order When Pickup Method",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "commerce_shipping", "commerce_rules_extra", "rules" ],
    "ON" : [ "process_checkout_pane" ],
    "IF" : [
      { "commerce_shipping_compare_shipping_service" : {
          "commerce_order" : [ "commerce_order" ],
          "service" : "commerce_pickup__node__38"
        }
      }
    ],
    "DO" : [
      { "commerce_rules_extra_change_pane" : {
          "pane_id" : "customer_profile_shipping",
          "page_id" : "review",
          "enabled" : 0
        }
      },
      { "drupal_message" : { "message" : "check if rules is fired" } }
    ]
  }
}

I found you already inserted #8 into module, so didn't hack the module with it.

MarcElbichon’s picture

Can you clear cache ?

Anonymous’s picture

I did, but no chance

MarcElbichon’s picture

Can you have a look to rules debug trace if event is fired, condition is true and action is done ?
Maybe can i have access to your site ?

Anonymous’s picture

ciao Marc,
due to a deadline reason I temporary abandoned the usage of this module. And I'm waiting some custom code from a developer. I'll be back to you in case my needs are going back to this module. thanks for you assistance.

Perignon’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

Going to mark this closed. If the issue is still needed please reopen the ticket!

fonant’s picture

Status: Closed (won't fix) » Active

This used to work, but doesn't any more, either to hide or show a pane.

I was using it to hide the "Shipping address" and "Shipping method" panes when there weren't any shippable products in the cart. Not essential, but a nice enhancement to the checkout process.

Logging rule execution shows that the "commerce_rules_extra_change_pane" action is being called, it just no longer does anything.

Looks like hook_commerce_order_view_alter no longer exists?

Do we need to implement hook_commerce_checkout_pane_info_alter instead? Would be nice to avoid using global variables, too.

Perignon’s picture

Assigned: Unassigned » Perignon
mksweet’s picture

Seconding @fonant's comment #24. The rule to hide shipping doesn't work for me either. Only works with version 1x, not version 2x

Perignon’s picture

Looks like hook_commerce_order_view_alter doesn't exist anymore, you are right.

ulia’s picture

Can't hide Shipping pane either. Condition for the rule: Shipping line item exists: pick up. CRE 7.x-2.1 Rules 7-2.9. Any updates or some solution? Thanks in advance.

Perignon’s picture

Sorry, I been neck deep in other modules. I need to throw some attention toward this module.

Perignon’s picture

As stated in #24, the hook is now gone. I'm working up a solution, should have something posted soon for testing.

jrokisky’s picture

As this no longer is functioning correctly,
can the line under 'Rules Actions':
'Change pane properties : Change visibility, page, weight of a pane'

be removed to avoid confusion.

Thank you!

apaderno’s picture

Title: rule not honored: shipping address pane is not hidden in the order page » Rule isn't honored: The shipping address pane is not hidden in the order page