close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Dynamic Lists in Shopping cart - Only show if product offers option

Thread began 5/10/2012 7:09 am by toni272059 | Last modified 5/14/2012 2:31 pm by Jason Byrnes | 2456 views | 7 replies |

toni272059

Dynamic Lists in Shopping cart - Only show if product offers option

Store offers various products. Some of which offer embroidery for an additional fee.

The Product Detail page is where the customer adds the additional Embroidery fee (price increment) and it is added to the cart along with the product .
product_detail.php?ProductID=1

On the Cart page would like to add the Embroidery Selection process -- Eg select a Type, select a Style, enter the Letters. I have setup two dynamic lists and a text field. All inside a DIV inside the Repeat Cart Region.

Question -- how do I setup the Embroidery Selection DIV to only show if the Embroidery Option was added to the Cart on the Product Detail page? I tried adding a Show If but that just removed the DIV from all Items in the Cart regardless of selection on Product Detail page.

I have attached the cart.php

Next step -- will be to dynamically add the selected items to the Confirm Order page, upload them to the orders database table, and add them to the confirmation email. Any tips as to most efficient way to do this would be appreciated.

Thanks as always.

Attached Files
cart.php.zip
Sign in to reply to this post

Jason ByrnesWebAssist

this should not be done on the cart page, the embroidery selection should be done on the details page. putting it on the cart page means that there is no way to store the selections to the cart object.

te embroidery selection need to happen on the product detail page so that when the item is added to the cart, the other selection will also be added.


the type style and and text all need to be columns in the cart object and need to be included on the product page.

Sign in to reply to this post

toni272059

OK, so I moved the Embroidery Selection DIV out of the Cart and into Product Detail
product_detail.php?ProductID=3

Updated the eCart with columns. Selections successfully added from Product Detail to Shopping Cart

However, now the Embroidery Selection DIV appears on every Product Detail page regardless of whether embroidery is even an option for the product being purchased

How can I set it up to hide the DIV until the Embroidery ($15) item is selected from the Dynamic Select Menu?

Also, the Checkout button is no longer working. Cart appears to be redirecting back to itself (/cart.php?). The Continue Shopping, Clear Cart and Update buttons are all working correctly. There are no error messages.

<?php
//WA eCart Redirect Check Out
if (isset($_POST["eCart1_Checkout"]) || isset($_POST["eCart1_Checkout_x"])) {
$Redirect_redirStr="";
if ($Redirect_redirStr != "") {
if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] != "") {
if (strpos($Redirect_redirStr, "?") < 0) {
$Redirect_redirStr .= "?".$_SERVER['QUERY_STRING'];
}
else {
$Redirect_redirStr .= "&".$_SERVER['QUERY_STRING'];
}
}

$eCart1->redirStr = $Redirect_redirStr;
}
$eCart1->cartAction = "Checkout";
}
?>
<?php
// WA eCart Redirect
if ($eCart1->redirStr != "") {
header("Location: ".$eCart1->redirStr);
}
?>

Sign in to reply to this post

Jason ByrnesWebAssist

add the following script to the head:

<script type="text/javascript">
function showHideEmbroideryOptions(optionIndex) {
if(optionIndex == '2') {
document.getElementById('embroideryOptions').style.visibility = "visible";
} else {
document.getElementById('embroideryOptions').style.visibility = "hidden";
}
}
</script>




change the style tag for the embroideryOptions div to include visibility:hidden;

<div id="embroideryOptions" style="margin-top:15px;padding:5px;border: 2px solid #C00;visibility:hidden;">



and add an onchange event to the embroidery select list:

<select name="eCart1_1_Embroidery_Add" onChange="showHideEmbroideryOptions(this.selectedIndex);">






the checkout behaivor code:

php:
<?php

//WA eCart Redirect Check Out
if (isset($_POST["eCart1_Checkout"]) || isset($_POST["eCart1_Checkout_x"])) {
$Redirect_redirStr="";
if (
$Redirect_redirStr != "") {
if (isset(
$_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] != "") {
if (
strpos($Redirect_redirStr"?") < 0) {
$Redirect_redirStr .= "?".$_SERVER['QUERY_STRING'];
}
else {
$Redirect_redirStr .= "&".$_SERVER['QUERY_STRING'];
}
}

$eCart1->redirStr $Redirect_redirStr;
}
$eCart1->cartAction "Checkout";
}
?>



does not set a redirect page, change:

php:
if (isset($_POST["eCart1_Checkout"]) || isset($_POST["eCart1_Checkout_x"])) {

$Redirect_redirStr="";



to:

php:
if (isset($_POST["eCart1_Checkout"]) || isset($_POST["eCart1_Checkout_x"])) {

$Redirect_redirStr="checkout.php";
Sign in to reply to this post

toni272059

Thank you for the code to show/hide the embroidery depending on selection. Works great.

However, the redirect from Cart to Checkout is still not working. It has in the past. Still redirecting back to itself (.../cart.php?). I did update the code
<?php
//WA eCart Redirect Check Out
if (isset($_POST["eCart1_Checkout"]) || isset($_POST["eCart1_Checkout_x"])) {
$Redirect_redirStr="checkout.php";
if ($Redirect_redirStr != "") {
if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] != "") {
if (strpos($Redirect_redirStr, "?") < 0) {
$Redirect_redirStr .= "?".$_SERVER['QUERY_STRING'];
}
else {
$Redirect_redirStr .= "&".$_SERVER['QUERY_STRING'];
}
}

$eCart1->redirStr = $Redirect_redirStr;
}
$eCart1->cartAction = "Checkout";
}
?>
<?php
// WA eCart Redirect
if ($eCart1->redirStr != "") {
header("Location: ".$eCart1->redirStr);
}

My next challenge is to have the Embroidery Selection choices Only show on the Cart page when they were selected on the Product Detail page.

I have been looking thru the forum, is this something I would do with SecurityAssist Show Region?

The Type and Style data comes from Dynamic Lists from separate recordsets, and the Text and Msg are each from an eCart Session Value so doesn't look as if a recordset Show If would work..?

Many thanks as always.

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

Jason ByrnesWebAssist

I have created a support ticket so we can look into this issue further.

To view and edit your support ticket, please log into your support history:
supporthistory.php

If anyone else is experiencing this same issue, please append to this thread.

Sign in to reply to this post

toni272059

I am not seeing a new ticket in my support history...?
thanks

Sign in to reply to this post

Jason ByrnesWebAssist

I have recreated it, should be there now.

Sign in to reply to this post

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