In versions 7.1.7+ we saw the introduction of of a new feature that keeps your customers address fields filled in, should they backup in checkout at some point.
This is a nice feature for customers, but for store operators who enter orders at the website on behalf of customers, this can be a problem.
I created an updater proof solution that will use your IP address to show a form reset button for you only.
You will need to find your (web) IP address.
Most ISP's these days do not change your IP address often. Technically to have it "fixed" you need to buy a static IP from them, but again, many do not change this (often) these days. If you don't know your IP address, check your admin for an order you have entered yourself, and the IP will be there, but you can also just ask google "what is my ip address".
The code below (both .asp and .php versions are provided) will be inserted in your cart.asp/.php page using your html editor, then uploaded to the server.
:::SHOW THE BUTTON FOR YOUR SALES STAFF ONLY - BASED ON YOUR IP ADDRESS::::::.ASP VERSION:::We add the (reset) button just before the cart include line (shown in red), then some code immediately after the cart include line in the cart.asp page.
Use your html editor to insert the code shown below, fill in your IP address, then upload to the server.
<input id="clrbutn" class="ectbutton" style="display:none;font-size:14px;font-weight:bold;" type="button" value="Reset Form" onClick="clrfrmm()" />
<!--#include file="vsadmin/inc/inccart.asp"-->
<%
dim ouripaddr
ouripaddr = "00.000.000.000" 'change this to your IP address
if Request.ServerVariables("REMOTE_ADDR") = ouripaddr then
%>
<script>
function clrfrmm() {
document.getElementsByName("mainform")[0].reset();
var frm_els = document.getElementsByName("mainform")[0]
var frm_elements = frm_els.elements;
for(i=0; i<frm_elements.length; i++)
{
field_type = frm_elements[i].type.toLowerCase();
switch (field_type)
{
case "text":
case "tel":
case "email":
frm_elements[i].value = "";
break;
}}}
if (document.getElementsByClassName('cart2details')[0]) {document.getElementById("clrbutn").style.display = "";}
</script>
<% end if %>
:::.PHP VERSION:::We add the (reset) button just before the cart include line (shown in red), then some code immediately after the cart include line in the cart.asp page.
Use your html editor to insert the code shown below, fill in your IP address, then upload to the server.
<input id="clrbutn" class="ectbutton" style="display:none;font-size:14px;font-weight:bold;" type="button" value="Reset Form" onClick="clrfrmm()" />
<?php include "vsadmin/inc/inccart.php" ?>
<?php
$ouripaddr = "00.000.000.000" ; //change this to your IP address
if ($_SERVER['REMOTE_ADDR'] == $ouripaddr):
?>
<script>
function clrfrmm() {
document.getElementsByName("mainform")[0].reset();
var frm_els = document.getElementsByName("mainform")[0]
var frm_elements = frm_els.elements;
for(i=0; i<frm_elements.length; i++)
{
field_type = frm_elements[i].type.toLowerCase();
switch (field_type)
{
case "text":
case "tel":
case "email":
frm_elements[i].value = "";
break;
}}}
if (document.getElementsByClassName('cart2details')[0]) {document.getElementById("clrbutn").style.display = "";}
</script>
<?php endif ?>
I hope this helps some of my fellow ect users.
Thanks,
David