isotope / core

Core repository of Isotope eCommerce, an eCommerce extension for Contao Open Source CMS
https://isotopeecommerce.org
135 stars 107 forks source link

[2.1.2] adding hook for rules conditions #1154

Open Zeromax opened 10 years ago

Zeromax commented 10 years ago

Is it possible to add a hook to manipulate the findByConditions method?

in this line: https://github.com/isotope/core/blob/master/system/modules/isotope_rules/library/Isotope/Model/Rule.php#L118

There is no way to take influence to the conditions of the rules without writing it in that method directly. Or am I missing something?

Reason why I need this: I have added a custom field to the tl_iso_rules table and can not use the conditions which I set there.

Toflar commented 10 years ago

Well, basically all the rules do internally is using the $GLOBALS['ISO_HOOKS']['calculatePrice'] hook so you can do the very same, can't you?

Zeromax commented 10 years ago

Thats possible, but totaly uncomely ;)

So your idea means the following:

Or am I missing something?

aschempp commented 10 years ago

No, you should not use rules but calculate everything on your own...

Zeromax commented 10 years ago

@aschempp really?

It would be also an option to have a hook before a Rule is used with a boolean return value for using. This hook could take place in this method: https://github.com/isotope/core/blob/master/system/modules/isotope_rules/library/Isotope/Rules.php#L81