Active
Project:
UC Node Checkout
Version:
6.x-2.0-beta8
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
3 Aug 2011 at 16:57 UTC
Updated:
15 Mar 2012 at 03:15 UTC
Node Checkout Order Status always show '0'.
Comments
Comment #1
bsandor commentedI opened another ticket as well: http://drupal.org/node/1238392 that would solve this for me.
Anyway what I need is to know if the payment that is related to current node is completed or not.
Comment #2
bsandor commentedComment #3
bsandor commentedWell this might be related to the only modification I did:
http://drupal.org/node/1131406#comment-4555358
Comment #4
dsbrianwebster commentedThe reason the Node Checkout Order Status always shows '0' is because the CCK field used for order status needs to be a text field not numeric. This field gets populated with the real order status (i.e. 'pre_checkout', 'Payment Received' etc.) not a boolean.
While this solves the problem of it being 0, it in turn reveals that the module seems to have only half addressed the updating of this field. The field never advances past 'in_checkout' and it doesn't respond to order status changes made by admins through the order form. After looking through the module I noticed the problem is that there is no 'update' behavior on hook_order() -- called on line 812
Adding the code below will fix the updating on checkout, advancing the status past 'in_checkout' to the proper value. It also works on subsequent changes to the order status.
Here's the code -- paste it at LINE 829 of uc_node_checkout.module, after the 'break;' (note:
<?php ?>tags included for highlighting and readability, paste only the code between them.)Remember, You must FIRST correct the CCK field type if you had it set to numeric. Also, It should be noted that there appear to be some redundant calls to the uc_node_checkout_update_content_fields() function. The call in the 'submit' case could probably be removed entirely. Thoughts?
Comment #5
bsandor commentedThanks Very Much!!!
You helped me a lot. I didn't see this (fieldtype) in any documentation...
I am not expert in PHP and don't know much of drupal. Kind of understand hooks... So unfortunately can not help at this moment in the code.
I am OK with DBs so I can tell you what i generally think:
-----
1.
I was looking for a temporary solution earlier, I found this: http://drupal.org/project/fieldreference I think this is a good way however not implemented into D6. :(
I am 90% sure this is close to the solution.
2.
An other way could be a simple DB query that gives back the current status at every page view. In this case I am not sure what happens when you use Views that needs the the data from this field.
3.
Because of this I opened this ticket: Views integration needed (http://drupal.org/node/1238392) as I can not connect to Order Staus.
I might be wrong. If you can do it please tell me how!
I don't know the reason why this field is in this module. What I see the best solution is making it possible to get the info with the Views module. This will always give the valid answer without the need of any update and possibly mistakes or later code writing (work).
4.
In one way this module is / can be used for advertising (what I do)). UC Recurring Payments and Subscriptions (http://drupal.org/project/uc_recurring) has similar way. This might be good to check out what their way is.
-----
I am not sure if I helped a lot. I hope I did.
Comment #6
bsandor commentedFor now I wrote this to be put into the Readme file:
-----
Fields need to be set as following:
Order Status: Text Field
Order ID: Integer
Product ID: Integer
Comment #7
dsbrianwebster commentedGood addition to the Readme file!
As for connecting to Order Status from views this is definitely possible, no need to open an issue for that. The CCK field that uc_node_checkout populates is available in any node view as is.
If you're trying to fetch the actual order status from Ubercart you'll want to checkout 'Relationships' in views - there are a few ways you can join tables together with relationships to return the status from Ubercart.
With the code I provided above, the CCK order status field is now fully functioning as expected. I reference this CCK field to filter my views, as using relationships to get the Ubercart status is building an unnecessarily complicated query for my particular application.
Have you added the code uc_node_checkout.module?
Comment #8
bsandor commentedHi,
Thanks very much!
I am very busy with a solution of another problem. I will test this code soon.
What I mean about the Views integration is that I think the best way is not to put order status into UC Node Checkout as it might have multiple Orders as it does in my case:
I use recurring payments. User cancels it. Than another order needs to be made to make another recurring or non-recurring payment. In this scenario my 'UC Node Checkout' node has multiple orders. In this case I need to connect my node and the orders. I am not sure this can be done with views. I know Views, I know Relationships. Relations to connect my node and it's order is not known for me.
-------------------------------
I need to find out how to integrate recurring payments, canceling recurring payments, extending, etc...
I don't want my node to be unpublished (auto-expire can do that). Instead I want my node to have a different status. A workflow status for example.
Customer pays and gots the benefits. When payment expires no more benefits only normal services.
For this I need to extend UC Node Checkout somehow.
I will check your code. Thanks very much.
Comment #9
squarecandy commentedThanks Delicious - you really saved my butt.
This needs a patch, eh? Is this module still being maintained? I'll make a patch if so...