How to dynamically calculate the sell price of a product using rules
I have a quesiton for the comunity!
I see that using:
Event: Calculating the sell price of a product Action: Set the unit price to a specific amount
Everithing works very good if i want just to change the price.
Now I'm trying to change the above "Event" with the purpose to use my event (to allow the data-chaining of my tables),
so i think that i have to put a
rules_invoke_event('my_event', $line_item, $new_price) into the same hook that call the " Calculating the sell price of a product " rules invoke event,
to ensure that it's really called during the module is calculating the price.
I tryed all this hooks:
hook_commerce_price_field_formatter_prepare_view($entity_type, $entities, $field, $instances, $langcode, &$items, $displays).
hook_commerce_line_item_rebase_unit_price(&$price, $old_components, $line_item) <- it seems don't work! maybe it have a bug, maybe.
but whitout good result.
somethig better happen with
but I really don't want to modify codes into the commerce_cart_module, to avoid the problem of updating commerce_cart module in the future. I will like ti make my module independent.
(Using this way, i need to modify the commerce_cart module to ensure a way to chain my tables data during the data flow)
That's all! Somebody have any idea, or somebody can show me the right hook to catch and put inside my personal invoke_event to solve my problem?
Thanks for the support!