I was trying to create a view to display order related data such as the billing first and last name and email to the signups, but found that this relationship did not exist. The relationship to the user data exists, but isn't the info I required. When attempting to retrieve order fields you get many duplicate results because the relationships between the tables that views assumes is too ambiguous. It makes sense to me to have orders related to a purchased signup so that you can pull the order information into your signup views.
I created a patch below to do this. It adds the Signup Order relationship. The attached image show a sample view of its use. Make sure when adding order fields to your view that you select the signup order relationship for that field in its field specific settings.
| Comment | File | Size | Author |
|---|---|---|---|
| uc_signup_order_relationship.102610.patch | 875 bytes | acrazyanimal | |
| order-view.JPG | 63.01 KB | acrazyanimal |
Comments
Comment #1
acrazyanimal commentedbump
Comment #2
naught101 commentedSubscribe. I will try to review this soon.
Related, but not quite the same thing, but does this make it easier to display a link to the order from the "signup details" table on node/[nid]/signups/admin? It would also be great to be able to link from the order to the placeholder signup ID, or at least display it.. thoughts?
Comment #3
naught101 commentedLooks like this link could be displayed in the "Extra information" column: #280565: Custom columns in Signups View. Will investigate.
Comment #4
naught101 commentedI get
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY signup_log_signup_time DESC LIMIT 0, 100' at line 15 query: SELECT signup_log.sid AS sid, users_signup_log.name AS users_signup_log_name, users_signup_log.uid AS users_signup_log_uid, signup_log.signup_time AS signup_log_signup_time, signup_log.attended AS signup_log_attended, signup_log.nid AS signup_log_nid, signup_log.uid AS signup_log_uid, node_signup_log.title AS node_signup_log_title, node_signup_log.nid AS node_signup_log_nid FROM signup_log signup_log INNER JOIN node node_signup_log ON signup_log.nid = node_signup_log.nid INNER JOIN users users_signup_log ON signup_log.uid = users_signup_log.uid LEFT JOIN uc_signup_log uc_signup_log ON signup_log.sid = uc_signup_log.sid LEFT JOIN uc_orders uc_orders_uc_signup_log ON uc_signup_log.oid = uc_orders_uc_signup_log. ORDER BY signup_log_signup_time DESC LIMIT 0, 100 in /var/www/d6/sites/all/modules/views/includes/view.inc on line 771Will look further.
Comment #5
pints1ze commentedAlso looking for this feature. will give this a shot.
Comment #6
radman16 commentedI need this feature too. Tried the patch and got a similar warning as #4. Any update on this?
Comment #7
faite commentedYeh I too would love this association. Every time I try to make it work it hangs the site.
Comment #8
acrazyanimal commentedHmm, I will take a look at the patch again and see where I went wrong. Its possible I just didn't create the patch properly.
Comment #9
acrazyanimal commentedFor those having the error above, in your view's configuration have you tried enabling the 'Signup order' relationship? Then when you add order fields, you would select the 'signup order' from the relationship drop-down for those particular fields.
@naught101: As you can see in the error you posted above the problem is in 'LEFT JOIN uc_orders uc_orders_uc_signup_log ON uc_signup_log.oid = uc_orders_uc_signup_log. ' so its not figuring out what field to include in the join. I'm guessing if you add the relationship in your view then it will fix this.
Now with all that said, I was new to coding views when I created the patch above. There may be better way to define the relationship between uc_signup and uc_order that wouldn't require that you always have to include the 'signup order' even if you aren't using any uc_order fields.
Comment #10
ezra-g commentedUC_Signup already provides a simple Views field for pointing to the order associated with a purchased signup.
With http://drupal.org/project/issues/uc_views, you should be able to expose the order field information you're looking for - Please re-open this issue if that's not the case.
Comment #11
ezra-g commentedAfter further experimenting with UC_Views I can see that in fact you *do* need a signup=>order relationship such as when trying to display the attribute of a particular product. This patch works great in my testing. It also fixes #1163036: Help text for signup order field is 'getoutahere'. Changing title to reflect the new feature here.
This is now committed. Thanks a ton!
http://drupalcode.org/project/uc_signup.git/commit/a4ad2f0