Code for dynamic pricing

Hey!

I am thinking of doing the following for my website, but I am not sure how to do so / whether it’s possible.

I am using 123 Form Builder to collect data from the visitor. On the same webpage, I have text fields, containing numbers, that I wish to update according to what the visitor inputs in.

  1. The user is supposed to input two dates on the form. I want the my text fields to update to the chosen dates. E.g. if the user picks 17/03/2018, then the text field will update to 17/03/2018

  2. I want a text field to update to the number of days in between the 2 dates. E.g. if the chose dates are 19 and 20 March, the text field will update to 2 days.

  3. I have a “total cost” that is a result of # of days (from my previous question) multiplied by a number (a predetermined cost per day). I want this text field to update as #1 and #2 happen.

Looking forward to hearing from you!
If it’s not feasible to do so, any suggestion on how to better execute this workflow would be much appreciated. Thanks!

1 Like

Hi Theresia.

Can you please share the site’s url to take a closer look for you setup?

Thanks,
Genry.

Hi Genry,

Thanks for your reply.

Here’s the link to the website https://theresiamarten.wixsite.com/mysite2

As for the functionalities described in the post, it will be happening in this page https://theresiamarten.wixsite.com/mysite2/copy-of-50-fare-surge

Thanks! I really appreciate your kind help :slight_smile:

Hi Theresia.

123 Form Builder is a 3rd party component.
WixCode currently does not have the ability to access 3rd part components.

Regards,
Genry.

In that case, what do I need to do? I need to collect data from the users — name, email, phone number, starting and ending date. I also want to collate all those data into google sheet.

Any suggestion?

One option is to build this form manually with built-in components, and then you can read them on change events and update the other components accordingly.

Regarding google sheet, there is an ability in collection view to export the data to a csv file. Maybe it will give you some starting point.

Regards,
Genry.

Where can I find resource on building form on Wix manually, using the built-in component?
I’m really new on Wix haha

Exporting data to csv file is fine, too. But I am not sure how to do that.

I think this will be a good starting point:
https://support.wix.com/en/wix-code/user-input

Regards,
Genry.

Noted on this! Thanks a lot Genry. Will try something out first :slight_smile:

Hi Genry,

I have built the forms manually and they are now already connected to the database — thanks to you!

Now the next step that I am working on is the pricing. There are few items that is supposed to change depending on the input for the dates:

  1. Coverage period from DDMMYYYY to DDMMYYYY (optional)
  2. of days (the formula is: end date - start date +1)

  3. total cost (the formula is daily cost multiplied by # of days)

I was following this thread, I feel that it’s kinda relevant, but wanna just have a check with you on this

Alternatively, are there any other resources that would help me making this happen? thanks!

Found this, might be relevant, I guess?

But I can’t find where is the Content Manager, need to find Hook

Hi Theresia.

I am not sure you need a calculated data from a collection.
You want to change the page’s element’s data according to input on another elements.

You should create onChange event on the affecting elements.
E.g. add onChange event on both of the date pickers, and there calculate the amount of days according to your formula and update text46 element with the result.

You can do similar calculations and updates on other affecting and affected elements.

Regards,
Genry.

How to get price of gold and after that set product price?