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

Add to Cart Button and Show If Feature

Thread began 7/12/2010 10:37 pm by mora398588 | Last modified 7/26/2010 6:55 pm by mora398588 | 2296 views | 13 replies

Eric Mittman

I can think of a couple of ways you could handle some things like this. The first part of this is to make it so that if you add the item to the cart a message displays letting the user know that the item has been added to the cart, there will also be a button to allow the user to proceed to the cart.

To do this you should set the redirect page in your add to cart server behavior to go back to this same page with a URL parameter present. So the end of the redirect might have this in it:


Then you would add in your message and the button where you would like the user to see it after adding the item to the cart. Once you have the message and the button there you would add in an if statement around this part so that it is only displayed if the added url parameter is set to one. Here is what that if statement would look like:

<?php if(isset($_GET['added']) && $_GET['added'] == 1){ ?>

your message and button code go here

<?php ?>

Once this part is done you can move onto the next part. So when the user clicks on the button to go to the cart you would like them to fill in the registration information first correct? If this is the case then you will send the user to the cart page. Then on the cart page you will check to see if they have filled in this information. If they have not they will be redirected to the page that will gather this info. If they have filled in the information then they can proceed to the cart and checkout.

To do this your registration form page will need to store the information in your db, then set a session variable. Then on the cart page you just check this session variable so see if it has been set to the predetermined value. If it has then the user will stay on the cart page. If this session variable does not exist or does not have the correct value then you would have a header call that would redirect the user to the registration page.

The set session value on the registration page should set a session variable to a particular value when the information is inserted into the db.

On the cart page you would add in an if statement to check on this session variable, if it is not set correctly you would redirect them to the registration page. Here is an example of what that code would look like.

if(!session_id()) session_start();
$_SESSION['registered'])) || $_SESSION['registered'] != 1){
header("Location: registration.php");

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





Ease of use


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...