Is it possible to add a button on a product so that people can email that page link to a friend.
Announcement
Collapse
No announcement yet.
Email pages
Collapse
X
-
Here's a rough and ready one-liner:-
Tell a Friend E-mail button on web-pages.
Enter this (very long line) in the product description if you just want to do this on the odd product
Code:!!<Enter e-mail address to tell a friend <input type=text value="" size=40 onchange="var thisloc=location.href;if(this.value != ''){location.href='mailto:' + this.value +'?subject=Take a look at '+thisloc+'&body=I saw '+thisloc+' and thought you would be interested.'}"><input type=button value="OK">>!!
Code:<Enter e-mail address to tell a friend <input type=text value="" size=40 onchange="var thisloc=location.href;if(this.value != ''){location.href='mailto:' + this.value +'?subject=Take a look at '+thisloc+'&body=I saw '+thisloc+' and thought you would be interested.'}"><input type=button value="OK">
Note that the button is really a dummy. The mailto is executed as soon as the input field changes. It just gives the user something to click on. Note that not all browsers support the subject= and body= parameters but you can probably live with this. Don't put any punctuation in the helpful text bits as they might interfere with the mailto URL.
NormanNorman - www.drillpine.biz
Edinburgh, U K / Bitez, Turkey
-
Try this:-
Code:!!<Enter e-mail address to tell a friend <input type=text value="" size=40 onchange="var thisloc=location.hostname;if(this.value != ''){location.href='mailto:' + this.value +'?subject=Take a look at '+thisloc+'&body=I saw http://'+thisloc+' and thought you would be interested.'}"><input type=button value="OK">>!!
Norman - www.drillpine.biz
Edinburgh, U K / Bitez, Turkey
Comment
-
Hi Norman,
Great little code, I've used it succesfully in a paticular product by entering the code in the product description. It works fine without problems.
I have been trying to get the second variation (without the !!< >!!) to work by putting the code in Act_ProductBody.html and a few other places but it just puts the ok button without the email field box.
Any ideas?
(using v6.12 with pretty standard templates)
Any help appreciated
Simon
Comment
-
OK. If you're in a product template then you're inside <form...> and </form> tags and that's where <input..> statements are valid. I kindof forgot to mention that as you're nearly always within a form in Actinic.
If you're outside of a form (like at the top of Act_Primary) then try adding <form> just at the beginning and </form> at the end of the example I gave.
You can't nest <form..> statements so make sure you won't be breaking Actinic by doing that accidentally.
NormanNorman - www.drillpine.biz
Edinburgh, U K / Bitez, Turkey
Comment
-
AmI being silly here?
I cannot get the code Norman gave to work ( have tried the <FORM> </FORM> option)
All I want is a button at the bottom of each individual product that enables people to send that product via email to someone else.
I've added my Act_ProductBody code to so you can see where I have messed up...
Attached Files
Comment
-
Hi Norman,
Is there any way of making this script either product specific (so it calls the product name and includes it in the email) ...
...or at the least, automatically providing an anchor to the product that the viewer has filled in the text field on?
Cheers
JosThanks
Jos Medinger
Tel : 01978 843 962
www.internetology.co.uk
Actinic / E-Commerce Hosting, Design & SEO
______________________________________
Comment
-
I see your error
Code:<FORM><Enter e-mail address to tell a friend <input type=text value="" size=40 onchange="var thisloc=location.href;if(this.value != ''){location.href='mailto:' + this.value +'?subject=Take a look at '+thisloc+'&body=I saw '+thisloc+' and thought you would be interested.'}"><input type=button value="OK"></FORM>
However read on. This could be a bad place for that code as you'll already be inside a form in Quantity on Product page with Single Add to Cart and outside said form without the Single Add.
You may have to move this code to Act_Primary.html to be sure you're in a safe place. After the NETQUOTEVAR:FORMEND should be a safe place.
NormanNorman - www.drillpine.biz
Edinburgh, U K / Bitez, Turkey
Comment
-
Jos,
Use on a Product page template and stick in NETQUOTEVAR:PRODUCTNAME where you want the name to appear. Yes you can probably link straight to the products anchor but I've not time to test that now. I guess you'd change
"I saw '+thisloc+' and"
to be
"I saw '+thisloc+'#aNETQUOTEVAR:PRODUCTREFERENCE and"
Try it and see.
NormanNorman - www.drillpine.biz
Edinburgh, U K / Bitez, Turkey
Comment
-
Wonderful,
Thanks Norman
I'll give it a whirl
Cheers
JosThanks
Jos Medinger
Tel : 01978 843 962
www.internetology.co.uk
Actinic / E-Commerce Hosting, Design & SEO
______________________________________
Comment
-
The version above without any NETQUOTEVAR's will work anywhere. The ones with NETQUOTEVAR's will only work inside Product Templates.
I also looked at getting the product name to be included on the e-mail but since quotes are legal within such names some products would break the JavaScript.
NormanNorman - www.drillpine.biz
Edinburgh, U K / Bitez, Turkey
Comment
-
I'm having a play with this. but like TiggyPig I just want a buttom to generate the email.
How do i use the variable +thisloc+ with a button?
The code below is in Act_ProductLine.html It converts the product variable in the body, but I cant see how to get the url into there too.
<a NAME="sectionbottom" var thisloc=location.href;if(this.value != '' href="mailto:?subject=Take a look at +location.href+ &bcc=recommend@giftsonline.ltd.uk&body=I saw this NETQUOTEVAR:PRODUCTNAME at '+thisloc+' and thought you would be interested.">
<img src="email-friend.gif" width="69" height="15" border="0"></a>
Comment
Comment