Discount using weekdays and weekends - Mendix Forum

Discount using weekdays and weekends




In one of my project , Admin should give discount offer for customers to purchase products where like in products list page it should display like weekdays-10% and weekends - 20% and when customer purchases the product it should display the message. and discount amount should be debited from principal amount.

how should i do this how can i give discount offer to customers in page showing weekdays and weekdays diferent .




2 answers

You should do this at the backend on the server in a microflow where you first take the current day's daynumber and compare that to the projectsettings in the runtime-tab: 'First day of the week'.

formatDateTime([%CurrentDateTime%], 'u')

You can test this in the FunctionFiddler of

So now you know if it is a weekday or a weekendday and thus you can display the corresponding price and discount.



I am sure there are more thsn one solution to your issue, but using the DateTime parse functionality you can find out the day of the week. You can find the documentation for this here and more parser patterns here

You can use a custom display pattern in the user view and incorporate this into what you would like to achieve

Maybe this already helps you to achieve what you are looking for. As far as I know there is also a learning path that might have overlap with what you would like to do :)