- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2023 03:12 AM
In catalog, I want to calculate total ticket price based on two variables like source and destination.
example:
Variable:
Buse Type: A/C Sleeper
source: Hyderabad
Destination: Chennai
Ticket Price: 1500
Variable:
Buse Type: Non A/C Sleeper
source: Hyderabad
Destination: Vizag
Ticket Price: 1200
And Also discount to age below 2 years----10%
Age above 75 ----- 8%
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2023 02:39 AM
Hi, @gubbala kishore ,
You can simply create 2 on-change client scripts with one reusable Script Included. Please find my below scripts to achieve that.
But I would suggest you, create a custom table with the fields like Bus Type, Source, Destination, and Ticket Price. After that create records with all possible combinations.
On the catalog Side, 2 client scripts onChange of source, and onChange of Destination fields, and create one reusable script include and call it from both the onChange client scripts.
Please find the below steps:-
Step 1:-
Created one table with Bus Type, Source, Destination, and Ticket Price.
Step 2:-
Create the records in your custom table with all the possible entries.
Step 3:-
On the Catalog Side, Create a source variable with a type select box and fetch its choices from your custom tables source field and repeat the same for the destination field.
Step 4:-
Create Onchange client scripts on the source and destination fields to populate the ticket price.
onChange of Source field Client Script:
Step 5:-
Create a script Include and call it from both the client scripts.
Script Include Code:-
Result:-
From the process perspective for process owners, it is easy to maintain the Bus Ticket Prices. If changed simply they can change its related entry in the Custom table.
In order to apply the discount create another variable called age and build the logic in the script include.
Please my answer as helpful, if it helps you!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2023 02:39 AM
Hi, @gubbala kishore ,
You can simply create 2 on-change client scripts with one reusable Script Included. Please find my below scripts to achieve that.
But I would suggest you, create a custom table with the fields like Bus Type, Source, Destination, and Ticket Price. After that create records with all possible combinations.
On the catalog Side, 2 client scripts onChange of source, and onChange of Destination fields, and create one reusable script include and call it from both the onChange client scripts.
Please find the below steps:-
Step 1:-
Created one table with Bus Type, Source, Destination, and Ticket Price.
Step 2:-
Create the records in your custom table with all the possible entries.
Step 3:-
On the Catalog Side, Create a source variable with a type select box and fetch its choices from your custom tables source field and repeat the same for the destination field.
Step 4:-
Create Onchange client scripts on the source and destination fields to populate the ticket price.
onChange of Source field Client Script:
Step 5:-
Create a script Include and call it from both the client scripts.
Script Include Code:-
Result:-
From the process perspective for process owners, it is easy to maintain the Bus Ticket Prices. If changed simply they can change its related entry in the Custom table.
In order to apply the discount create another variable called age and build the logic in the script include.
Please my answer as helpful, if it helps you!!