Hello, I have created a module to increase the price per day not proportional, for example 1 day 10€ 2 days 15€ 3 days 18€
the module is similar that rooms_pricing per cosecutive days
it's works correctly

The problem is that I use the complents with porcentage. In my case a ski rental:

1 day without boots 27,50€ with boots +20%
2 days without boots 50,50€; with boots +20%=60.60€
...

The problem is, it only calculate correctly the first day.

I think that the problem is that in the file

sites\all\modules\rooms\modules\rooms_pricing\includes

the $base_price is not correct, if I modify the $bise_price for 50.50 manualy, it works correctly

case ROOMS_INCREASE:

$price += $base_price * ($modifier['#amount'] * $modifier['#quantity']) / 100 ;
$reply['log']['modifiers'][$source][ROOMS_DYNAMIC_MODIFIER]['op'] = ROOMS_INCREASE;
$reply['log']['modifiers'][$source][ROOMS_DYNAMIC_MODIFIER]['post'] = $price;

break;

Do you have some idea
thanks

Comments

santy created an issue. See original summary.

santy’s picture

Issue summary: View changes
santy’s picture

Issue summary: View changes
cilefen’s picture

Project: Drupal core » Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals
Version: 7.x-dev » 7.x-1.x-dev
Component: other » Code

When you have got a problem with a module, the issue belongs in its queue.

santy’s picture

I respond to myself

I declarated a global variable $price_modify in my module and introduce de value of the price

global $price_modify;
$price_modify=$price_modifiers['rooms_periodic_pricing']['#amount'];

next using the api pricingcalendar

and in public function

public function applyPriceModifiers($base_price, $days, &$reply) {

$price = $base_price;
$price2=$base_price+$GLOBALS['price_modify '];

...

case ROOMS_INCREASE:
$price += $price2 * ($modifier['#amount'] * $modifier['#quantity']) / 100;
$reply['log']['modifiers'][$source][ROOMS_DYNAMIC_MODIFIER]['op'] = ROOMS_INCREASE;
$reply['log']['modifiers'][$source][ROOMS_DYNAMIC_MODIFIER]['post'] = $price;
break;

case ROOMS_DECREASE:
$price -= $price2 * ($modifier['#amount'] * $modifier['#quantity']) / 100;
$reply['log']['modifiers'][$source][ROOMS_DYNAMIC_MODIFIER]['op'] = ROOMS_DECREASE;
$reply['log']['modifiers'][$source][ROOMS_DYNAMIC_MODIFIER]['post'] = $price;
break;

And it works correctly form me...