Dynamically Disabling Customer Profile panes
Hi I am writing a contrib module called Customer Profile Types UI through which I would like to provide a mechanism for disabling certain customer profile panes on checkout.
My purpose is for creating a drupal native CRM so that different types of membership application will have separate customer profile forms to fill out. On completion of the checkout and payment process the data from a specific for referenced through the order's reference fields will be copied using rules to a custom membership entity. The awesomeness of drupal 7 sometimes astounds me! :) Regardless the piece I am missing is the ability to control the appearance of these customer profile panes in drupal commerce.
I have created an initial method for doing this using a new event that is fired from hook_commerce_checkout_pane_info_alter that just sets enabled=false on the pane I want to disable. This works for checkout, however it does not work for after the fact when editing the order. There is also the problem that the above mentioned hook does not provide any sort of context as to which order you are working with. If I had that it would make the process much easier. I am using commerce_cart_order_load() to get the context, but that obviously only works during the checkout process and not when editing an order. Also, if I am editing order commerce_cart_order_load() will give me an improper context since it will be referencing an order that may or may not be in the cart as opposed to the one I am editing.
Ok so that is the background story, here are some questions:
Are there any methods you can suggest that might work better then this?
Are there other ways to get the proper order context?
Are there events or hooks that fire before displaying the order's edit page aside from hook_form_alter.
cheers.
Comments
D7 CRM projects
I'm assuming you're already familiar with the D7 CRM efforts currently underway, but I figured I'd toss out the links anyway. The Party module has been under heavy development for a few months at http://drupal.org/sandbox/joachim/1260650 and progress is coming along well, and it looks like code is available now for the CRM Core project (http://drupal.org/project/crm_core) that has been under development at Trellon for a while.
Both projects are probably ready for some work on Commerce integration and, personally, I'd love to see a Membership module sitting on top of them...just throwing that out there.