7 replies [Last post]
greggles's picture
Offline
Joined: 12/12/2007
Juice: 95
Was this information Helpful?

I know the word "action" means a lot of things so let me define it clearly Eye-wink

In 6.x Drupal core provdies "Actions" and "Triggers." These come from the http://drupal.org/project/actions module for Drupal 5.x. That is the kind of action I'm talking about.

I'd like to integrate the purchase of an Action as an Ubercart product. I did some initial searches but was unable to find a module which does that. Has anyone done this? I think it could provide a lot of integration points because it is easy to create an Action to do random things (granting a role, publishing content, etc.).

mikejoconnor's picture
Offline
AdministratorBug FinderGetting busy with the Ubercode.
Joined: 08/07/2007
Juice: 536
Re: selling an "action"

I haven't seen anything, but I think it would be a great module.

justageek's picture
Offline
Bug Finder
Joined: 10/29/2008
Juice: 189
sell a role instead

would it make more sense to sell a role, or sell a node, or something like that?

I don't know enough about the actions yet, maybe selling an action makes sense, but selling a role definitely makes sense, I'm thinking about building that, if someone hasn't done so.

greggles's picture
Offline
Joined: 12/12/2007
Juice: 95
more generalized

Sure you can sell a role (I believe uc_role in Ubercart core does this) but the point is to make it more generalized. Selling an action allows for instant integration with dozens of other modules which expose actions...

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: more generalized

I imagine this would be fairly simple through a custom predicate if we had the "Execute custom PHP" action. Sticking out tongue I suppose what might make a little more sense would be figuring out a way to expose core Actions to CA. Puzzled Then you can simply check for a product on an order, though that in itself isn't ideal...

The alternative used by other modules would be to make selling an action a product feature and then writing a CA action that will perform any actions associated w/ products on an order.

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6846
Re: Re: more generalized

If you make an action a product feature, I don't know that you need to do anything with CA. Roles and files are granted when the order status is changed, so the module that makes actions a product feature would cause the actions to happen the same way: in hook_order().

greggles's picture
Offline
Joined: 12/12/2007
Juice: 95
NEWB ALERT!

What's a CA?

I figured out that it's the conditional actions in UC. So, yes, maybe one solution is not to figure out how to sell Drupal's actions but just integrate them into CA so that Drupal actions are available as CA? Of course that's my total CA Newb perspective.

I agree with Lyle in general, my basic plan was to base the work on uc_roles.

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: NEWB ALERT!

hehe Sorry, I didn't really tease that out in my post. Yeah, being able to integrate the two systems would be nice... I just haven't had the time to put effort toward that. It seems like a natural evolution of the code, tho.

As for what Lyle brought up about uc_roles, I'm divided on its approach. It can be simple to hard code the "execution" of the role promotion into hook_order(), but it's not as flexible as making it a custom action that can be tacked onto a CA predicate (or in the case of 5.x a Wf-ng configuration). But anything is better than nothing, and I'm sure a simple setting would work just fine for choosing which order status to process the action on (if you go that route).