empirator Posted April 20, 2011 Share Posted April 20, 2011 Hello all!I'trying to save the user selected attributes of the product on the product page. The problem is, that after attachment of the image on the product page and saving of the cusomization, the page reloads and the combination of the attributes sets default again.I tryed to solve the problem using cookies, the atrributes after reloading of the page restores fine. But after pushing the ADD TO CART button the product adds to the cart with default attributes.You can see the problem here.The code I used:header.tpl in <head> section: {literal} [removed] <!-- function saveFormSession(form) { if(!form||!form.id||!/^[^;=]+$/.test(form.id)) return; var data="", tok, el, safe_name; for(var i=0; i<form.elements.length; i++) { if((el=form.elements[i]).name==""||el.getAttribute("skip_form_save")!=null) continue; safe_name=el.name.replace(/([)\\])/g, "\\$1"); switch(el.type) { case "text": case "textarea": tok="v("+safe_name+"):"+el.value.replace(/([|\\])/g, "\\$1")+"||"; break; case "radio": case "checkbox": tok="s("+safe_name+"):"+(el.checked? "1": "0")+"||"; break; case "select-one": tok="i("+safe_name+"):"+(el.selectedIndex)+"||"; break; default: tok=""; } data+=tok; } if(data>=4000) return alert("Can't save form into cookie, to much data..."); [removed]="ses"+form.id+"="+escape(data); return true; } function restoreFormSession(form) { if(!form||!form.id||!/^[^;=]+$/.test(form.id)) return false; var strt, end, data, nm, dat; if((strt=[removed].indexOf("ses"+form.id))<0) return false; if((end=[removed].indexOf(";", strt + form.id.length + 3))<0) end=[removed].length; data=unescape([removed].substring(strt + form.id.length + 4, end)).split("||"); for(var i=0; inm=/^[vsi]\(((?:[^)\\]|(?:\\\))|(?:\\\\))+)\)\:/.exec(data[i]); nm[1]=nm[1].replace(/\\([)\\])/g, "$1"); dat=data[i].substr(nm[0].length).replace(/\\([|\\])/g, "$1"); switch(data[i].charAt(0)) { case "v": form.elements[nm[1]].value=dat; break; case "s": form.elements[nm[1]].checked=(dat=="1"? true: false); break; case "i": form.elements[nm[1]].selectedIndex=dat; break; } } return true; } //--> [removed] {/literal} product.tpl in add_to_cart_form <input type="submit"> <input type="button"> Can someone help me to solve the problem?Thanks! Link to comment Share on other sites More sharing options...
Bz786 Posted July 27, 2011 Share Posted July 27, 2011 Hello. My name is joy. i saw your profile today at (prestashop.com)and became intrested in you,i will also like to know you the more,and i want you to send an email to my email address so i can give you my picture for you to know whom i am. Here is my email address ([email protected]) I believe we can move from here! I am waiting for your mail to my email address above. Remeber the distance or colour does not matter but love matters alot in life ([email protected]) Thanks joy noone else read this and say what the hell? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now