close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

check for 'continue shopping' button pressed

Thread began 6/21/2011 6:44 am by CraigR | Last modified 6/21/2011 12:45 pm by CraigR | 2460 views | 10 replies |

CraigRBeta Tester

check for 'continue shopping' button pressed

how do i check for 'continue shopping' being pressed on the cart page.

I have a results page, on which i want to check for continue shopping being posted.

i have tried if(isset($_POST["cscart_Contiune_100"]))

Sign in to reply to this post

Jason ByrnesWebAssist

that if statement should work unless it is an image button, then the code should be:
if(isset($_POST["cscart_Contiune_100_x"]))

Sign in to reply to this post

CraigRBeta Tester

Hi Jason, no its not an image.

Sign in to reply to this post

Jason ByrnesWebAssist

then this:
if(isset($_POST["cscart_Contiune_100"]))

is the correct code.

if this is not working i need more details to go on.

a copy of the page would help and an explanation of what you are trying to accomplish

Sign in to reply to this post

CraigRBeta Tester

OK, here is the attached file

the client does not want the results page to be displayed on page load, so i am checking for the form to be posted before the results are displayed. (around line 1104)

However there are 2 other instances when I want the results displayed.

1, if items have been added to the cart and continue shopping has been pressed, when this page reloads, I want the results (and the existing search criteria) to be displayed.

2. if the customer forgets to check a row and clicks add to cart, the server validation reloads the page , highlighting the error, and the results are still displayed

Attached Files
search_die.zip
Sign in to reply to this post

Jason ByrnesWebAssist

OK, well, the continue shopping button on the cart page does not post to the results page.

when the add to cart button is pressed, the page that contains the add to cart button is stored in a session

On the cart page, the continue shopping button triggers a behavior to go back to the last page that an add to cart button was used on.

there is no way ion the results page to know if the continue shopping was pressed. you can check for the cart not being empty, but you cannot check for the continue shopping button pressed on the results page.

Sign in to reply to this post

CraigRBeta Tester

OK, thanks for looking, I'll try and think of a workaround.

This prompts my second question.

Before I added the server validation, I checked for the add to cart 'submit' being pressesed, and this allowed me to display the results.

After adding the server validation, if the validation fails, and the page is reloaded, however, in this instance, the 'submit' has not just been posted, so the results are not displayed.

Sign in to reply to this post

Jason ByrnesWebAssist

set the server validation failure redirect to pass a querstring back to the results page:
results.php?failed=true


and use the failed querystring to trigger showing the results.

Sign in to reply to this post

CraigRBeta Tester

Great, that works.

The only thing is, if i persist in clicking the add to cart without selecting anything, the querystring builds up, am i doing it right ?

eg

results.php?failed=true

can become

results.php?failed=true&failed=true&failed=true&failed=true

Sign in to reply to this post

Jason ByrnesWebAssist

that's because the forms action is set to pass any existing QS varaible on submit.

add the following code just before the form tag to clear it from the QS:

php:
<?php

if(isset($_SERVER["QUERY_STRING"])) {
    
$arrQS explode("&"$_SERVER["QUERY_STRING"]);
    foreach(
$arrQS as $k => $v) {
        if(
$v == "failed=true ") unset($arrQS[$k]);
    }
    
$_SERVER["QUERY_STRING"] = implode("&"$arrQS);
}
?>
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...