Discount using weekdays and weekends - Mendix Forum

Discount using weekdays and weekends

0

Hello,

 

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 .

 

Thanks

Pavan

asked
2 answers
0

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 mymendixdemo100-sandbox.mxapps.io

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

answered
0

Hi,

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 https://docs.mendix.com/refguide/parse-and-format-date-function-calls and more parser patterns here https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html

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 :)

answered