I'm getting the follow error on all of the default rules:

Data selector commerce-product:commerce-stock for parameter data is invalid.

Comments

jazzdrive3’s picture

Status: Active » Closed (works as designed)

I see now. You need to enable the stock for a product type for that error to go away. No errors on the default rules now.

It might be helpful to add a message on the rules related pages that tell an admin this, with a link to the proper configuration page, as I've see other modules do.

Thanks!

guy_schneerson’s picture

jazzdrive3, thanks if you have any examples (on other modules) would really help,

jazzdrive3’s picture

I think the Date module does something similar to remind people to set the timezone for the site. Just a drupal_set_message() somewhere as long as there are no product types that have stock enabled for them.

guy_schneerson’s picture

jazzdrive3, ok will try and think of something

guy_schneerson’s picture

Category: bug » feature
Status: Closed (works as designed) » Active

This is an issue but i am no sure about the bast approach:

The problem is that until you enable stock on one of the product bundles the field does not exist and rules complain.
One approach is to add a message to the site status screen or prompt the user in another way to "Enable stock on one or more product types", however ideally it should be possible to have stock disabled for all products.

Any creative ideas/techniques to handle this would be appreciated.

klavs’s picture

I got this error message, because appearently the module, when enabled in modulelist, is NOT set to being enabled under the configuration setting.

IMHO I see no reason for configuration options on this - when it only contains an "enable this" - which is what one selects by enabling/disabling the module.

oddly enough, the module is not shown to have any active fields in the module list.

Look at how "commerce price table" works - when I have added the field this module provides (price table) to a product type - it shows in the module list, that this module is currently required for drupal commerce to work (and it shows a link to the field list).

guy_schneerson’s picture

Hi klavs, ill have a look at commerce price table, but from what i remember its a different case.
If i am not mistaken the price table module uses the new field it creates in a custom action and not in stander rules.
The stock module uses the stock field in rules conditions, this allows the customisation of the conditions. the side affect is if you haven't enabled stock on any products rules complains.
this is not only on new installs if you disable stock from all bundles the error will come back.

One possible way around this may be adding the fields to all product types on install and using a configuration setting for enabling disabling stock checks by product type. I am not sure if this is a good idea as i like the ability to create the fields only if they are needed and this will go against the idea of product types having their own identity.

guy_schneerson’s picture

Status: Active » Closed (works as designed)

i am hoping to do a complete re write of stock 2 moving all the metadata to the product content type and the checking marshaled by the stock module to an implementing sub module.
but for now its just the way it works