RememberMe 0.3.1

Rickard

No avatar

2005-09-08 00:56

This is my low budget version of a user area. It is simply some javascript which saves the customer's address from the delivery form in a cookie. The address is then already filled in next time the customer wants to order.

It is generic in the sence that it saves all input-text fields of the form. So adding new text fields in the address form should be automatically picked up and saved.

---

BACKUP the file and then edit the file: templates/default/orders_delivery.tpl

// Add following functions from row 2 - ff
<script type='text/javascript'><!--
function initForm(form,cookieID){
var cookieList=getCookieList(cookieID);
for(var i=0;i<form.elements.length;i++){
if(form.elements[i].type=='text'){
if(cookieList[form.elements[i].name]){
form.elements[i].value=cookieList[form.elements[i].name]+'';
}
}
}
}
function saveForm(form,cookieID){
var cookie='';
for(var i=0;i<form.elements.length;i++){
if(form.elements[i].type=='text'){
cookie+=form.elements[i].name+'='+form.elements[i].value+'&';
}
}
setCookie(cookieID,cookie,999);
}
function getCookieList(name){
var cookieList=new Array();
var cookie=getCookie(name);
if(cookie!=null){
var items=cookie.split("&");
for(var i=0;i<items.length;i++){
var pair=items[i].split("=");
if(pair.length==2){
cookieList[pair[0]]=pair[1];
}
}
}
return cookieList;
}
function getCookie(name){
var cname=name+"=";
var dc=document.cookie;
if(dc.length>0){
var begin=dc.indexOf(cname);
if(begin!=-1){
begin+=cname.length;
var end=dc.indexOf(";",begin);
if(end==-1){
end=dc.length;
}
return unescape(dc.substring(begin,end));
}
}
return null;
}
function setCookie(name,value,expiredays){
var today = new Date();
var expire = new Date();
if (expiredays==null) {
expiredays=0;
}
expire.setTime(today.getTime() + 3600000*24*expiredays);
document.cookie = name+"="+escape(value) + ";expires="+expire.toGMTString();
}
//--></script>




// Replace old <form> tag on row 68 with this new one
<form action='?p=$p' method='post' enctype='multipart/form-data' onsubmit='saveForm(document.form,"QC_Address");return checkForm( this,



// Add following rows on row 259 after the </form> tag
<script type='text/javascript'><!--
initForm(document.form,"QC_Address");
// --></script>

floyds

No avatar

2005-09-08 14:58

can you make a zip file of this plugin with a install doc, so a can place in on my support site !?

Dutch QuickCart Support Site

Gizmo

No avatar

2005-09-08 23:48

Works like a charm! very nice!
Also if you use the taxAndDiscount.tpl instead of orders_delivery.tpl

Good work!

treewood (OpenSolution)

Avatar: treewood

2005-09-09 16:26

Rickard - very very nice ... can You create plugin that i will put it in download page?

witaj.net

Rickard

No avatar

2005-09-09 18:13

Thanks! OK I will try to create one, but don't expect it to happen right away. I'm new to Quick Cart and in particular with the plugin concept.

Does anyone know if there exists some good description of the plugin function in QC?

Rickard

No avatar

2005-09-09 18:15

... and does the plugin function apply to .js files as well?

alectro

No avatar

2005-10-27 12:36

works really fine
thanks

alejandro

ikst

No avatar

2007-05-06 11:57

Hi,

sorry to dig out this old thread, but this looks like a useful plugin. I just can't seem to make it work in version 2.1

Any tips on how to make it work ?

Thanks.

merci

No avatar

2007-05-07 09:26

ikst - you don't need this plugin in version 2.x and 1.4. You can do the same without plugin:
open file templates/messages.tpl and comment line with this function: delSavedUserData( );
It should works as you want.

ikst

No avatar

2007-05-07 12:36

Thanks. It works :)

ned

Avatar: ned

2007-05-07 13:06

In my 2.1 its commented out in /templates/orders_summary.tpl (i.e doesn't delete user data).

qwerty@de.hu

No avatar

2007-05-08 13:32

How can i implement this in qc 1.4?

merci

No avatar

2007-05-09 10:22

qwerty@de.hu - you don't have to implement this, as it is available in v 1.4. It should works in your Q.C. If you want remember data between orders you should comment in templates/messages.tpl line with function delSavedUserData( );

qwerty@de.hu

No avatar

2007-05-10 11:09

what should i do..? something like this - function delSavedUserData( yes);...?

merci

No avatar

2007-05-10 12:44

Open file templates/messages.tpl and change this line:

delSavedUserData( );

to this:

//delSavedUserData( );

Now your don't need to enter your data again between orders.

qwerty@de.hu

No avatar

2007-05-10 18:01

OK..i have change it m and it looks like this:
"
<script type="text/javascript" src="$config[dir_js]orders.js"></script>
<script type='text/javascript'>
<!--
window.onload = function(){
// delSavedUserData( );
}
//-->
</script>
<!-- END ORDER_SAVED --> "

...but it's still don't working.. the order form is blank when i try to order another products...

merci

No avatar

2007-05-11 10:27

qwerty@de.hu - I have tested it and it works properly, so maybe you have installed same plugins?

qwerty@de.hu

No avatar

2007-05-11 12:49

ok, thank you merci...i will try it again...

knacknuss

No avatar

2007-05-14 21:58

For all who still habe problems with a blank page heres the solution:

// Replace old <form> tag on row 68 with this new one
<form action='?p=$p' method='post' enctype='multipart/form-data' onsubmit='saveForm(document.form,"QC_Address");return checkForm( this,

Replace the ' from onsubmit='saveForm(document.form,"QC_Address");return checkForm( this,
with a " so it looks like this: onsubmit="saveForm(document.form,"QC_Address");return checkForm( this,

Back to top
about us | contact