After updating my site to Commerce 7.x-1.14 from 7.x-1.13 i got the next error:

FacesExtendableException: There is no method getElementName for this instance of the class RulesConditional. en FacesExtendable->__call() (línea 133 de /srv/www/vhosts/dglaboral/sites/dglaboral/modules/contrib/rules/includes/faces.inc).

I can't access to Payment methods page and Rules page.

The others modules implied are:

Rules Conditional 7.x-1.0-beta2
Rules 7.x-2.10

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jncruces created an issue. See original summary.

jncruces’s picture

sjmobley’s picture

Based on design patterns used in Commerce Card on File (commerce_cardonfile), a proper fix should be:

// skip any actions that are not simple rules actions, ie loops
if (!($action instanceof RulesAction)) {
  continue;
}
jncruces’s picture

Hi, I think that these solution is correct if RulesAction is an interface and these interface define the needed method. But if you have a Class you can have a class that extends of the first one and the validation not pass.

In D7 the objects was not properly defined, with some exceptions of course.

lisastreeter’s picture

I've updated the patch based on the design patterns used in Commerce Card on File. However, @jncruces, I did update the condition to check instanceof RulesActionInterface rather than RulesAction.

jncruces’s picture

Yes I think that the last patch seems to be correct. In the next days I will test it. Thanks!

sjmobley’s picture

Issue tags: +sprint
sjmobley’s picture

Status: Needs review » Reviewed & tested by the community
rszrama’s picture

Category: Bug report » Support request
Status: Reviewed & tested by the community » Needs work

Sending this back for one more review. I'd like to be able to reproduce the original issue, to be honest ... because the solution doesn't seem to quite get at what we'd want. Just checking for an instanceof RulesActionInterface would actually match true for the action container itself. : ?

The RulesActionInterface doesn't guarantee the existence of getElementName on its own; that function is just defined in the RulesAbstractPlugin class and not mandated by any interface I can see. What exactly was wrong with the original code ... not sure what changed between 1.13 -> 1.14 that would've had an impact here.

jncruces’s picture

The error was given when the Conditional Rules module is active.

The module commerce_payment now call the same method on other line. I updated the last patch and corrected the conditionals to prevent use of continue proposition.

jncruces’s picture

The latest patch not work... the instanceof proposal of @lisastreeter not working.

I updated my first patch to match with current version of the module.

joel_osc’s picture

Just an FYI we were using the above patch to fix the error message - which it did, however it resulted in a 'silent' functionality error. In a nutshell, we had added a condition to the commerce_paypal_ec rule that conditionally added it as a payment type. The rule worked fine during the payment step of checkout, but then the user was never sent to paypal for payment... this was because during the submission process commerce gets the payment method from order and tried to load it using:

$payment_method = commerce_payment_method_instance_load($pane_values['payment_method']);

However the $pane_values['payment_method'] contained only "paypal_ec|" and was missing the rule name after the pipe. As such, no payment methods were found and the checkout was completed without payment. Reverting this patch and removing the condition from the rule and putting it in a different rule fixed the issue for us.