Complex price calculation using a field in the product
I'm trying to do some complex dynamic price calculation using rules.
The event used is the usual "Calculating the sell price of a product", no conditions and the action is "Add an amount to the unit price". So far nothing fancy.
The calculation uses a field in user's profile and another one in the product. Due to complexity, I need to use PHP so in the "amount" field, I select "commerce-line-item:commerce-unit-price:amount" as data selector and PHP evaluation.
I can access the field in the user profile using this code:
$usuario = user_load($user->uid);
But I really have no idea how to access the product I'm trying to calculate the price.
Any help is welcome.