close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

add discount field to payment form?

Thread began 12/10/2021 12:46 pm by tony | Last modified 12/14/2021 2:45 pm by Ray Borduin | 197 views | 11 replies |

tony

add discount field to payment form?

Hello Ray,
I built a payment page (with your help, of course) where the user pays to register to a website and play a game.
This works as expected.
But now the customer would like to add a coupon (discount code) to the form.
I simply would add an input form where the user enters the coupon code. The code can be a static value, so there is no need to handle it with the database. Maybe in the future...
But now it would be enough to just enter the code in the coupon field to set a discount price.
Can I add this feature to the current page without re-do it from scratch?
Here is the page (private):https://www.landgame.eu/xmas-room/registrazione.php
Please note I'm still testing it (so the real payment is 0.01 EUR per registration).
Credentials to see the page are attached as private attachment.
Thanks for any help, Ray.

tony

Sign in to reply to this post

Ray BorduinWebAssist

Yes. Just add the coupon code field to the form. Then use the server behaviors panel to save the form value into the session. Lastly, update the cart object to add a discount based on the session value.

Sign in to reply to this post
Did this help? Tips are appreciated...

tony

Originally Said By: Ray Borduin
  Yes. Just add the coupon code field to the form. Then use the server behaviors panel to save the form value into the session. Lastly, update the cart object to add a discount based on the session value.  


IS there a way to update the Price displayed before submitting the form?
TIA
Tony

Sign in to reply to this post

Ray BorduinWebAssist

You could add a new "Apply coupon" button that refreshes the page and shows the updated discount so they can see the new price before pressing the checkout button.

Sign in to reply to this post
Did this help? Tips are appreciated...

tony

Originally Said By: Ray Borduin
  You could add a new "Apply coupon" button that refreshes the page and shows the updated discount so they can see the new price before pressing the checkout button.  


I'm almost done, but I can't make the cart value set to 0 with discount.
Example:
The regular item price is 0.01€.
The coupon should allow to set the item price to 0,00€ (free).
But the discount work only if the resulting price is not 0.

Example:
The regular item price is 0.02€.
The discount is subtotal (0.02) minus 0.01.
This way it works and I get the cart to be 0.01€.

Again, if I set the price to 0.02€ and the discount to subtotal minus 0.02, it doesn't work and I get the price 0.02€.

But how can I set the price to be 0 with a coupon code?
Is there something else to look at in the cart definition?

Or perhaps is Paypal that does not allow 0 money transactions?
How can I solve this problem, in this case?

TIA
tony

Sign in to reply to this post

Ray BorduinWebAssist

Paypal won't allow a zero transaction... You would have to add code to skip paypal and process the order without payment when it is free.

Sign in to reply to this post
Did this help? Tips are appreciated...

tony

Originally Said By: Ray Borduin
  Paypal won't allow a zero transaction... You would have to add code to skip paypal and process the order without payment when it is free.  


If I understand corretly I should skip the code if the discount code is correct and go to another result page to insert the data in the db.
Is this right?
TIA
tony

Sign in to reply to this post

Ray BorduinWebAssist

You could just skip the paypal payment portion and not create a separate page. You could do a separate page if that helps you though. There are multiple ways to do it, but however you do it, you can't use paypal on a zero dollar payment.

Sign in to reply to this post
Did this help? Tips are appreciated...

tony

Originally Said By: Ray Borduin
  You could just skip the paypal payment portion and not create a separate page. You could do a separate page if that helps you though. There are multiple ways to do it, but however you do it, you can't use paypal on a zero dollar payment.  


Hello Ray,
is there a way to skip the ecart server behaviours without breaking their editing ability?
Something like the screenshot attached?
I'm trying to do this but it doesn't work.
TIA
tony

Sign in to reply to this post

tony

never mind.
It seems to work, indeed.
Tony

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...