Copy link to clipboard
Copied
I know regular parameters can be passed via a URL
but I have a "checkout" button. The only way to view the checkout screen is to goto the shoppingCart form and click the submit button "checkout"
Is there a way I can create a link for the user, to click on a"checkout" button, without having to goto the above screen ?
eg. <a href="shoppingCart?form.submit="checkout">link</a>
Copy link to clipboard
Copied
ok, I solved this eventually by passing a regular parameter in the url
then I used
<cfif form.submit = "checkout" or isdefined ("URL.checkout")>
run the checkout code
Copy link to clipboard
Copied
Store all your data in a session variable and process the session variable in your checkout page. Then you don't need url variables.
Copy link to clipboard
Copied
it's my first shopping cart so go easy on me!
viewCart.cfm displays the shopping cart, along with 2 submit buttons
one to update qty
one to checkout
the form action calls viewCart.cfm, and branches to appropriate code path based on form.submit = checkout or update
so in order to reach the checkout screen I need form.submit = checkout set, hence why I couldn't hyperlink to the checkout page
hindsight is a wonderful thing, and next time, I'll write a RAM based cart, which you can change row qty dynamically in the form (I'm guessing that's possible?!) I'll also start using CFC's and the like.
Copy link to clipboard
Copied
I think I've learned not to have a total reliance on session vars
For example holding the users cart in a session based struct is one thing, but them completing checkout (having debited the users card) only to find the session vars have expired before you've inserted them into a table is something I wish to avoid!
I use a mix of session vars and a webCart table in the database. Any orders that are 'checked out', get transferred from the temporary webCart and put in the "orders" & "ordered_merchandise" tables