function check_add_cart() { //function ensures a valid quantity value is entered before submitting// var TempQuantity=form_return_value('TrolleyAdd','quantity'); if ((form_get_value('TrolleyAdd','quantity')==false) || (form_check_numerical('TrolleyAdd','quantity')>0) || (parseInt(TempQuantity)<1)) { alert("Please enter a valid quantity in the field provided."); set_focus('TrolleyAdd','quantity'); } else { update_total_cost(); document.TrolleyAdd.submit(); } } function check_add_cart_update(id_num) { //checking updating of existing quantity of product in trolley// var TempQuantity=form_return_value('TrolleyView','quantity_'+id_num); if ((form_get_value('TrolleyView','quantity_'+id_num)==false) || (form_check_numerical('TrolleyView','quantity_'+id_num)>0) || (parseInt(TempQuantity)<1)) { alert("Please enter a valid quantity."); set_focus('TrolleyView','quantity_'+id_num); } else { document.TrolleyViewUpdate.ProductTrolleyId.value=id_num; document.TrolleyViewUpdate.ProductQuantity.value=form_return_value('TrolleyView','quantity_'+id_num); document.TrolleyViewUpdate.ProductNotes.value=form_return_value('TrolleyView','notes_'+id_num); document.TrolleyViewUpdate.submit(); } } function remove_cart_item(trolley_id_num,current_page,current_action,current_id) { //call remove from shopping trolley// self.location=current_page+"?pxa="+current_action+"&id="+current_id+"&pxc=remove_item&pxb="+trolley_id_num; } function add_cart_quick_link(id_num) { document.AddTrolley.QuickProductId.value=id_num; document.AddTrolley.submit(); } function update_total_cost() { //ensure entered quantity is valid// if ((form_get_value('TrolleyAdd','quantity')==true) && (form_check_numerical('TrolleyAdd','quantity')==0)) { var ProductQuantity=form_return_value('TrolleyAdd','quantity'); if (PricingExist) { if (id_array_multiple_exists) { //More than one purchase option exists for current product// //get price entry based on selected option// var SelectedOption=document.TrolleyAdd.size_select.selectedIndex; //alert("SelectedOption: "+SelectedOption); //get cost from pricing array - remove ' from value// var SelectedOptionPrice=string_remove_quotes(price_array[SelectedOption]); //alert("SelectedOptionPrice: "+SelectedOptionPrice); } else { //Single pricing option exists// var SelectedOptionPrice=string_remove_quotes(price_array[0]); //alert("SelectedOptionPrice: "+SelectedOptionPrice); } //calculate total for quantity// var PriceTotal=SelectedOptionPrice*ProductQuantity; //update form field display// document.TrolleyAdd.price_total.value=PriceTotal; } } }