After reading the module description on the project page, I couldn't tell if it would allow:

1) a visitor to the site to fill out an ad listing (custom cck type), pay for it and then set publish = 1? meaning that each visitor is given access to create a node / create content (e.g. fill in fields) as many times as they're willing to pay for each node creation. what they are paying for is a right to publish content on the site and create multiple nodes NOT simply buy a product which is described by a single node and uneditable by the customer.

basically does this module allow for the "pay per node" scenario kicked around on the uc forums over the last year or so in a more straightforward manner than the pseudo documented ng workaround someone posted over there a couple of months back. that was a rather convoluted jump through hoops method not very well documented.

uc node checkout seems like it might be a single tightly integrated uc contrib module that takes care of the same problem in a more robust and maintainable fashion. but i can't be certain.

2) if someone fills a node form out adds it to the cart and THEN decides not to pay for it, i'm assuming the node is not saved or if was previously is deleted. is that right? how does cancelling work?

3) assuming this module performs number 1, does someone have to be registered before embarking on the node checkout process?

uc has anonymous checkout and i'm curious if it works for my scenario. meaning that a user would fill out the node form but only add the fields to the cart at checkout NOT actually save the node. Upon approval from payment processor, uc then FIRST creates the user account, THEN after account is created, SAVES the node based upon fields stored in the cart / order.

if this module can handle pay per node in terms of giving a site visitor and NOT JUST THE SITE ADMINS the right to create / publish nodes, that'd be a very cool thing.

if this module gets us most or even part of the way there, could you provide some suggestions for what parts need to be filled in and what part of the api to target the missing links?

thanks

Comments

rszrama’s picture

Status: Active » Fixed

I think you're in luck. ; )

The module hasn't arrived at its final resting place, but I'm quite happy with its humble beginning. It will allow for what you're looking for, but you'll need at least 1 piece of glue code. You can have them create the node and default nodes of that type to unpublished... but you'll need to publish it post-checkout yourself. I accomplish this through a custom Workflow-ng action that polls through $order->products for the completed order and looks for the node reference.

This module works for anonymous users, but obviously they won't be able to edit their nodes in progress unless they login. Since it is working w/ products, the nodes do get updated to their user account if they login while the nodes are still "in their cart." If they remove the item from the cart, it will delete the node... and theoretically this will work for expiring carts, too. Theoretically. I won't count on that one. : P

newdru’s picture

The module hasn't arrived at its final resting place, but I'm quite happy with its humble beginning.

can you say more about planned future features and ETAs for those features?

It will allow for what you're looking for, but you'll need at least 1 piece of glue code. You can have them create the node and default nodes of that type to unpublished... but you'll need to publish it post-checkout yourself. I accomplish this through a custom Workflow-ng action that polls through $order->products for the completed order and looks for the node reference.

OK. so assuming i don't want to touch any core UC, if i write a helper module, which UC callback(s) will i need to use to gain access to workflow-ng action that i'm assuming i will create to publish the nodes contained in the $order->products? Is there a code snippet that represents a similar action?

It sounds like more a question of timing, as the appropriate UC callback needs to be the one that fires after an order completes (has been approved and paid for).

Since i haven't used workflow, actions or workflow ng yet and publishing a node is pretty trivial task, can i just hard code that op into my helper module or is there something i benefit by using workflow ng?

In fact, does UC node checkout require workflow ng as a prereq? I reread your reply, and i'm not sure if you're saying that this module already handles what i'm requesting using workflow ng?

This module works for anonymous users, but obviously they won't be able to edit their nodes in progress unless they login.

Not sure I follow. So will they be able to create the node at all if they are not logged in? Or are you saying that they can only create it but NOT EDIT IT during the initial purchase of the node if they are not yet logged in?

When I say create i mean actually to be presented with the node add form and then fill out the fields for the initial node THEN assign that to the cart. Or does your node create mean to simply do a node save on a 'blank' node behind the scenes without ever being presented the node add form, sort of as a temporary placeholder so that the user can LATER go back and edit the nodes they've purchased after logging in?

Regardless of whether it's a fully filled in or placeholder node, it sounds like the code actually CREATES the node BEFORE it's payed for. It's not stored temporarily in session vars or anything but actually gets written to the node tables. So only if and when they cancel the order or the cart expires, does the actual node get deleted. what i'd call deleting a 'dangling node'. right?

And if the user isn't logged in or doesn't have an account yet and we're in the middle of anonymous checkout, since a node has to have an owner, what does $node->uid get set to: anonymous?

i'll let you expound upon that.

If i wanted to prevent a rogue user who never had any intent on buying nodes but kept filling up carts for fun, any suggestions on an UC hook / implementation that would allow me to limit the number of orders a single ip / session / etc could place within a given set of constraints (time limit)

Same goes for limiting the number of nodes that could actually be purchased per checkout to prevent someone from bombarding the db with massive node creates?

thanks

newdru’s picture

Status: Fixed » Postponed (maintainer needs more info)

I didn't realize this was posted 'fixed' before i asked the followup.. so i came back and changed the status to 'active (needs more info)'.. hope that's ok? see post #2 for the info i'm requesting.

thanks

kanani’s picture

Component: Code » Documentation

My use case: is user wants to create a node for purchase. They then must login or create an account. New nodes they create are unpublished, and the code below publishes them after succesful checkout. I'm also using scheduler to unpublish the nodes after some time period.

I'm sure it could be more elegant, but this solutions works for me.

Glue code to poll through the order as referenced in # 2 above. You put this in a Custom PHP action that fires on successful checkout. Uncomment the

 and print_r lines if you want to see the structure of the order. 

//print "<pre>";

//publish the nodes
    $dbquery = "update {node} set status = 1 where nid = %d";

$productList = $order->products;
    foreach ($productList as $product ) {
        foreach($product as $fieldName => $fieldValue){
          //  print_r($fieldName);
          //  print_r($fieldValue);
            if($fieldName == 'data'){
             $results = db_query($dbquery, $fieldValue['node_checkout_nid']);
            }
        }
    }

//print "</pre>";
rszrama’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)
asak’s picture

@Kanani - This code seems to cause some trouble while viewing the checked out node (or any page with any kind of view of/with that node) and throughs the user to the /cart page.

I also found this code, which seems to cause the same thing.

Does anyone have a simple, proven, php snippet for making an un-published-by-default node be published after completing checkout?

Thanks...

mrthumpz’s picture

I used the code in #4 without any issue. Perhaps there is something else wrong with your setup?

fehin’s picture

Doesn't this module do something similar? http://drupal.org/project/ed_classified

jenna.tollerson’s picture

... but you'll need to publish it post-checkout yourself. I accomplish this through a custom Workflow-ng action that polls through $order->products for the completed order and looks for the node reference.

I know this thread is several months old, but if you are out there could you share exactly how to build such a Workflow-ng action? This is precisely what I need to do and I keep getting stuck at that part.

EDIT: Should read a little closer ... going to try out the code in #4.

mcaden’s picture

Kanani's code works beautifully for me.

I vote it's put someplace more prominently. This module plus that code snippet added as a conditional action on the end of a successful order solve nearly all my pay-per-node issues.

socialnicheguru’s picture

will this work in D6?