Hello,
I have a quick question. There is a site I'm working on that has a commerce product type called "Program." This product type has a registration entity within it. Then, I have a "Program display" content type that has a product reference.
During checkout I need to ask people some optional (and anonymously-stored) questions that relate back to the product via a product reference field. For EVERY product they register for (users are only allowed to enroll once per program) I need to programmatically create a node of type "EOFA." This is all working just fine. If a user registers for 3 programs, the system creates 3 EOFA nodes that have a product reference back to their respective products. These nodes are created with uid 0 as the author, with a status of 0.
When I view one of these EOFA nodes as an administrator, I see the Manage Reservations tab (because it has a product reference to a product that has a registration entity). I see this is happening because of some code in your hook_menu_alter(). The problem is: I don't want to show the Manage Reservations tab for this content type.
I'm wondering if anyone else would benefit by being able to choose for which content types they want to see the "manage reservations" tab?
I was able to remove the tab through my own menu_local_tasks_alter(). See http://drupal.org/node/68792#comment-5797076
Am I doing this all correctly? Everything is working as expected, but I don't want to be making some mistake I don't know about.
Comments
Comment #1
agileadamBasically, user registers for a course, during checkout I show the EOFA node form in a custom checkout pane. Then, when checkout is complete, I programmatically create this EOFA node as an anonymous user with the product reference field pointing to the product_id from the line item. When I look at EOFA nodes as an administrator, I don't want them to seem like they're tied to registrations, so I use hook_menu_local_tasks_alter() to remove the "Manage Reservations" tab from the EOFA node pages.
I don't have any unneeded pieces laying around, right? The "Manage Reservations" tab actually just links to the reservations management for the associated product, right... so that could appear on 10 different content types, but they all point to the same set of registrations for the same product (if node "foo" refers to program X and node "bar" refers to program X the registration management will be affecting the same set of registrants for product X). Am I understanding correctly?
Comment #2
agileadamOne more thing... are the registrations tied in any way back to the "Program display" node? (which is the product's display node containing title, body, product reference)
Sorry to keep writing... want to be sure I'm doing this correctly.
Comment #3
jpontani commentedYea seems like everything you're doing is correct, and your understanding of it is correct as well.
Yes, the registrations are tied only to the product, not the display node.
I'll see if I can't get a way to selectively hide the tab for specified nodes.
Comment #4
agileadamThanks for the confirmation. Regarding the "Manage Registrations" tab it's not really a big deal. Thanks to hook_menu_local_tasks_alter() people can adjust accordingly.
Cheers,
A
Comment #6
jpontani commentedCommitted a settings table change in the latest commit for dev branch. This adds a new vertical tab to the node edit form called "Commerce Registration settings". Right now there is a checkbox to hide the tab if it is checked. This vertical tab only displays on nodes that have a commerce product reference field attached.
Comment #7
agileadamOoh! This sounds awesome. Should I be able to hook_form_alter() to automatically check the box to hide the tab on nodes of a certain type? Also, what are the permissions for accessing this vertical tab?
Sorry, I can just try this stuff... if you have quick answer though, I'd appreciate it.
Cheers, and THANKS!