Closed (duplicate)
Project:
Commerce Core
Version:
7.x-1.x-dev
Component:
Rules integration
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
7 Feb 2012 at 01:59 UTC
Updated:
12 Dec 2013 at 21:02 UTC
Jump to comment: Most recent
Comments
Comment #1
rszrama commentedDo you have any custom Rules on the site or additional contributed modules running?
Comment #2
brianlp commentedNo custom rules only standard stuff that come with modules like currency, tax, Paypal WPS, Invoice, Flatrate, shipping etc. .
Contrib modules are
The message shows every time the cart is changed, thus also if I change the amount of items in the cart or empty the cart.
Comment #3
Everett Zufelt commentedWe are also getting this error on cart and checkout. We definitely have custom rules firing on those pages. I've only recently noticed the errors.
On cart update (when some custom rules fire) we get the error 3 extra times.
Comment #4
rszrama commentedOk, of the modules on the list, I've never used Email, Invoice, Invoice Receipt, Invoice UI, or Product Enhancements. Any one of those could be the culprit, so your best bet is to just disable them one by one and see when the error disappears. Then we'll know which queue to move this issue to. : )
Comment #5
brianlp commentedNow I have deactivated eveything possible and cleared cache inbetween. Nothing changed exept for additional messages due to missing components.
Back to Rules I did also some deactivation tryouts without any success.
Display an Add to Cart message
Set the currency price
Go to cart page after add to cart
Reset the cart order status on product add or remove
If I remove aproduct from the cart, the message gets displayed twice. I guess one for removal and one for "loading" the remaing one. What rule related action could that be?
Comment #6
Everett Zufelt commentedThe custom rule that is throwing this error executes on the order updated event.
The first condition is entityHasField (with a field that is on the commerce_order bundle of the commerce_order entity.
The second condition compares:
commerce-order:field-my-field
with
comerce-order-unchanged:field-my-field
When I remove that condition and replace it with my own Execute PHP condition where I do the comparison manually everything works fine.
Comment #7
Everett Zufelt commentedPossibly related, I'm also getting a Rules warning when I use a data comparison condition with commerce-order-unchanged:status
WD message: "Unable to evaluate condition data_is."
Comment #8
rszrama commentedThanks for the follow-up, Everett. Any chance you can share the Rules in question or are they tied too intimately to custom elements on the site?
Comment #9
Everett Zufelt commentedHi Ryan,
I can't send the Rule. I did do some more digging and found that the value of the two fields is empty.
Using a Execute PHP condition
Each of the above statements returns an empty array. I suspect that since the fields aren't yet initialized that the Rules data comparison condition handler is throwing a warning when trying to evaluate. I haven't looked yet, but I suspect that I can resolve the error either by doing 2 additional data comparison conditions to check the value of each field prior to comparing to one another, or by doing the comparison completely in PHP, though I try to avoid that where possible.
I should work on this today, I will post the solution back to the issue when I do.
Comment #10
chriscalip commentedError also sighted.
Comment #11
chriscalip commentedIn my case i made a custom page; every time authenticated users come to it. it does some order update logic.
Comment #12
milekium commentedI had the same error, I’d modify the rule ""Delete shipping line items on shopping cart updates" with new condition on top for "NOT Path has URL alias: checkout/%/checkout" and the error disappear. I guess is not the better way, but I don´t think is needed to delete any shipping line items on the checkout page, any other page the rule still working ok.
Comment #13
Witch commentedSame error here! Dont know what this could be.
Comment #14
5n00py commentedStill have this issue.
I'm trying to check if some field changed after order save.
I remove my custom action from DO section because its my own rules component.
Unable to load variable commerce_order_unchanged, aborting.
Unable to evaluate condition entity_has_field.
So problem located in IF section.
Comment #15
5n00py commentedComment #16
finex commentedHi, this bug is still reproducible with latest commerce, rules and commerce_shipping (tested with stable and -dev).
Comment #17
finex commentedProbably it happens because the commerce-order-unchanged doesn't exists until the order has been created, what do you think about?
Comment #18
JustBlackBird commentedHave this issue with commerce fees module.
Comment #19
5n00py commentedYes, I think You are right. But anyway it need to be fixed, rules tell me that I have this value.
Just some check can solve issue. Or not ?
Comment #20
rszrama commentedIf you're using this on the event "commerce_order_update", then this should only be triggered when an existing order is updated.
Comment #21
finex commentedBy default the shipping module create the following rule which trigger this issue:
Where should this bug corrected? Why there is a reaction on "After updating an existing order" when you visit
/carturl even if the order has not yet been created? I think that rules module should check the availability of the order before triggering the rule.What do you think about?
Comment #22
rszrama commentedOnce you add a product to the shopping cart, an order is created. Drupal Commerce uses a full order object to model the shopping cart, so the unchanged entity should be present at that time.
Comment #23
finex commented@Ryan, it should but it doesn't :-(
P.S: should #2108375: Rules Error Message be closed as duplicate of this bug?
Comment #24
StuddMan commentedLooks like lots of people having this issue. I found this post with a work around but there is clearly a problem with this rule.
https://drupal.org/node/2120421 - Warning: call_user_func() expects parameter 1 to be a valid callback, function 'rules_events_entity_unchanged' not found.
Note the patches jsacksick has loaded, maybe some how related to the patches:
http://drupal.org/files/d7_rules_are_lost_0.patch http://drupal.org/files/d7_rules_owner_recover.patch
We have those patches loaded as well to get our payment rules to show backup after upgrading to Rules 2.5. After applying the patches is when we starting having out logs fill up with this error.
Comment #25
rszrama commentedHmm, do you have issues on previous versions of Rules? Because of bugs in Rules 2.4 / 2.5, I still haven't updated and am doing all of my testing / development still on Rules 2.3. That make a difference?
Comment #26
astutonetI'm upgrading a production site on localhost.
I installed version 2.6 and I also have a problem in line 148 of the file rules.state.inc, but with a different message:
In the remote version, I'm using version 2.3 and I haven't errors.
For those using the Commerce module and derivatives, I remember that rules are overridden when we change the payment methods by entering personal information, so they are overriden rules.
Any ideas?
Tks.
Comment #27
rszrama commentedOk, so it sounds like this actually may be an issue introduced in Rules 2.4 and beyond. Any other confirmations?
Comment #28
torgospizzaYeah, there is an issue at #2120421: Warning: call_user_func() expects parameter 1 to be a valid callback, function 'rules_events_entity_unchanged' not found. and two possible patches.
Comment #29
rszrama commentedThanks for the connection, torgos. I'll go ahead and leave this issue open to point people there, but I'm not going to focus on it myself. We can close this out when Rules is fixed.
Comment #30
bojanz commentedI have resolved the problem and posted a patch to the Rules issue yesterday.
Comment #31
rszrama commentedGiven bojanz's patch in the other and the discoveries in #2140165: While reloading $entity->original in the controller, track the save_depth, I'm going to go ahead and close this one out as a duplicate. In the event that multiple updates happen at once, your $order->original might be unset in the current scenario, though the issue I just linked has a patch that would prevent that from happening.