I needed the option to set a different message for each Node Checkout node. For instance, purchasing an event would have a message saying "This event requires registration information." or a custom product might need to say "This t-shirt requires some additional order details."

This patch adds the option to set a custom message per-node, as desired. I think everything should be per the Drupal best practices, but if I've done something particularly goofy in my code, feel free to let me know and I'll address it. Thanks!

uc_nodecheckout-6.x-2.0-beta3.patch2.85 KBsmithn.nc
Members fund testing for the Drupal project. Drupal Association Learn more


smithn.nc’s picture

Title: Set 'more information required' message per node » Set 'more information required' message per node-type

Hm. I appear to have left out an important word in my title and description. To clarify, this is a patch to set a custom message per node-type, not per node.

drewish’s picture

The indenting on

+        // Display a message so the customer isn't totally confused.

doesn't match up with the surround code.

Why did you move the message from uc_node_checkout_add_to_cart_submit() to uc_node_checkout_form_alter()?

smithn.nc’s picture

Hm. That was a while back, so I'm looking over my code again attempting to recall. Looks like it was so that it would be in the following loop beginning with "foreach (uc_node_checkout_product_map() as $type => $value)" from uc_node_checkout_form_alter, because then I would actually know what kind of $type of node it was. In hindsight, I see that I could have used $form_state['values']['node_type'] from inside the checkout_form_alter, which I didn't think about at the time.

I suppose in that light, I could move it back, however the current patch allows the message to display whenever that node edit form is viewed, even if the product wasn't just added, so again it made more sense to have it there. If you think the more general case is that people would only want it to show up immediately after adding, then the previous way is more correct. Otherwise I think this way works better, because it still displays the message if the user comes back to edit the node further.

Please let me know what you think, and I'll change it accordingly. Thanks.

asak’s picture

Nice feature - will test it out.

aidanlis’s picture

Assigned: Unassigned » aidanlis
aidanlis’s picture

Assigned: aidanlis » Unassigned
Status: Needs review » Fixed

Fixed in -dev

Status: Fixed » Closed (fixed)

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