close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

voucher system to check if same code used before

Thread began 5/21/2012 10:30 am by Christopher West | Last modified 5/24/2012 11:47 am by Christopher West | 3138 views | 19 replies |

Christopher WestCommunity Expert

voucher system to check if same code used before

Hi. just fine tuning a few bits to my website project.

with the voucher system I have in place, the voucher codes would always be single use since they are unique numbers (gift certificates sold to customers). on the confirm page i have an update transaction so that the voucher code the customer enters is then updated in the database as being "redeemed" and a customer reference ID and date is stored - so thats ok. But I just want to put some validation on the cart.php page (this is where the customer would enter the voucher code) so that if they try and use the same code again a message displays telling them that "voucher code has already been redeemed".

I am stuck to know how I could use form validation to check the state of a field in a table column in the database. IE the field in question "VoucherStatus" is either a "1" (redeemed) or a "0" (unused).

any thoughts how I can tackle this?

further to this problem, there is a logical problem in terms on the voucher status is updated on the confirm page (on page load). but what if the customer changes their mind and continues adding to the cart...if thye had reached the confirm page before this then then updated voucher code wont allow them to use it again (since the voucher status would have been updated on the confirm page)......I did think about putting the voucher update code on the "success" page (after customer goes to paypal to pay for order) but then this can be a problem, because what IF a customer uses a voucher code, then goes to paypal to pay for order BUT then closes their browser - this would mean the success page would never be reached and then the voucher code update will never take place since it would have been on that success page.

any thoughts appriciated on this to :)

Chris

Sign in to reply to this post

Jason ByrnesWebAssist

create a recordset that queries the coupon table for the entered coupon, and checks that the VoucherStatus is = to 0.

one of the variables created by the recordset will be the total rows returned:
$totalRows_recordsetName

where recordsetName is the name of the recordset.

in the server validation behavior, you can use numeric validation to make sure the recordset is empty. Select numeric validation, and enter:
$totalRows_recordsetName

for the server variable. Set the minimum to -1 and the maximum to 0


this will pass validation only of the recordset ins empty.


It sounds like you are using Paypal standard. With paypal standard, you should be using an IPN page to update order information on a successful transaction. the update for the coupon status should happen on the IPN page.

Sign in to reply to this post

Christopher WestCommunity Expert

Hi yes I am using PayPal standard. to be honest I dont know to much about IPN setup or use so a little in the dark there :(

Sign in to reply to this post

Jason ByrnesWebAssist

there are many threads throughout this forum where i talk about paypal standard and IPN. For your use, i would recommend not using standard. I would recommends express checkout, or payments pro instead.

the workflow of PayPal standard is this:
the confirm page posts the information to the paypal servers.

On the paypal server the costumer enters their information for how the transaction should be processed.

The paypal server excepts or denies this information and directs the user to the success or failure page.

At this point the transaction is line to be processed. it can take 30 seconds or 5 days for the transaction to got through. Once the transaction is processed the IPN post is made by paypal servers to the page you specify.

The drawback of paypal payments standard is that it is not processed real time the IPN page is never seen by the customer.

Instead of using payPal Payments standard, i would recommend using Paypal Express checkout, this is a free paypal option that is processed real time and does not require using an IPN post.



This really makes it a problematic system to use for something like whjat you are setting up.


For more details on IPN, see the paypal documentation here:
ipn

Sign in to reply to this post

Christopher WestCommunity Expert

I know you mentioned it before to me, but the website is close to finished. and I was worried that it would mean I need to recode the checkout/confirm pages (and I already had them nicely coded with relevant code etc. I didnt really know how to set up the paypal express since I got the checkout form with the delivery options etc that was hand coded. I knoe ecart has server beahviours to add paypal manually though but im still in a bit in the dark how to implement paypal express while know what to deleiver from the paypal standards code.

Sign in to reply to this post

Jason ByrnesWebAssist

If you don't want to change the gateway, then you will need to look into creating the IPN page. there are many threads on IPN throughout this forum.

if you need help creating the IPN page, we can assist you in a premiere support appointment.

Sign in to reply to this post

Christopher WestCommunity Expert

tempting on the support ticket but as it goes i have gone way over my budget for this projects (didnt think it would be so time consuming) so not making much moeny from it now :(

I guess im not worried to much about if a transaction taking 5 days to confirm payment because in the database I have allowed for the admin to update the order status (pending, payment authorised, payment declined etc) so with this the customer waits until payment is authorised.

I will research IPN more certainly in this forum. but at this stage im hoping that its something i can edit quickly as the website needs to be live by thursday max. (or at least if its something i can update after website is launched and there wont be any distruption).

Sign in to reply to this post

Christopher WestCommunity Expert

Jason what i like to know is this: with regard to PayPal Express:

1. would I still have the billing/shipping addresses AND delivery price options on checkout page?
2. do I ONLY require the paypal account holds email address (as the client has ONLY provided me with their paypal email address that they use).
3. is paypal express completely free (as client hasnt instructed me to use any other payment services that would charge them a % transaction fee).
4. i remember you mentioning a while back that to create a payapl express page i would rerun the ecart wizard and then chose "paypal pro" and then delete the form (or something from the page). so what where i got a little lost. (but rather then using the wizard wouldnt it be faster to use one of the paypal server behaviours that ecart provides in the server behaviours panel?

Chris

Sign in to reply to this post

Christopher WestCommunity Expert

if i go to the ecart checkout wizard and select paypal website payments pro (which i guess you would chose for paypal express). The wizard then requires me to enter: Username, Password, and Signature (but I only have the clients email address associated with her paypal account) so a bit confused to how i can set this up as paypal express :-/

Sign in to reply to this post

Christopher WestCommunity Expert

ok to some degree I got part of the PayPal Express working. but a few problems....

1. I cannot seem to get my delivery options (different costs) to paypal website.
2. If I chose products with different product options (these options have seperate prices) then the website doesnt pass to paypal it goes to the websites failure page.

If you have time i will attach the original checkout/confirm (paypal standard) page and the new checkout/confirm page with (paypal express)

I was thinking about putting the delivery options on the cart page but thought in terms of workflow it should be kept on the checkout page.

What I am hoping to achieve is that with paypal express, customer enters a voucher code on cart page, on checkput page they enter billing/shipping address + chose a shipping price then they go to paypal make payment, on confirm page summary of costs. they click on place order and the success page will show receipt, send email, update voucher table in database and create order detail and order summary records and then clear cart...I wouldnt have a problem with the success page. Im guessing if everything is stored in sessions then it should be pretty much straight forward. im just having trouble passing the delivery charges to paypal and also displaying product options on paypal. and also if the voucher code used makes the order <= then it should just go to the confirm page since there would be nothing to pay.

all i require is a few pointers hopefully. if im on the right track. if im completely wrong then i need to order a premier ticket asap as need to go live this week.

Chris

Attached Files
paypal express implentation.zip
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...