Tags/topics: 
1
Answers
Vote up!
0
Vote down!

pay to publish an Ad in a site using commerce module?

i would like to create a site for posting image Ads,
in which user can register and create Ads(nodes), but the ad will only be posted after payment , any suggestion to do it using commerce module.?

thanks in advance !
am really struck with this..

Asked by: saleempbt5
on April 16, 2013

1 Answer

Vote up!
1
Vote down!

You are talking about automating this action, right? So you could create a product called "Publish my advertisement" and add a node-reference field to the line item type. Make this node reference field only show unpublished nodes by the author.

Once the payment has been accepted, fire a rule that publishes the node and perhaps notifies them that their advertisement has been published.

Adding a field to your line item:

http://www.drupalcommerce.org/videos/demo/introduction-line-item-fields

Making a rule publish a node:

1) Create a rule that runs on Order Update
2) Add a condition for "Order Status" to be "Completed"
3) Create a loop on "Order Line items"

^ The above as a rule export: http://pastebin.com/0tCsCanu

4) Create a component (admin/config/workflow/rules/components/add) using the "Rule" component plugin (we'll need to create a condition or two and then perform an action)
5) Give this rule a name (perhaps, "If purchased product has a node reference, publish node")
6) Choose a parameter that accepts "Commerce Line Items" ... I chose to call this parameter "line_item" but you could call it "purchased_product" or anything.
7) Add a "Entity has field" condition to bring in your field data
8) Add a data comparison to confirm it's not null or above a certain value or perhaps if the node reference is referencing a node that is unpublished
9) Add an action that makes sense.

^ The above as a rule component export: http://pastebin.com/s4nbPidZ

Josh Miller
Answer by: Josh Miller
Posted: Apr 16, 2013

Comments