I have detected that discount all nights by percent isn't working propoerly. I have take a look at the code of hotel_discounts.module and I have watch a possible bug in the line 299.

I have make this change:

- $new_price = ceil($apply_price * (1 - $discount->rate) / 50) * 50;
+ $new_price = ceil($apply_price - ($apply_price * $discount->rate));

Before when you looking for a room with this discount, there wasn't any change in the price.
Now it's working fine.

Comments

larowlan’s picture

The two lines of code are mathematically equivalent except the original code rounds to the nearest $50.
Perhaps that's the issue. Maybe it should round to the nearest $10 or $5 instead.

davidlorenzo’s picture

Ok you are true. But I have checked and are the same. But I don't know why before make that change, the module didn't calculate the discount, so in the final price of the book hadn't any discount. And after I did the change, all works fine...