Until now we have commented out all Rules integration in D8 Ubercart because Rules until recently didn't have a D8 port to speak of. Even now, Rules in D8 is still incomplete, unstable, and is almost totally undocumented, but we probably ought to start the port so it will be ready to use as soon as Rules finally is.

This would be a great place to help us out if you want to get involved with Ubercart and/or want to learn D8. We need to both port the existing rules and add new rules for new features.

Each aspect of the port is being handled in a separate issue. This meta issue is being used to track the overall progress and coordinate effort.

Much of this work requires MANUAL TESTING", so even if you're not a coder you can help out by testing Ubercart Rules using the patches in the following issues.

Tasks

#2924148: Port Rules Events to D8
#2924151: Port Rules Conditions to D8
#2924154: Port Rules Actions to D8
#2924210: Port Reaction Rules to D8
#2924677: Port Rules Components to D8

Members fund testing for the Drupal project. Drupal Association Learn more

Comments

TR created an issue. See original summary.

ed523’s picture

How's this going?

1kenthomas’s picture

FWIW: I'm about to attempt getting a Rule working for granting file access on purchase, based on D7 code. I'll probably wind up creating a terrible hack to get it done for the client, but if I can possible help anyone working on this, let me know... which is to say, is there anyone working on this at-the-moment?

cbovard’s picture

What is the status on this? Where can I add back in the Rules to test?

Cayenne’s picture

Okay, so where should one delve in?

TR’s picture

Ubercart rules integration is in the files <modulename>/<modulename>.rules.inc and <modulename>/<modulename>.rules_defaults.inc

All that code has to be converted to the new version of Rules. There is almost no documentation for Rules, and nothing that I found that shows how to port. So it boils down to looking at the code in Rules and using the rules that come bundled with Rules as examples to try to figure out how to rewrite the Ubercart integration.

If you do find any good documentation, examples, blogs, etc. that detail the porting, that alone would help jumpstart the process of porting. I haven't searched recently, but when I did everything was already outdated (described previous alpha releases of Rules) and did not apply to the current state of Rules.

In theory this shouldn't take too much work, but Rules has been a moving target and there are too many other core Ubercart things to do that I just stopped trying to chase it.

TR’s picture

Here's the master issue in the Rules queue: #2245015: [META] Rules 8.x Roadmap

TR’s picture

Status: Active » Needs review
FileSize
36.71 KB

So here's a patch that ports all the Ubercart Rules events to D8. No conditions or actions or reaction rules have been ported yet, but these events should give you enough to start testing Rules with Ubercart. All these events are fired as they were in D7, but it's up to you to construct Rules (at /admin/config/workflow/rules) to do anything in response to these events.

Any feedback from testing is appreciated.

I will be writing unit tests to accompany these rules eventually, but I want to get a lot more ported first.

Status: Needs review » Needs work

The last submitted patch, 8: 2644882-8-rules-events.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

TR’s picture

Status: Needs work » Needs review
FileSize
50.97 KB

Corrected the bad use statement.
Still should be one fail in the uc_tax test, unrelated to this (core Drupal regression - test works in 8.4.x but not in 8.5.x).

Status: Needs review » Needs work

The last submitted patch, 10: 2644882-10-rules-events.patch, failed testing. View results

TR’s picture

Status: Needs work » Needs review
FileSize
50.97 KB

Syntax error from trying to fix one of the coding standards messages.

Status: Needs review » Needs work

The last submitted patch, 12: 2644882-12-rules-events.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

TR’s picture

Status: Needs work » Needs review
FileSize
53.51 KB

Status: Needs review » Needs work

The last submitted patch, 14: 2644882-14-rules-events.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

  • TR committed d368a64 on 8.x-4.x
    Issue #2644882 by TR: Port Rules Events to D8
    
TR’s picture

Status: Needs work » Needs review

Testbot error is unrelated to the patch. I committed the patch.

Setting back to needs review.

TR’s picture

Component: Code » Rules

Added "Rules" component.

Cayenne’s picture

Okay, will try on a dev site!

TR’s picture

Title: Port Rules integration to D8 » [meta] Port Rules integration to D8
Category: Task » Plan
Issue summary: View changes

Changing this into a meta issue so that specific tasks can be handled separately.

TR’s picture

Added an issue for porting reaction rules, added related issues.

TR’s picture

Issue summary: View changes
Related issues: +#2924677: Port Rules Components to D8

  • TR committed f47e242 on 8.x-4.x
    Issue #2644882 by TR: Restore Rules dependency
    
TR’s picture

Issue tags: +rules integration