"O frabjous day! Callooh! Callay!" Let's slay the Jabberwocky!
Seriously, CA served it's purpose, but it no longer makes sense. Rules is the well supported standard. At this point I feel CA is unnecessary duplication.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Clint Eagar’s picture

I agree, down with CA move to Rules.

Bilmar’s picture

subscribing

Island Usurper’s picture

Status: Active » Needs review
FileSize
40.58 KB

This is a work-in-progress patch to show the way I'm taking this. It takes care of uc_cart and uc_order so far. Rules 3 is interesting because it's taking advantage of the entity API and expanding on it to provide a framework to describe the parameters passed to the conditions and actions. This means that orders are likely to become fieldable entities faster than I had planned on.

The attached file is a merge directive for Bazaar. It contains the diff from HEAD, so you can still create a normal patch file easily if you don't use Bazaar. These changes are completely untested, so set your expectations low. ;)

Island Usurper’s picture

Status: Needs review » Needs work

I'd really like to have some kind of centralized store for addresses at this point because I think it would make things easier for the Rules integration. Does anybody have any thoughts or information about other work that's gone in that direction for Drupal 7?

tobiberlin’s picture

subscribing and vote for it ;)

Island Usurper’s picture

FileSize
56.92 KB

So, I've decided to make an address class for Ubercart. Mostly, it's just there to keep all of the "undefined property" notices from happening when a blank address is used in form elements.

In the Rules integration for orders, I avoided making the addresses themselves a separate entity. This lets us keep the same database schema, though I think having a table to store addresses is a good idea for the future.

I think the Rules UI needs to stabilize a bit before this patch can really be tested out. I'll try to keep an eye on it so that this issue can go forward.

Island Usurper’s picture

Assigned: Unassigned » Island Usurper
FileSize
123.44 KB

Finally, another update. Work had been progressing, but I had kind of forgotten about this issue.

Taxes and shipping quotes now use Rules to decide whether to calculate their values. The settings forms for them now include the Conditions directly, so there shouldn't be any more confusion about where to set them up. It looks like the Rules interface will allow you to add these conditions as components to other rules, which I think is pretty nifty. Right now they're all listed as "AND", though, which is less than helpful. However, I have a patch in the Rules queue to fix that.

For orders, I've added order products as an entity. I'm hoping that Rules will have some abstract list conditions that will let us have conditions like "order has a product that is shippable" by applying conditions to each item in the order-products list. There are also some interesting possibilities with maybe loading nodes and turning them into order products to attach them to an order. The new AJAX integration makes that a more reasonable prospect than it used to be, I believe, but I'm not so certain that it'll become a reality.

mo6’s picture

subscribe

Island Usurper’s picture

FileSize
182.84 KB

Through rigorous basic testing, I've figured out the proper syntax for some of the cooler features of Rules, like data selectors. The implemented configurations should be usable now.

uc_payment, uc_file, and uc_stock have now been implemented in Rules now, so your test sites can probably get away with not enabling Conditional Actions any more. uc_shipping and uc_roles are still left, and maybe one or two more minor modules that I'm forgetting.

After those modules are finished, I'll start working on the upgrade path from Conditional Actions. While it would be nice to get rid of it completely, I think it'll probably be an empty module that only translates the predicates into equivalent configurations and then disables itself.

Island Usurper’s picture

Status: Needs work » Needs review
FileSize
240.5 KB

OK, now all of the modules have been ported to Rules. Now begins the task of preserving custom Conditional Actions predicates as Rules configurations.

Edit: OK, actually, there are some specific conditions and actions that need to be worked on. Expect to see those some time tomorrow.

mitchell’s picture

Island Usurper’s picture

Issue tags: -rules integration
FileSize
259.52 KB

Now everything should be ready. Just got to get the upgrade path working.

I'm trying to figure out where that code should live. I don't want to keep a Conditional Actions module lying around, even if no one will enable it, just to have some code to help with the conversions. I think I may put a file in uc_store/includes that will just be used by the update routines of various modules. It might just be uc_store_update_7000() that does the converting, though. I don't know how elaborate I want to make it.

Island Usurper’s picture

Issue tags: +rules integration

Replace tag.

univate’s picture

I think having the update functions in uc_store is a good idea to migrate from ca to rules. And put all the code into another *.inc file that just gets included during the update and otherwise never used.

Island Usurper’s picture

FileSize
111.31 KB

OK, I suspect the actual Rules integration is pretty close to done, so here's the conversion code in a separate patch. I don't have very many real CA predicates handy, so I really need someone to test out all of the edge cases for me.

I've already run into one in particular, but I can't really figure it out. Hopefully, more data will get me some more inspiration. If you just want to dump your ca_predicates table here, I can test the conversion on them. Sanitize your email-related actions and such first, though. ;)

Island Usurper’s picture

Status: Needs review » Fixed

Meh. This patch has sat around long enough. It'll get tested enough eventually.

Enjoy!

alanburke’s picture

re #4
Hi Andy
I don't know how you'd feel about a module developed specifically for Drupal Commerce...
but open source is open source.
http://drupal.org/project/addressfield
I haven't used it, but I came across it at some point.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

rickmanelius’s picture

Just out of curiosity re:conversion. The payflow pro module needs the same type of conversion #462728: Convert to D7 and Improve Code Style and Organization. It looks like some of the conversion was done by hand while others could be search/replaced. You don't happen to have any scripts handy that you used do you?

If not, no worries. Just thought I would ask before embarking down this road!

RKS’s picture

@Island Usurper

Along with the previous posting, people have been talking about converting CA to Rules in your module, Discount Framework, http://drupal.org/node/1150542. If you do have some scripts I know they could use it over there as well.

sreekanth1201’s picture

I want to update my registration profile after node checkout hapns...I want to select "execute php" to update my order like event registration..How can i do that using rules...Please help me out..