close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

ecart select to add cart

Thread began 3/30/2011 7:09 am by turk361661 | Last modified 4/01/2011 11:22 am by Jason Byrnes | 3221 views | 9 replies |

turk361661

ecart select to add cart

Hello,

I have a list of products. Next to each product is an "add to cart" button.
I also added a text link to "view selections".
If they add an item to the Cart. The page stays the same (no redirect). If they click my link "view selections" it takes them to the cart display page.

The issue.
If the user is on product number 10 at the bottom of the page and they click on Add to Cart. The page refreshes, and positioning moves back to the top where product number 1 is.

How can I adjust the page so after the user clicks add to cart button when they are on product number 10, the positioning of the page stays the same and they can continue to scroll down through the remaining products 10, 11, 12 etc.

Thanks for your help,
Danielle

Sign in to reply to this post

Jason ByrnesWebAssist

add an anchor next to each add to cart button:

<a name="id">Product 10</a>


and modify the add to cart form action to pass the anchor:
<form action="<?php echo ($_SERVER["PHP_SELF"]."#id=10".(isset($_SERVER["QUERY_STRING"])?"?".htmlentities($_SERVER["QUERY_STRING"]):""));?>" method="post" >



see this page for details on using the anchor name attribute:
html_links.asp

Sign in to reply to this post

turk361661

Hi Jason,


I am using anchors next to the product names. The products are dynamically listed on the page.
My code is attached. I should have attached this the first time, sorry.
Do I also need to anchor the add to cart (in my case select to print) buttons?

See attached.
Thanks for the help,
Danielle

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

Jason ByrnesWebAssist

you need to edit the redirect of the add to cart button code to include the anchor:
change:

$ATC_RedirectAfter = "";

to:
$ATC_RedirectAfter = "#".$_POST["PrintCart_1_ID_Add"]."";

Sign in to reply to this post

turk361661

Jason,

Thanks for the help. I added the code. But it is still not working properly.
Please see attached.

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

Jason ByrnesWebAssist

your page is missing this code:
<?php
// WA eCart Redirect
if ($PrintCart->redirStr != "") {
header("Location: ".$PrintCart->redirStr);
}
?>



that should be just before the doctype tag.

Sign in to reply to this post

turk361661

Hi Jason,

I added the code.
When I view the page in my web browser. Nothing displays but a "Catchable fatal error:"

See attached for code and details.

Thanks,
Danielle

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

Jason ByrnesWebAssist

at line 64:

php:
$ATC_RedirectAfter = "#".$_POST["PrintCart_1_ID_Add"].""; ;



there is a double ; at the end, there should only be one:

php:
$ATC_RedirectAfter = "#".$_POST["PrintCart_1_ID_Add"]."";



and the redirect code:

php:
<?php

// WA eCart Redirect
if ($PrintCart-->redirStr != "") {
header("Location: ".$PrintCart-->redirStr);
}
?>



should be:

php:
<?php

// WA eCart Redirect
if ($PrintCart->redirStr != "") {
header("Location: ".$PrintCart->redirStr);
}
?>
Sign in to reply to this post

turk361661

Awesome. Thanks for your help Jason!

- Danielle

Sign in to reply to this post

Jason ByrnesWebAssist

you're welcome.

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