Here's one way to charge a fee to "rentals made after 1pm of a rental starting today"
Note that RentalStartDateUtc has Utc suffix, but since current nopC only supports Date and not time for rentals, I don't know if it has any impact - my test shows that when I entered item in cart with today's date, that is what was stored in the database, even though I'm UTC - 5 which would have been UTC next day since I entered it at 9pm. (There is no DateTime.UtcToday, but DateTime.UtcNow.Date should work in its place if you prefer to use compare.) Also, below I use DateTime.Now.Hour and not DateTime.UtcNow.Hour, because I'm comparing the current hour to see if it's later than 1pm my time (13:00) - but this time will also depend on the time of your server.
Order | Type | Name | Expression | Fee Expression |
105 | Boolean | ChargeAFee | DateTime.Now.Hour > 13 and Items.Any(Product.IsRental and RentalStartDateUtc = DateTime.Today) |
|
110 | Option | Payments.AuthorizeNet | Show | [ChargeAFee] ? 2 : 0 |
Adjust 13 to the hour of the day you need. Adjust the "2" in [ChargeFee] ? 2 : 0 to be the fee you want to charge.
You need to enter a similar line & fee expression for each payment method you've enabled.
String
RentalStartDescription
Items.Any(Product.IsRental) ? Items.First(Product.IsRental).RentalStartDateUtc.ToString("ddd") : ""
Then use [RentalStartDescription] in your Option rule's Description Expression.
Also, note that RentalStartDateUtc is UTC, and that "ddd" is just the day of the week. (Contact us if you need more info.)
DateTime
StartDate
Items.Any(Product.IsRental) ? DateTime(Items.First(Product.IsRental).RentalStartDateUtc) : DateTime.MinValue
String
StartDateDOW
[StartDate].ToString("ddd")
String
RentalStartDescription
[StartDate] = DateTime.MinValue ? "" : [StartDate].AddDays([StartDateDOW] == "Sat" ? 2 : [StartDateDOW]== "Sun" ? 1 : 0).ToString("ddd")
Be sure to user set the Order/Line# sequentially, and before you ...
Then use [RentalStartDescription] in your Option rule's Description Expression