Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comments
Comment #2
jncrucesI used this patch to correct it based on the patch commited here:
https://www.drupal.org/project/commerce/issues/2500311
Comment #3
sjmobley CreditAttribution: sjmobley at Centarro commentedBased on design patterns used in Commerce Card on File (commerce_cardonfile), a proper fix should be:
Comment #4
jncrucesHi, 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.
Comment #5
lisastreeter CreditAttribution: lisastreeter at Centarro commentedI'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.
Comment #6
jncrucesYes I think that the last patch seems to be correct. In the next days I will test it. Thanks!
Comment #7
sjmobley CreditAttribution: sjmobley at Centarro commentedComment #8
sjmobley CreditAttribution: sjmobley at Centarro commentedComment #9
rszrama CreditAttribution: rszrama at Centarro commentedSending 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.
Comment #10
jncrucesThe 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.
Comment #11
jncrucesThe latest patch not work... the instanceof proposal of @lisastreeter not working.
I updated my first patch to match with current version of the module.
Comment #12
joel_osc CreditAttribution: joel_osc at OpenPlus commentedJust 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.