This screencast builds on the previous screencast showing selling a role. This time, though, we're going to sell an individual node. Here's the recipe:
- We have Content Access and its submodule Content Access Rules enabled
- Create a content type called Premium Content
- Instead of granting access to that entire content type by role, grant it on a user-by-user, node-by-node basis
- Add a nodereference field to our product; each product that sells access to a node should have the nodereference set to the content in question.
- Add a rule (and component)
- When the order is updated
- If its state is Completed
- Loop through the line items (invoke a component)
- If the line item has a product reference field
- If the Product has a nodereference field
- Grant access to the node listed in the nodereference to the user who created the order.
Comments
I don't have the field "commerce_prodect"
Hi Randy,
I was following along, and everything worked perfectly on my local machine! However, when I went to do this on a live site, I ran into an issue while creating the component for the loop. I don't have the field value "commerce_product" (when I compared my localhost site to my live site, I realized I was missing others as well.)
I do have:
commerce_customer_address
commerce_line_items
commerce_order_total
commerce_customer_billing
commerce_price
But I do not have:
commerce_unit_price
commerce_total
commerce_product
commerce_display_path
Any ideas on why I wouldn't have all of the options on the live site while I do on my localhost?
Thanks again Randy!
Entity has field
Rules doesn't autoload all fields from an entity, so you need to add a new condition called "Entity has field" to populate those, check this documentation for more details: http://www.drupalcommerce.org/faq/rules-field-data-selection
One product with dynamic node id
Hello,
Is it easily possible to create just one product: e.g. Buy premium content by nid?
I want to sell cv's online, those are submitted by users and if you have to programmatically add for every cv a product it will be a huge product list.
I want to show only certain information of the cv and when they buy / pay for the cv, the buyer get access to de full node information.
In short, show cv (partial)
Add button (product I suppose); Buy cv (pass nid of the cv to the product)
Add to cart, when completed the purchase, show full cv to that user.
Can you point me in the good direction?
TIA,
Fossie
Add new comment