close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Continue Shopping with Dynamic pages

Thread began 1/10/2011 3:30 pm by bjgarner241692 | Last modified 1/11/2011 2:30 pm by Jason Byrnes | 740 views | 3 replies |

bjgarner241692

Continue Shopping with Dynamic pages

I have two links in my nav menu that takes a viewer to the productsbycat.php page with a URL variable that trims the Product list.

If they go to either category page and add a product to the cart, then hit continue shopping, it will return them to the same page. That's all good, but if they then add another product, it replaces the product in the cart with the new product. Add to Cart is in a Repeat Region. Source Code does show the distinct Product ID and it is correct.

Quick fix, I simply changed the Continue Shopping Behaviour to go to a products.php page that does not use a URL variable. Instead, it just shows all products. They can then add product and it behaves correctly.

The troube is, if they go back to the nav menu and pick one of the two category pages and add a product it will wipe out the cart contents again.

Here is the eCart code for the productsbycat.php page.

php:
$param_products = "-1";

if (isset($_GET["Category"])) {
  $param_products = (get_magic_quotes_gpc()) ? $_GET["Category"] : addslashes($_GET["Category"]);
}
mysql_select_db($database_zeoconn, $zeoconn);
$query_products = sprintf("SELECT * FROM store_prodcats INNER JOIN store_prods on store_prodcats.Product = store_prods.Name WHERE store_prodcats.Category = %s", GetSQLValueString($param_products, "text"));
$products = mysql_query($query_products, $zeoconn) or die(mysql_error());
$row_products = mysql_fetch_assoc($products);
$totalRows_products = mysql_num_rows($products);
?>
<?php
// WA eCart AddToCart
if (isset($_POST["eCart1_1_ATC"]) || isset($_POST["eCart1_1_ATC_x"]))     {
  
$ATC_itemID $_POST["eCart1_1_ID_Add"];
  
$ATC_AddIfIn 0;
  
$ATC_RedirectAfter "cart.php";
  
$ATC_RedirectIfIn  "cart.php";
  if (isset(
$totalRows_products) && $totalRows_products 0)     {
    
$row_products WAEC_findRecordMySQL($products"ID"$ATC_itemID);
    if (
$row_products)     {
      
$ATC_itemName "".$row_products['Name']  ."";// column binding
      
$ATC_itemDescription "".$row_products['ProdSize']  ."";// column binding
      
$ATC_itemWeight floatval("0");// column binding
      
$ATC_itemQuantity "".$_POST["eCart1_1_Quantity_Add"]  ."";// column binding
      
$ATC_itemPrice floatval("".$row_products['ProdPrice']  ."");// column binding
      
mysql_data_seek($products0);
      
$row_products mysql_fetch_assoc($products);
    }
  }
  
$ATC_itemQuantity floatval($ATC_itemQuantity);
  if (
is_numeric($ATC_itemQuantity) && $ATC_itemQuantity != 0)     {
    
$eCart1->AddToCart($ATC_AddIfIn$ATC_RedirectIfIn$ATC_itemID$ATC_itemName$ATC_itemDescription$ATC_itemWeight$ATC_itemQuantity$ATC_itemPrice);
    if (
$ATC_RedirectAfter != "" && $eCart1->redirStr == "")     {
      
$eCart1->redirStr $ATC_RedirectAfter;
    }
    if (isset(
$_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] != "")  {
      
$_SESSION['WAEC_ContinueRedirect'] = $_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING'];
    }
    else  {
      
$_SESSION['WAEC_ContinueRedirect'] = $_SERVER['PHP_SELF'];
    }
  }
}
?>
<?php
// WA eCart Redirect
session_commit();
if (
$eCart1->redirStr != "")     {
  
header("Location: ".$eCart1->redirStr);
}
?>
Sign in to reply to this post

Jason ByrnesWebAssist

make sure that the ID for each item being added to the cart is unique.


it sounds like the ID value being added to the cart is the Category ID, not a unique ID.

Sign in to reply to this post

bjgarner241692

Hey, self serve solution!

I compared to another site with the same functionality and found this in the code.

php:
<?php

$eCart1
->GetContent();
?>



I added it to the category page and it works fine now.

Leaves me wondering though

1. why it is necessary?
2. why it is not added automatically?

Sign in to reply to this post

Jason ByrnesWebAssist

The get Content line populates the cart from the session, without it, the cart is considered empty on page load.

It should be added to the page automatically, i am not able to reproduce a scenario where it is not added.

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