Duplicate products added to cart
Posted: Tue Jul 10, 2012 12:10 pm
We're having problems with 2 of the same product being added to the cart regardless if you check a sub-product or not. One will always have a zero sum. Take a look on this page to try it for yourself if you are curious. http://www.artandsoulbeads.com/store/crystal_components_rondelles_with_swarovski_chatons.html
Problem 1
I am missing some type of form validation which prevents products being added to the cart without being checked.
Problem 2
The template is also wrong in that it adds 2 products with one having a zero sum.
Problem 3
Tables are off for products but <td>'s are still being added in the generated HTML for products. Is there a VAR.No Table type of command I can use for the sub products?
I am hoping Jim or someone can help me find a script which was built for shopsite to prevent problem 1 from happening.
For anyone who thinks they can help here is my product code.
Problem 1
I am missing some type of form validation which prevents products being added to the cart without being checked.
Problem 2
The template is also wrong in that it adds 2 products with one having a zero sum.
Problem 3
Tables are off for products but <td>'s are still being added in the generated HTML for products. Is there a VAR.No Table type of command I can use for the sub products?
I am hoping Jim or someone can help me find a script which was built for shopsite to prevent problem 1 from happening.
For anyone who thinks they can help here is my product code.
- Code: Select all
#########################
[-- DEFINE SUBPRODUCT --]
[-- VAR.TableLayout no --]
<ul><li><input type="checkbox" name="itemnum" value="[-- PRODUCT.RECORDNUMBER --]">
[-- product.name --] [-- product.price --] </li></ul>
[-- IF PRODUCT.QuantityPricing --]
<div class="QPtable">
[-- PRODUCT.QuantityPricing --]
</div>
[-- END_IF --]
[-- END_DEFINE SUBPRODUCT --]
#############################
#########################
[-- DEFINE PRODUCT_CROSS_SELL --]
[-- INCLUDE Product-Name PROCESS --]
[-- INCLUDE Product-Price PROCESS --]
[-- IF VAR.MoreInfoTemplate --]
[-- IF PRODUCT.QuantityPricing --]
<div class="QPtable">
[-- PRODUCT.QuantityPricing --]
</div>
[-- END_IF --]
[-- IF ANALYTICS_MULTI_DOMAIN --]
<form action="[-- SHOPPING_CART_URL BASE --]/order.cgi" method="post" onSubmit="javascript:__utmLinkPost(this)">
[-- ELSE --]
<form action="[-- SHOPPING_CART_URL BASE --]/order.cgi" method="post">
[-- END_IF --]
<input type="hidden" name="storeid" value="[-- STORE_ID --]">
<input type="hidden" name="dbname" value="products">
<input type="hidden" name="function" value="add">
<input type="hidden" name="itemnum" value="[-- PRODUCT.RecordNumber --]">
[-- IF PRODUCT.DisplayOrderingOptions --]
[-- IF PRODUCT.OptionText --]
[-- PRODUCT.OptionText --]
[-- END_IF --]
[-- ORDER_OPTION_MENU LINE --]
[-- END_IF --]
[-- IF PRODUCT.DisplayOrderQuantity checked --]
Quantity <input type="text" size="2" name="[-- PRODUCT.RecordNumber --]:qnty" value="1" >
[-- END_IF --]
[-- IF VAR.AddButtonGraphic --]
<input type="image" class="add" src="[-- OUTPUT_DIRECTORY_URL --]/[-- VAR.Media --]/[-- VAR.AddButtonGraphic --]" name="Add to Cart" alt="Add to Cart">
[-- ELSE_IF ADDIMAGE? --]
<input type="image" [--ADDIMAGE--]>
[-- ELSE --]
<input class="add" type="submit" value="[-- ADDTEXT --]">
[-- END_IF --]
</form>
[-- ELSE --]
[-- PRODUCT.OrderCheckout --]
[-- END_IF --]
[-- END_DEFINE PRODUCT_CROSS_SELL --]
#############################
######################
[-- DEFINE PRODUCT --]
######################
### Set a bunch of variables ###
[-- VAR.TableLayout no --]
#[-- VAR.Form no --]
[-- VAR.Options no --]
[-- VAR.Quantity no --]
[-- VAR.Graphic no --]
### Start the form for Add to Cart button ###
[-- IF ANALYTICS_MULTI_DOMAIN --]
<form action="[-- SHOPPING_CART_URL BASE --]/order.cgi" method="post" onSubmit="javascript:__utmLinkPost(this)">
[-- ELSE --]
<form action="[-- SHOPPING_CART_URL BASE --]/order.cgi" method="post">
[-- END_IF --]
<input type="hidden" name="storeid" value="[-- STORE_ID --]">
<input type="hidden" name="dbname" value="products">
<input type="hidden" name="function" value="add">
####################
# PRODUCT PRICE #
####################
#PRODUCT GRAPHIC
[-- INCLUDE Product-Graphic PROCESS --]
[-- PRODUCT.Graphic --]
[-- IF PRODUCT.DisplayName --]<div class="name">[-- PRODUCT.Name --]</div>[-- END_IF --]
<span></span>
[-- IF PRODUCT.ProductDescription --]<div class="descr">[-- PRODUCT.ProductDescription --]</div>[-- END_IF --]
#sub
[-- IF PRODUCT.Subproduct --]
[-- VAR.TableLayout no --]
[--LOOP SUBPRODUCTS 1 --]
[--SUBPRODUCTS--]
[--END_LOOP SUBPRODUCTS--]
[-- ELSE --]
[-- IF PRODUCT.DisplayPrice --]
[-- IF PRODUCT.SaleAmount --]
<div class="price"><strike>[-- PRODUCT.Price --]</strike> <b>[-- PRODUCT.SaleAmount --]</b></div>
[-- ELSE --]
<div class="price">[-- PRODUCT.Price --]</div>
[-- END_IF --]
[-- END_IF --]
[-- END_IF --]
[-- IF PRODUCT.QuantityPricing --]
#do nothing
[-- ELSE --]
[-- END_IF --]
<input type="hidden" name="itemnum" value="[-- PRODUCT.RecordNumber --]">
<span></span>
[-- IF PRODUCT.QuantityPricing --]
<div class="QPtable">
[-- PRODUCT.QuantityPricing --]
</div>
[-- END_IF --]
<div class="buttongroup">
[-- IF VAR.AddButtonGraphic --]
<input type="image" class="add" src="[-- OUTPUT_DIRECTORY_URL --]/[-- VAR.Media --]/[-- VAR.AddButtonGraphic --]" name="Add to Cart" alt="Add to Cart">
[-- ELSE_IF ADDIMAGE? --]
<input type="image" [--ADDIMAGE--]>
[-- ELSE --]
<input class="add" type="submit" value="[-- ADDTEXT --]">
[-- END_IF --]
<div></div>
</div>
</form>
[-- END_DEFINE PRODUCT --]
#############################
[-- DEFINE MORE_INFO_PAGE --]
<!DOCTYPE html>
<html>
<!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class=""> <!--<![endif]-->
[-- IF PAGE.Title --]
<title>[-- PAGE.Title --]</title>
[-- ELSE --]
<title>[-- PAGE.Name --]</title>
[-- END_IF --]
[-- IF PAGE.MetaKeywords --]
<meta name="keywords" content="[-- PAGE.MetaKeywords --]">
[-- END_IF --]
[-- IF PAGE.MetaDescription --]
<meta name="description" content="[-- PAGE.MetaDescription --]">
[-- END_IF --]
<link rel="stylesheet" type="text/css" href="[-- OUTPUT_DIRECTORY_URL --]/media/ss-bead.css" />
<link rel="stylesheet" type="text/css" href="[-- OUTPUT_DIRECTORY_URL --]/media/reset.css" />
<script type="text/javascript" src="[-- OUTPUT_DIRECTORY_URL --]/media/modernizr.custom.42216.js"></script>
</head>
<body class="-">
<div id="container">
#############################
[-- VAR.MoreInfo "yes" --]
[-- IF VAR.MoreInfoTemplate --]
[-- INCLUDE VAR.MoreInfoTemplate PROCESS --]
[-- ELSE --]
[-- INCLUDE Classic-MoreInfoPage PROCESS --]
[-- END_IF --]
[-- VAR.MoreInfo "" --]
</div>
[-- INCLUDE general-footer PROCESS --]
</body>
</html>
[-- END_DEFINE MORE_INFO_PAGE --]