Node Add To Cart

Issue tracker: view

Contrib type: 
Module
Status: 
Initial upload
Compatibility: 
Ubercart Alpha 8

This is a very rough first pass at creating a module which will allow non-product nodes to be mapped to products and then added to a cart. In it's initial state this module should:

-allow a title, price, and quantity field to be mapped from a non-product node via the 'Node to Product Settings' in Store Configuration

-add a workflow-ng action called 'add node to cart'

A sample for workflow-ng that I've been using is to add a new configuration with the event 'Content has been created' and the condition 'Content has type' = non-product type (such as order). Then I have that fire off the 'add node to cart' action. This lets me go to create a new order, and when I save it, it uses the mapped fields off of that order to add a product to my cart.

As I said, this is just the start of this module but I figured I'd post it for feedback, testing, suggestions or to find out if somebody else already wrote a more complete version.

Another interesting application of this module is outlined in this Ubercart thread, http://www.ubercart.org/forum/development/2121/uc_nodetype_module_purcha... , as a potential solution for doing pay-per-node.

Related threads: 
AttachmentSize
uc_node_atc.zip3.16 KB

Re: Node Add To Cart

Lovely! This is exactly what I will need. I'm so glad someone whose a programmer wanted this feature too. Eye-wink

Re: Re: Node Add To Cart

Would love to find a way to tie this into user created content. Is the module flexible enough for that now? We are looking to expand our site so that users can create "member products" which they can then sell using our system (but keep their content separated - maybe via Taxonomy - from the "official" products we sell).

Re: Re: Re: Node Add To Cart

Torgos, the disjoint between the idea of this module and the idea you have is that this module uses the data from a regular node to adjust the price/quantity/description of an existing product and then adds it to the cart. I guess what you'd need is the ability to config these same mappings but instead of mapping to a product you'd map to a product class and then instead of an add to cart action, you'd want a create product action....but this module might have some useful snippets towards achieving those things.

find node after order

I'm using this as part of the method suggested here for paying to publish a node. So far, it seems to be the best solution by far to what I need, as it also creates an easy way to set the price according to a user's role, which I was also having trouble with. Thanks!

I'm wondering though how I could track back to the node once the order is received. What I mean is, once the order comes through, I want to modify the node through workflow-ng. In some cases this will mean setting it to "published", in others, setting a field called "paid" to 1. Any suggestions for how to do this? So far my only idea is to include the nid in the product name and then regex it out of the name once the order comes back. But this seems kind of awkward.

Re: find node after order

dafeder, looks like you got an answer to this a little lower in your forum post. This is an interesting application of the module that I hadn't thought of at all, but I'm glad it can be of help in that area. Keep me informed on how it works out or if there are little features that would help in making the module a better fit for this.

Pay per node application

Just to let you know how I'm doing with this as outlined in http://www.ubercart.org/forum/development/2121/uc_nodetype_module_purcha...

This contrib works like I want it to however there are some things I had to do in order to make it fit more smoothly into what I'm doing...

I was using the "content created" trigger to run the node add to cart action. However, since I changed the process to be multi-form, this trigger did not work for me. Instead of writing a new workflow trigger (I just don't have the time for that), I simply added an "add to cart" link at the end of the process, which goes to my own module to call your action and redirect to the cart. Not sure if that's the best way but it works. Once the node is added to the cart, it allows them to go back and edit the node if they want before they checkout. This is good however I needed to then hide the "Add to Cart" link and replace it with "View Cart" which brings me to my next issue...

The total cost of the node is determined by what they fill out in the cck add form. Since the user can go back and edit the node after it has been added to the cart, they may actually change something that changes the price. This meant I needed a way to change the price of the product in the cart. I do this by hooking into cart_item and adjusting the price accordingly.

That's it for now...

Re: Pay per node application

Good stuff amaria. I'll need to address the price changing aspect for my implementation as well at some point, but the larger project for which I started this module ended up being pushed aside for a lil' bit. Ryan suggested a tutorial at http://www.ubercart.org/docs/user/561/tutorials would be nice....if anybody feels like writing up the specifics of getting paypernode out of workflow-ng + uc_node_atc let me know and I'll link there from this project page.

Re: Re: Pay per node application

Yeah I'm working on a more general tutorial, hope to post it next week....