I'm using UC_NC to sell sponsorships to an event with a sponsor=>sponsorship node=>product relationship. We want sponsor administrators to be able to create sponsors without having to go through the checkout process. Currently, uc_nc hijacks the node add form and there's no way around this.

It would be pretty simple to add a 'bypass uc_node_checkout' or similarly titled permission and not hijack the node add form with a drupal_goto when the user has this permission.

CommentFileSizeAuthor
#4 uc_node_checkout-954668.patch2.42 KBdrumm
#1 424886.patch1.22 KBezra-g

Comments

ezra-g’s picture

Title: Allow administrators to create uc_nc products without checking out » Allow administrators to create uc_nc products without checkout process
Status: Active » Needs review
StatusFileSize
new1.22 KB

Patch, and updating title to be slightly more accurate.

jamestombs’s picture

I would like to take this a bit further as I am importing a lot of content which is of a uc_node_checkout node type which is creating a huge cart for me when they should be skipping the cart and being created.

Something like changing:

if (uc_node_checkout_node_associated($node)) {

To:

if (uc_node_checkout_node_associated($node) && !isset($node->skip_add_to_cart)) {

Then when importing using code or any other means you can simply add $node->skip_add_to_cart = 1 to avoid the basket.

drumm’s picture

Status: Needs review » Reviewed & tested by the community

I can't speak to #2, but #1 was used successfully for DrupalCon Chicago & I'm putting it in London.

drumm’s picture

Assigned: ezra-g » drumm
Status: Reviewed & tested by the community » Needs review
StatusFileSize
new2.42 KB

I added another condition for admins to use the checkout process when they start from a buy now link.

aidanlis’s picture

Title: Allow administrators to create uc_nc products without checkout process » Allow bypass of checkout process
Assigned: drumm » aidanlis

Seems legit, will implement.

aidanlis’s picture

Assigned: aidanlis » Unassigned
Status: Needs review » Needs work

I'm not sure about the patch. It doesn't apply on -dev, but also I have a few concerns:

Line 292:
- Is it really safe to skip all of this set-up for an administrator?
- Would it not be better to redirect them earlier? Also where you have $_GET['product_nid']
- I assume you want !empty($_GET['product_nid']) to avoid E_NOTICE messages?

I don't have time to experiment with this so I'm going to move it back to needs work, sorry to shift the burden back!

aidanlis’s picture

Status: Needs work » Postponed
Neil C Smith’s picture

Status: Postponed » Active

Came across this thread while looking at #424886: Permissions to bypass the checkout process (which incidentally is wrongly referenced in the patch in #1 above). Wanted to refer you to my comment there (#10). As far as we're concerned, that approach would seem to offer a better way of fulfilling both of these requests.

aidanlis’s picture

Status: Active » Closed (duplicate)

Happy to deal with this over there, then.