this is really a strange one:
some now and then, in the middle of editing a rules component, i get:
Error: Data selector site:current-cart-order for parameter entity is invalid.
shown at conditions where i entered that condition before without problems,
and of course the date selector dropdown entry is gone too.

Comments

geek-merlin’s picture

hmm, a call

dsm(entity_get_property_info());

shows the entry in dsm output and it re-appears in rules.

EDIT: and sometimes it does not.

geek-merlin’s picture

Title: Error: Data selector site:current-cart-order for parameter entity is invalid. » Rules Error: Data selector site:current-cart-order for parameter entity is invalid.
Project: Rules » Commerce Core
Version: 7.x-2.x-dev » 7.x-1.x-dev
Component: Rules Engine » Rules integration
$info = module_invoke_all('entity_property_info');
drupal_alter('entity_property_info', $info);
dsm($info[site][properties]);

sometimes shows the cart, sometimes not.

looks like a race condition in the alter where cart adds its info,

/**
 * Implements hook_entity_property_info_alter().
 */
function commerce_cart_entity_property_info_alter(&$info) {
  // Add the current user's shopping cart to the site information.
  $info['site']['properties']['current_cart_order'] = array(
    'label' => t("User's shopping cart order"),
    'description' => t('The shopping cart order belonging to the current user.'),
    'getter callback' => 'commerce_cart_get_properties',
    'type' => 'commerce_order',
  );
}

so reassigning to cart.

geek-merlin’s picture

Title: Rules Error: Data selector site:current-cart-order for parameter entity is invalid. » Error: Data selector site:current-cart-order for parameter entity is invalid.

OK, hunting down the alter queue:

dsm(print_r(module_implements('entity_property_info_alter'),1));

shows us there are no ''esoteric' modules involved:

Array
(
    [0] => commerce_cart
    [1] => commerce_line_item
    [2] => commerce_order
    [3] => commerce_order_ui
    [4] => commerce_product
    [5] => commerce_product_ui
    [6] => entity
)

and gee, in the 'buggy' cases the output is:

Array
(
    [0] => commerce_line_item
    [1] => commerce_order
    [2] => commerce_product
    [3] => entity
)

so where the heck gets commerce_cart.info.inc included (which contains the alter hook listed above)?

geek-merlin’s picture

Status: Active » Fixed

OK, a current entity.module solves the issue due to #1390728: entity_hook_info() does not define hook_entity_property_info_alter()

rszrama’s picture

Category: bug » support

For what it's worth, you should most likely be using commerce-line-item:order anyways.

geek-merlin’s picture

ryan,

for most cases: yes i know.
but not in a standalone component - there you only have site:*

;-)

rszrama’s picture

Ahh, indeed. Just wanted to make sure you knew, but I'm equally glad to know it looks like this problem might finally be solved upstream. I've gotten reports about the funkiness here over time but have never been able to reproduce it / trace it down.

geek-merlin’s picture

after hours of cursing it is always good to hear others can profit from the effort too ;-)

rszrama’s picture

/me clicks the non-existent "Like" button by your comment. : P

Status: Fixed » Closed (fixed)

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