|
#1
|
|||
|
|||
|
Has anyone setup anything like this?
http://www.kelcomaine.com/viewcart.cfm |
|
#2
|
||||
|
||||
|
Interesting, have you checked with Support to see if it is even possible?
|
|
#3
|
|||
|
|||
|
No, everyone here is so knowledgeable I figured I would check here first
![]() |
|
#4
|
|||
|
|||
|
Here was the response
Unfortunately, there is not built in function for this, but you may be able to custom code a javascript to perfront his function. However, we do not provide support for custom coding so this would have to be done on your own. |
|
#5
|
||||
|
||||
|
It is very easy to do. I'm assuming the "Item" is the product code, that could just send to /ShoppingCart.asp with a query string variables "ProductCode" and "Qty.[ProductCode]". This is kind of loose.
Here is an example: <form name="addToCart" > Item: <input type="text" name="ProductCode" id="productCode"/> Qty: <input type="text" name="Qty" value="1" id="qty"/> <input type="button" value="Add To Cart" onclick="javascript: window.location.href = '/ShoppingCart.asp?ProductCode=' + document.getElementById('productCode').value + '&Qty.' + document.getElementById('productCode').value + '=' + document.getElementById('qty').value; return true;"/> </form> I setup an example at http://dev1.brandlabs.us/Articles.asp?ID=141 |
|
#6
|
|||
|
|||
|
We have done a similar thing with multiple lines. There's a little extra javascript thrown in for error handling, etc. The page looks like this.
The code (entered as the 'category description' of a new category page) is as follows. Feel free to edit & use with your own site: Part 1: (separated into 2 sections due to restrictions on max # of characters per forum post.) Code:
<script language="JavaScript" type="text/JavaScript">
<!--
var finalURL=''; //global variable for the URL that is sent to the cart
var order='';
var URL='';
//this function is called when the add to cart button is clicked via a javascript call.
//purpose is basic grep of data from my form fields that are named qty
function qtyValidate() {
var validate='ok';
finalURL=''; //reset global variables for proper function of 'back' button from shopping cart page.
order ='';
URL='';
var x=0; //for loop variable
for (x=0; x<=9; x++) { //the count value is adjusted depending on how many elements I want to add to the URL
var testqty=document.QuickAdd.qty[x].value;
var testsku=document.QuickAdd.sku[x].value;
if (isNaN(testqty) == true && isNaN(testsku) == false) { //test & correct data if customer reversed sku & qty fields - assumes all skus must be non-integer
testqty=document.QuickAdd.sku[x].value;
testsku=document.QuickAdd.qty[x].value;
}
if (testqty!=0) { //if the user has entered a value, call buildURL function and pass in the number and qty
if (isNaN(testqty) == false && isNaN(testsku) == true) {
buildURL(x, testqty, testsku);
}
else {
validate='fail'; //return error message if both columns contain quantities or both contain product codes
return alert('Error: Please enter only quantities in the first column and only product codes in the second column.');
}
}
}
//send the built URL back to the doc, and on to the cart.
if (validate=='ok'){
finalURL=URL+order;
document.location.href = finalURL;
}
}
// function that constructs URL based on each element that has a user supplied value, and the qty they entered.
function buildURL (x, qty, code) {
var builtURL='';
var currentSKU='';
//static elements of URL per Volusion
URL='/ShoppingCart.asp?';
var productcode='productcode=';
//assign the code variable the value of the array element that has been passed in with the x var
//build the current sku
currentSKU=productcode+code+'&'+'QTY.'+code+'='+qty+'&'; //currentSKU is the sku being processed with this call.
//concat additional values to the URL as they are identified and processed by the two functions, including
//assigning it to the global finalURL var to maintain state
order=order+currentSKU;
}
//-->
</script>
|
|
#7
|
|||
|
|||
|
Part 2:
Code:
<h1 style="text-align: center;">Quick-Add Order Form</h1>
<table align="center" border="0" width="416"><tbody><tr><td width="410">If you know the product codes you may enter the items and desired quantities directly in this form.<br><br><a style="font-weight: bold;" href="javascript: void window.open('/price_list.html', '_codes', 'resizable=yes,scrollbars=yes,height=470,width=330', false);"> Click here</a> to view our full price list with a list of product codes (page will open in a new window). </td>
</tr></tbody></table><p> </p><form method="post" name="QuickAdd" id="QuickAdd" action="../SearchResults.asp"><table style="border: medium none ; width: 275px;" align="center" border="0" bordercolor="#000000" cellpadding="0" cellspacing="0" width=""><tbody><tr><th style="border: medium none ;" bgcolor="#003358"><div align="left"><img src="/Config_ImagesFolder/cart/cart_tl_cap.gif" alt=" " align="absmiddle"></div></th><th style="border: medium none ;" align="right" bgcolor="#003358"><div align="right"><img src="/Config_ImagesFolder/cart/cart_tr_cap.gif" alt=" " align="middle"></div></th></tr><tr><th style="border: medium none ; text-align: left;" bgcolor="#003358" width="50%"><img src="/Config_ImagesFolder/cart/cart_tl.gif" alt=" " align="absmiddle" border="0"><span class="bgcolor1"> <span class="colors_background1_text">Quantity:</span></span></th><th style="border: medium none ;" align="right" bgcolor="#003358" width="50%"><span class="bgcolor1"><span class="colors_background1_text">Product Code: </span> </span><img src="/Config_ImagesFolder/cart/cart_tr.gif" alt=" " align="absmiddle"></th></tr><tr><td colspan="2" style="border: 1px solid rgb(0, 0, 0); text-align: left; vertical-align: middle; letter-spacing: 0pt; word-spacing: 0pt;"><div align="center"><a href="javascript: document.QuickAdd.reset();"><img style="margin-top: 4px; margin-bottom: 4px;" alt=" " src="/Config_ImagesFolder/buttons/btn_clear_small.gif" align="" border="0"></a></div></td></tr><tr><td style="border-left: 1px solid rgb(0, 0, 0); text-align: left; vertical-align: middle; letter-spacing: 0pt; word-spacing: 0pt; padding-bottom: 2px; padding-top: 4px;"><div align="center"><input name="qty" size="8" type="text">
</div></td><td style="border-right: 1px solid rgb(0, 0, 0); text-align: left; vertical-align: middle; letter-spacing: 0pt; word-spacing: 0pt; padding-bottom: 2px; padding-top: 4px;" align="right"><span unselectable="on" style="position: absolute; clip: rect(0px, 23px, 25px, 0px);"><br></span><div align="center"><input name="sku" value="" size="8" type="text"></div></td></tr><tr><td style="border-left: 1px solid rgb(0, 0, 0); text-align: left; vertical-align: middle; letter-spacing: 0pt; word-spacing: 0pt; padding-bottom: 2px;"><div align="center">
<input name="qty" size="8" type="text">
</div></td><td style="border-right: 1px solid rgb(0, 0, 0); text-align: left; vertical-align: middle; letter-spacing: 0pt; word-spacing: 0pt; padding-bottom: 2px;" align="right"><div align="center"><input name="sku" value="" size="8" type="text"></div></td></tr><tr><td style="border-left: 1px solid rgb(0, 0, 0); text-align: left; vertical-align: middle; letter-spacing: 0pt; word-spacing: 0pt; padding-bottom: 2px;"><div align="center"><input name="qty" size="8" type="text">
</div></td><td style="border-right: 1px solid rgb(0, 0, 0); text-align: left; vertical-align: middle; letter-spacing: 0pt; word-spacing: 0pt; padding-bottom: 2px;" align="right"><div align="center"><input name="sku" value="" size="8" type="text"></div></td></tr><tr><td style="border-left: 1px solid rgb(0, 0, 0); text-align: left; vertical-align: middle; letter-spacing: 0pt; word-spacing: 0pt; padding-bottom: 2px;"><div align="center"><input name="qty" size="8" type="text">
</div></td><td style="border-right: 1px solid rgb(0, 0, 0); text-align: left; vertical-align: middle; letter-spacing: 0pt; word-spacing: 0pt; padding-bottom: 2px;" align="right"><div align="center"><input name="sku" value="" size="8" type="text"></div></td></tr><tr><td style="border-left: 1px solid rgb(0, 0, 0); text-align: left; vertical-align: middle; letter-spacing: 0pt; word-spacing: 0pt; padding-bottom: 2px;"><div align="center"><input name="qty" size="8" type="text">
</div></td><td style="border-right: 1px solid rgb(0, 0, 0); text-align: left; vertical-align: middle; letter-spacing: 0pt; word-spacing: 0pt; padding-bottom: 2px;" align="right"><div align="center"><input name="sku" value="" size="8" type="text"></div></td></tr><tr><td style="border-left: 1px solid rgb(0, 0, 0); text-align: left; vertical-align: middle; letter-spacing: 0pt; word-spacing: 0pt; padding-bottom: 2px;"><div align="center"><input name="qty" size="8" type="text">
</div></td><td style="border-right: 1px solid rgb(0, 0, 0); text-align: left; vertical-align: middle; letter-spacing: 0pt; word-spacing: 0pt; padding-bottom: 2px;" align="right"><div align="center"><input name="sku" value="" size="8" type="text"></div></td></tr><tr><td style="border-left: 1px solid rgb(0, 0, 0); text-align: left; vertical-align: middle; letter-spacing: 0pt; word-spacing: 0pt; padding-bottom: 2px;"><div align="center"><input name="qty" size="8" type="text">
</div></td><td style="border-right: 1px solid rgb(0, 0, 0); text-align: left; vertical-align: middle; letter-spacing: 0pt; word-spacing: 0pt; padding-bottom: 2px;" align="right"><div align="center"><input name="sku" value="" size="8" type="text"></div></td></tr><tr><td style="border-left: 1px solid rgb(0, 0, 0); text-align: left; vertical-align: middle; letter-spacing: 0pt; word-spacing: 0pt; padding-bottom: 2px;"><div align="center"><input name="qty" size="8" type="text">
</div></td><td style="border-right: 1px solid rgb(0, 0, 0); text-align: left; vertical-align: middle; letter-spacing: 0pt; word-spacing: 0pt; padding-bottom: 2px;" align="right"><div align="center"><input name="sku" value="" size="8" type="text"></div></td></tr>
<tr>
<td style="border-left: 1px solid rgb(0, 0, 0); text-align: left; vertical-align: middle; letter-spacing: 0pt; word-spacing: 0pt; padding-bottom: 4px;"><div align="center">
<input name="qty" size="8" type="text">
</div></td>
<td style="border-right: 1px solid rgb(0, 0, 0); text-align: left; vertical-align: middle; letter-spacing: 0pt; word-spacing: 0pt; padding-bottom: 4px;" align="right"><div align="center">
<input name="sku" value="" size="8" type="text">
</div></td>
</tr>
<tr><td style="border-left: 1px solid rgb(0, 0, 0); text-align: left; vertical-align: middle; letter-spacing: 0pt; word-spacing: 0pt; padding-bottom: 4px;"><div align="center"><input name="qty" size="8" type="text">
</div></td><td style="border-right: 1px solid rgb(0, 0, 0); text-align: left; vertical-align: middle; letter-spacing: 0pt; word-spacing: 0pt; padding-bottom: 4px;" align="right"><div align="center"><input name="sku" value="" size="8" type="text"></div></td></tr><tr><td colspan="2" style="border: 1px solid rgb(0, 0, 0); text-align: left; vertical-align: middle; letter-spacing: 0pt; word-spacing: 0pt;"><div align="center"><a href="javascript: qtyValidate();"><img style="margin-top: 4px; margin-bottom: 4px;" src="/Config_ImagesFolder/buttons/btn_addtocart.gif" alt=" " align="" border="0"></a></div></td></tr></tbody></table></form>
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|