Hallo,
this is, at least for me, a major setback. When one creates a booking, the price can be modified and the relative order in fact mirrors the change on the final price, so far so good. But whenever the checkout page is accessed the price in the line item is calculated once again as the original price (calculated with the days/prices/etc.).
The only way to avoid this that I can foresee is to use an option to override the price, but this is a bit cumbersome.
I tried to not make the Rooms "Calculating the sell price of a product" rule to kick in if the order is in checkout state but it gives me some weird pricing (not even sure where it gets them from)
tx
Simone

Comments

cimo75 created an issue.

acrollet’s picture

could you give exact steps to reproduce? thanks.

cimo75’s picture

- Create a booking
- change the final price to something else different form the calculated price
- save the booking and check that the relative order created has in fact a line item with the custom price you've set
- change the order status to Checkout so that you can invoice a client
- visit the checkout page using the user owner of the order
- ISSUE: the booking line item has the price reverted to the calculated price instead of the custom price.

acrollet’s picture

Ok, so you're manually creating a booking in the back end and adjusting the price? (Vs. automatically doing so with e.g. a rule)

cimo75’s picture

Yes, that is, The usecase is that we can have a booking made on another platform or by spoken agreement and the price can vary, in those cases we want to set a different price and then invoice with that price and other variants.
I can also fix this issue adding a price variation with commerce_fee, discounts, etc. but I d like to know if I can edit the rule so that it won t recalculate the line item price if the booking price has been set by an admin (VS the machine)
tx
Simone

acrollet’s picture

this is an unusual workflow, why is it necessary to visit the checkout page?

cimo75’s picture

I don't think it is that unusual, say somebody calls you by phone and makes a reservation, you need to add the reservation to the database and invoice the client. This is common also if you accept bookings from other portals and need to do some extra charges for service and want to keep everything centralized for invoicing.
S.

cimo75’s picture

Looking at options in room units this is not viable as it is an admin only option and we should go over all the rooms units and add the option.. using commerce fees also is not an option as we don't want the vairation from the original price to be visible in the order, just the line item should change, any take on this is welcome, tx
S.

cimo75’s picture

Ok looking good with

{ "rooms_booking_manager_rooms_custom" : {
    "LABEL" : "Rooms custom",
    "PLUGIN" : "reaction rule",
    "WEIGHT" : "-10",
    "OWNER" : "rules",
    "TAGS" : [ "Rooms" ],
    "REQUIRES" : [ "rooms_booking_manager", "rules", "commerce_product_reference" ],
    "ON" : { "commerce_product_calculate_sell_price" : [] },
    "DO" : [
      { "rooms_booking_manager_price_apply" : { "commerce_line_item" : [ "commerce_line_item" ] } },
      { "entity_query" : {
          "USING" : {
            "type" : "rooms_booking",
            "property" : "order_id",
            "value" : [ "commerce-line-item:order-id" ],
            "limit" : "1"
          },
          "PROVIDE" : { "entity_fetched" : { "rooms_booking" : "Fetched Rooms Booking" } }
        }
      },
      { "data_set" : {
          "data" : [ "commerce-line-item:commerce-unit-price:amount" ],
          "value" : [ "rooms-booking:0:price" ]
        }
      }
    ]
  }
}

But I have a couple of question of this point:
- What is the difference between "Apply price to a booking line item" and "Set the line item price to the booking price" actions? The only difference I can see is that the second one is not using the proper currency (euros) but using dollars
- Basically in the Rule I have just posted I could remove the "Apply price to a booking line item" action and relay on the "Set data value" action to give the proper amount to the line item, is then this Rooms action obsolete ? Or is it doing something else?

tx
S.

EDIT: unfortunately altough it looks good on the edit order page, viewing the order I can see that the line item has the proper pricing but the subtotal is still showing the calculated price...

EDIT2;
this seems to fix it:

{ "rooms_booking_manager_rooms_custom" : {
    "LABEL" : "Rooms custom",
    "PLUGIN" : "reaction rule",
    "WEIGHT" : "10",
    "OWNER" : "rules",
    "TAGS" : [ "Rooms" ],
    "REQUIRES" : [
      "rooms_booking_manager",
      "rules",
      "commerce_line_item",
      "commerce_product_reference"
    ],
    "ON" : { "commerce_product_calculate_sell_price" : [] },
    "DO" : [
      { "rooms_booking_manager_price_apply" : { "commerce_line_item" : [ "commerce_line_item" ] } },
      { "entity_query" : {
          "USING" : {
            "type" : "rooms_booking",
            "property" : "order_id",
            "value" : [ "commerce-line-item:order-id" ],
            "limit" : "1"
          },
          "PROVIDE" : { "entity_fetched" : { "rooms_booking" : "Fetched Rooms Booking" } }
        }
      },
      { "commerce_line_item_unit_price_amount" : {
          "commerce_line_item" : [ "commerce_line_item" ],
          "amount" : [ "rooms-booking:0:price" ],
          "component_name" : "base_price",
          "round_mode" : "1"
        }
      }
    ]
  }
}