Hello,
I think this module let users re-order products that are "unpublished", and I think it may not be possible.
Regards

Comments

calbasi’s picture

I think so...

maverick619’s picture

On line 82 change:

$result = db_query("SELECT nid, qty, data FROM {uc_order_products} WHERE order_id = %d", $order_id);

to

$result = db_query("SELECT uc.nid, uc.qty, uc.data FROM {uc_order_products} as uc INNER JOIN {node} as n ON uc.nid = n.nid WHERE uc.order_id = %d AND n.status=1", $order_id);

This will make sure the node is published when attempting a reorder.

maverick619’s picture

Also, if you wanted to tell the user that deleted/unpublished items are no longer available do the following:

Replace the query again with
$result = db_query("SELECT uc.nid, uc.qty, uc.data, uc.title, n.status FROM {uc_order_products} as uc LEFT JOIN {node} as n ON uc.nid = n.nid WHERE uc.order_id = %d", $order_id);

This will add the order item title and the node status to the object (status will be 1 for published, 0 for unpublished or NULL for deleted)

Now inside the while loop put all the current code inside the following condition:

 if ($product->status == '1') {
   // current code
} else {
   drupal_set_message($product->title." is no longer available", 'error');
} 

This will add any deleted/unpublished order items to an error message to be displayed after the redirect.

tr’s picture

Issue tags: -Ubercart

Thanks. I will be making these changes in the next few days.

calbasi’s picture

Hello,

Is the maverick619 code added to the dev version yet?

Regards