Currently it seems the relation between orders and uc_node_checkout nodes is stored in the database, but is not exposed in the UI anywhere (except when a uc_node_checkout node is in the shopping cart).

I've attached a patch which does two things:

  • Adds an Order Pane to display all of the uc_node_checkout nodes for this order in a bulleted list, linking to the nodes. Ideally this would be integrated into the main "Products" Order Pane, but there doesn't seem to be an API for modifying other modules' Order Panes, and uc_order.module's Order Pane is hardcoded to display only uc_attributes.
  • Adds a link from the uc_node_checkout node to the corresponding order (via hook_nodeapi()).
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

smokris’s picture

fixed link on uc_node_checkout nodes to only appear on uc_node_checkout nodes (oops).

greggles’s picture

This is a great addition. I cleaned up the code a little bit and have attached it to this node.

Also attached is a screenshot of the order screen to demonstrate the value.

greggles’s picture

I was patching against the wrong branch. Let's try again...

nicoloconte’s picture

Good woork greggles ;)

KarenS’s picture

Great idea, I also notice that the order id is totally buried and inaccessible. I'm wondering how this might relate to #430016: UC Node Checkout should provide a view to query against the related checkout node, I'm thinking that would still be useful as a way to bring order information and registration information together in one view.

Planning to try this out later today.

nicoloconte’s picture

I've a problem: I can see the link "order" in all pages of my site.
Can I remove it? Is it possible?

Thanks

Nicolo'

BenStallings’s picture

Thank you, Greggles! One change I would make:

      // Link to the corresponding order
      if (isset($node->uc_order_product_id) && $node->uc_order_product_id) {
        $result = db_fetch_array(db_query('SELECT {uc_order_products}.order_id, {uc_orders}.uid FROM {uc_order_products},{uc_orders} WHERE order_product_id = %d AND {uc_orders}.order_id = {uc_order_products}.order_id', $node->uc_order_product_id));
        global $user;

to

      // Link to the corresponding order
      global $user;
      if (isset($node->uc_order_product_id) && $node->uc_order_product_id && (user_access('view all orders') || (user_access('view own orders') && $node->uid == $user->uid))) {
        $result = db_fetch_array(db_query('SELECT {uc_order_products}.order_id, {uc_orders}.uid FROM {uc_order_products},{uc_orders} WHERE order_product_id = %d AND {uc_orders}.order_id = {uc_order_products}.order_id', $node->uc_order_product_id));

That way the order link is only shown to users who are authorized to see the order.

jumpfightgo’s picture

Version: 6.x-2.0-beta3 » 6.x-2.0-beta4
FileSize
2.58 KB

Here's a new patch that works with beta4.

I included the permissions check from BenStallings in comment #7, and also wrapped the link with a span with class "uc-node-checkout-order-link" so themers can style the link as needed.

Let's get this patch applied to the next release!

Eric Link’s picture

Thanks, just applied this patch and it works great! BTW any reason it isn't in the node checkout module yet, seems like a must have, +1 from me for it. - Eric

bisonbleu’s picture

Great patch. Just what I was looking for!

One tiny glitch for me, it reintroduces the following error message:

preg_match() expects parameter 2 to be string, array given in /home/myname/public_html/mydrupalinstall/includes/bootstrap.inc on line 777.

for which there is a uc_node_checkout patch here : http://drupal.org/node/548848#comment-2692466. Should they be combined?

Norm Kosty’s picture

Thanks for the patch.

When I click thru, it takes me through as a user view into order. If there is admin status on the active user, is it possible to have an admin store order view instead? or perhaps an edit link?

:O)

ezra-g’s picture

geerlingguy’s picture

Nice - subscribe.

tchurch’s picture

subscribing

christiaan_’s picture

Thank you very much. The patch works for me !

ezra-g’s picture

Status: Needs review » Fixed

Looks good and works well in my testing.

This is committed - Thanks! http://drupal.org/cvs?commit=441916

Status: Fixed » Closed (fixed)

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

griz’s picture

Category: feature » bug
Status: Closed (fixed) » Active

Unfortunately the "Order" link shows up in RSS displays created by Views. I actually had no idea there was meant to be a link on the page anyway, having got around that problem with node.tpl.php.
I've commented lines 772 to 779, but is there any way I can do this without having to 'hack'? Such as overriding the function from a module of my own? I've done hook_form_alter and some other dabbling, but not sure how to do this properly.

Also, might I suggest that since it outputs HTML this last part (line 781 - "Link node to the corresponding order") be separated out into a themeable function?