Ecommerce software home
Shopping Cart Software Forum for Ecommerce Templates
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?



Find us on Facebook

Follow us on Twitter

View our YouTube channel


 All Forums
 Technical
 Advanced Tips and Tricks - NO QUESTIONS PLEASE
 Clear cart address fields (for your sales staff)
 New Topic  Reply to Topic
 Printer Friendly
Author  Topic   

dbdave
ECT Moderator

USA
8590 Posts

Posted - 02/08/2020 :  13:09:23  
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



dbdave
ECT Moderator

USA
8590 Posts

Posted - 02/08/2020 :  13:21:45  
The nice thing about the way this works, is if you are entering a phone order, and you clear the fields, enter customer details and move to checkout, then have to go back, the newly entered details are still there and you don't have to ask your customer for their info again.
Basically it maintains the functionality of the new feature, but having the button to clear the fields ensures you don't (accidentally) use the last customers phone number on your new order for example.

David

midvalleydrifter001
Ecommerce Template Expert

USA
595 Posts

Posted - 02/08/2020 :  16:35:08  
David you are AWESOME !!

This works perfect.

Thanks so much for taking the time to do this.

Much appreciated.

Patrick

Phil
ECT Moderator

United Kingdom
7057 Posts

Posted - 02/09/2020 :  02:37:11  
Hi Dave,
Good stuff, why not set the condition to a login level (10) or whatever, so a router reboot with a possible change of IP address will not effect it?



* Database Migrations and Conversions*
* ASP to PHP Cart Conversions*

*Contact Us*
*Buy The PHP Capture Card Plugin*
*Rate Our Services/View Our Feedback*

dbdave
ECT Moderator

USA
8590 Posts

Posted - 02/09/2020 :  09:11:20  
Hi Phil, thanks..
Initially I told Charles to setup several internal client accounts for the sales staff to use.
I had it where you could put a secret phrase in the client name so the button will show. (I like your idea though).

However, (in the middle of the night, while I'm sleeping (and wake up and think LOL)) I thought to myself, that wont work too well.
Client accounts have a fixed email address that cannot be changed during order entry.
When they take the phone order, the email would not go out to the client.
Of course they could hop in the admin and edit the order, then resent, but that's a lot of extra work.

You are right though.
Folks who are using this should know that if you do a hard reset of your modem, that will likely get you a new IP address.
If this seems to get popular use, I'm sure we can come up with a way to trigger the button other than with the IP address.

One thing a store sales staff could do is create client accounts for all of these phone order customers. Use a random password, then when they call, ask if they have placed an order before, and if so, they look up the client in the admin, and use the login button to hop on the site. No address entry required at all on repeat orders.
This ties the customers orders together, and if the client want to order at the website, they can just use the forgot password feature.

David

Phil
ECT Moderator

United Kingdom
7057 Posts

Posted - 02/09/2020 :  10:32:09  
quote:
Client accounts have a fixed email address that cannot be changed during order entry.


Very good point, that's just blown away what I thought would have been an improvement.



* Database Migrations and Conversions*
* ASP to PHP Cart Conversions*

*Contact Us*
*Buy The PHP Capture Card Plugin*
*Rate Our Services/View Our Feedback*
   Topic   
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Shopping Cart Software Forum for Ecommerce Templates © 2002-2019 ecommercetemplates.com
This page was generated in 0.03 seconds. Snitz Forums 2000