At the end of the checkout process when anonymous checkout is enabled, the row which is inserted in to uc_recurring_users doesn't contain the new user's uid.
There is this code in uc_recurring.module which is supposed to create the link
/**
* Implementation of hook_uc_checkout_complete().
*
* This function is require to complete recurring orders for anonymous
* purchases as the uid is not set until the order has completed checkout.
*/
function uc_recurring_uc_checkout_complete($order, $account) {
$fees = uc_recurring_get_fees($order);
foreach ($fees as $fee) {
if ($fee->uid == 0) { // check for anonymous uid
$fee->uid = $order->uid;
uc_recurring_fee_user_save($fee);
}
}
}
However on further investigation, i found that the $fees list is empty, so uc_recurring_fee_user_save($fee) never fires.
I think this is because uc_recurring_get_fees assumes that the fee already in the table has a order_product_id to link to the order, but maybe because this a recurring order. uc_recurring_order_process_order is setting the $fee->order_product_id = NULL and unsetting order_product_id. I assume because it's not a recurring fee and the product ID is not related? I'm a bit out of my depth here..
Anyway, essentially the SQL query to get the fee objects in uc_recurring_get_fees is returning empty because there are no order_product_id's saved with the fee...
So, my temporary fix for this is to create my own implementation of uc_recurring_uc_checkout_complete with the following line:
db_query("UPDATE {uc_recurring_users} SET uid = %d WHERE order_id = %d",$account->uid,$order->order_id);
This creates the link and enabled the user to see their recurring fee when the log in so they can edit cc details and cancel the fee.
maybe it's worth putting this in the uc_recurring_order.module?
e.g. uc_recurring_order_uc_checkout_complete
Or maybe uc_recurring_get_fees should be getting fees based on order_id instead of order_product_id
If this is the correct approach i'd be happy to submit a patch. let me know :)
-Tim
Comments
Comment #1
univate commentedI'm not aware of a problem with recurring products (uc_recurring_product), is this just an issue with recurring orders (uc_recurring_order)?
Comment #2
thtas commentedYes, this is using recurring orders.
Comment #3
thtas commentedthis is about recurring orders, not recurring products.
Comment #4
vmi commentedThis issue was filed against 6.x-2.0-alpha6 and has been open for over a year.
I'm currently experiencing a related problem with version 6.x-2.0-beta1 and have cross referenced this issue under a new project issue: #1423482: Anonymous checkout for Recurring Product not listed properly under Subscription Manager and My Account
I would appreciate it if anyone here could please advise on the best approach to the above referenced issue.
Thanks.
Comment #5
wizonesolutionsThis is a duplicate of #1423482: Anonymous checkout for Recurring Product not listed properly under Subscription Manager and My Account at this point now.