PDA

View Full Version : email product id


pinbrook
06-Sep-2003, 01:08 PM
I've got this handy bit of code (I think it is one of Norman's)

i'd like to be able to send the product details in the email and not just the page.....can anyone amend the code for me?

------------------------------------------------<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">---------------

NormanRouxel
07-Sep-2003, 09:14 AM
Hmmmm... You could try replacing

&body=I saw '+thisloc+' and thought you would be interested.'

with

&body=I saw '+thisloc+' and thought you would be interested. NETQUOTEVAR:PRODUCTDESCRIPTION'

however I don't think it will work very well as there will be bits of HTML in there (special characters get Escaped, etc). Also this could lead to a very long argument being passed to the e-mail client (depending on the length of your product description) and that may mess things up too.

Try it and see.

One solution would be to use a function to process the NETQUOTEVAR:PRODUCTDESCRIPTION text and to remove all html and escaped code. Also it could truncate long descriptions to a manageable length.

Norman

NormanRouxel
07-Sep-2003, 09:37 AM
I just did a quick test of the idea above and it seemed to work OK using the standard Actinic Demo site. The only page with a problem was the Custom PC where there was embedded html (via !!< and >!!) in the product description. This introduced hard coded new lines which broke the JavaScript. If you don't use embedded HTML (or put it all on a single line) then you may be OK.

Remember I only did a quick test so you'll need to test more thouroughly.

Norman

p.s. If you replace

thisloc=location.href

with

thisloc=location.href + '#NETQUOTEVAR:PRODUCTANCHOR'

then it'll link you right to the actual product rather than the page top.

Pinnacle
07-Sep-2003, 10:15 AM
Hi Guys,

Can you please post the full script here as this is a wonderful idea? I'm a newbie and I'm not sure of the full script to make this work.

Many Thanks

Paul.

NormanRouxel
07-Sep-2003, 12:57 PM
That was it above. Just put this (rather long one-liner) in a suitable place in Act_ProductLine.html.

Enter e-mail address to tell a friend <input type=text value="" size=40 onchange="var thisloc=location.href + '#NETQUOTEVAR:PRODUCTANCHOR';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">

Norman

harlequin
08-Sep-2003, 06:06 AM
hi all, here is a neat trick to add to normans code, it means that you as a webmaster will get a copy of the email the surfer sends to their friend..

in normans code, where the snippet

&body=I saw '+thisloc+' and thought you would be interested.'

appears, you can change it to read

&body=I saw '+thisloc+' and thought you would be interested. &bcc=yourname@yourcompany.com'

obviously substitute yourname@yourcompany.com for your own email address and this will be inserted into the BCC (Blind Carbon Copy) field of the email...try it..

Steve Quinn
Harlequin Domains
www.harlequindomains.com
Actinic Design, Hosting and Marketing

pinbrook
08-Sep-2003, 10:45 AM
Thanks for that Steve

I was thinking it would be nice to know if the email idea was being used. I will add your snippet to the code

Jo

NormanRouxel
08-Sep-2003, 12:27 PM
I will add your snippet to the code

Add in all the bits above and that'll make it an extremely long one-liner :) Any more ideas to keep it growing?

Norman

Pinnacle
08-Sep-2003, 01:42 PM
How about?

&body=I saw '+thisloc+' and thought you would be interested. &bcc=yourname@yourcompany.com' &send me a nice cold beer'



What do you think?

Paul.

Pinnacle.

pinbrook
09-Sep-2003, 01:06 AM
Actually I have now decided not to use the bcc feature as its leaves the email address open to harvesters.

Since spam is going through the roof recently I have really tightened up on placing email addresses in HTML code. ie I don't do it!

harlequin
09-Sep-2003, 01:14 AM
i totally agree jo but it may still be worth it if you use a 'throwaway' email address for a little while just to see if people use it and have some strict filter rules in place in your email client...

cheers
steve..

pinbrook
09-Sep-2003, 01:15 AM
Yep good point!! It would be interesting to see how effective the email is.

NormanRouxel
09-Sep-2003, 09:20 AM
Since spam is going through the roof recently I have really tightened up on placing email addresses in HTML code. ie I don't do it!

This is generated by JavaScript so you could break up your e-mail address somewhat. E.g.

'&bc' + 'c=myname' + '@' + 'myserver' + '.mydomain'

may well fool them enough.

And / Or use a throwaway address to see if it actually happens.

What do you think?

Norman

Josie
21-Oct-2003, 12:00 PM
This is brilliant and very handy, thanks. I've been banging my head against the wall with form mail php trying to get an 'email to a friend' box on individual products.

I've used this code to generate an email template that includes product name and price (in our case the name is the book title, the description is usually quite long and title I think is enough). The two functions referenced strip the variables from all the coded stuff and I can send them to anyone who's interested, or you can view them in the popup page source (eg http://www.csbooks.co.uk/acatalog/info_M_02670.html). Or go to any other of the extended info pages (you can view source on a popup from the right-click menu).

We decided against bcc-ing because we don't really need to know and didn't want this to put off people who might be paranoid about email harvesting. Here is the code we've used:

<input type=text value="" size=30 onchange="var thisloc=location.href;var thisProduct=getProdName();var thisPrice=getProdPrice();if(this.value != ''){location.href='mailto:' + this.value +'?subject=Take a look at www.csbooks.co.uk &body=I saw *' + thisProduct + '* at Collectors Supplies online bookstore for only ' +thisPrice+ '! Here is the link: '+thisloc+' There are loads of other great titles at great prices!'
}"><input type=button value="OK">

I've changed a few of the original parts of this code, ie the subject line and a little marketing plug addition to the body.

If anyone wants to try testing this and can see any potential problems, please let us know.

Josie
www.csbooks.co.uk

BPJSURF
10-Nov-2003, 03:38 AM
I am trying to modify this code and would like a little help. I need to set up the email subject line to capture the product reference number and description. I want the email to automatically be sent to the merchant.

The merchant would like to be able to receive questions from the consumer and would like the email to capture the product information automatically so they know exactly which product the inquery is refering to.

<Enter e-mail address to tell a friend <input type=text value="" size=40 onchange="var thisloc=location.href + '#NETQUOTEVAR:PRODUCTANCHOR';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">


above is the orginal code.

any suggestions would be great.

NormanRouxel
10-Nov-2003, 11:07 AM
I need to set up the email subject line to capture the product reference number and description. I want the email to automatically be sent to the merchant.

I don't think this is the way to go in your case. This thread is about the customer voluntarily sending an e-mail to someone via his own E-mail program. I don't think that it would be suitable for what you need. Sure you could automate it so that your suppliers address and product reference is inserted but you'd still have to persuade the customer to send the e-mail.

Actinic has a built-in function that allows the customer confirmation e-mail to be automatically copied to another address. This may be closer to what you want.

Norman

BPJSURF
10-Nov-2003, 12:38 PM
Norman,

I guess I should explain. My merchant cleint sells used equipment. Often the buyer will have specific questions about a particular item in the catalog and how the item may be used or applied in an application. The ideal situation would be for the consumer to have the capability to quickly email a question to the merchant directly from the product. Infact if possiable populate the email with the Merchant email in the To: feild populate the subject line with the product reference number and short description and capture the email address of the sender.

This would make it very easy for the customer to ask the question and very easy for the merchant to reply on a specific item request.

I attempted to modify the script to insert the mailto: to the merchant email and copy the buyer email as the sender. I also attempted to use the netquotvar for the product ref. Unfortunatly my hack did not work well so I was looking for suggestions.

FYI, I am quite aware of the email copy feture. This feature only works when ordering and the goal of my email application is to receive email questions from prospective buyers about a specific product. there is a simalar feature when using Ebay.

thanks for your help either way norman as always you are a valable resource of knowledge.

thanks

pinbrook
10-Nov-2003, 12:54 PM
Brian

Take a look at http://www.spk-equip.co.uk/acatalog/SPK_Equipment_Used_Loader_Backhoes_1.html

this is used plant, is this closer to what you want "Click here to enquire about this product "

BPJSURF
10-Nov-2003, 12:59 PM
Yes,
This is exactly what I am hoping to acheive. Would you be kind enough to share the snipet of code you interjected there?

pinbrook
10-Nov-2003, 01:04 PM
there it is.......

<a href="mailto:x@abc.com?subject=NETQUOTEVAR:PRODUCTNAME NETQUOTEVAR:PRODUCTREF">Click
here to enquire about this product</a>

NormanRouxel
10-Nov-2003, 01:29 PM
Assuming you have more than one supplier you can automate this a bit more by creating a CUSTOMVAR called (say) SUPPLIEREMAIL and setting it to the address of the supplier in the Product Details. Thus the code would be:-

<a href="mailto:CUSTOMVAR:SUPPLIEREMAIL?subject=NETQUOTEVAR:PRODUCTNAME NETQUOTEVAR:PRODUCTREF">Click
here to enquire about this product</a>

Also if most products have the same supplier you can set SUPPLIEREMAIL in Catalog / Options and it will appear on every page. If a few products have different suppliers then you can override the global value by setting it on the Product Details.

Finally. You could also have the snippet of code above generated by JavaScript so that it would only appear on products with CUSTOMVAR:SUPPLIEREMAIL defined.


<script language=JavaScript>
if ( CUSTOMVAR:SUPPLIEREMAIL )
{
document.write('<a href="mailto:CUSTOMVAR:SUPPLIEREMAIL? subject=NETQUOTEVAR:PRODUCTNAME NETQUOTEVAR:PRODUCTREF">');
document.write('Click here to enquire about this product</a>');
}
</script>


Norman

Aby
14-Nov-2003, 05:59 PM
Hi, I know this is a old thread but can somebody tell me how to use the email ID script with a image instead of having box to enter the email address. I have trying to change the script now for a few hours but with no luck. I want to replace the box with an email a friend gif which when a customer clicks on the image it carries out the same function as norman's script.

Thanks.

NormanRouxel
14-Nov-2003, 06:35 PM
You'll still need somewhere to enter the friends e-mail address so why lose the box?

if you useEnter e-mail address to tell a friend <input type=text value="" size=40 onchange="var thisloc=location.href + '#NETQUOTEVAR:PRODUCTANCHOR';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">

Just replace the

<input type=button value="OK">

with <input type=image src="myimage.gif">

This image and the button don't actually do anything (filling in the e-mail field aactually does the work) but it just gives the user something to click on.


Norman

Aby
14-Nov-2003, 07:38 PM
Hi thanks for the reply! I've seen the example at http://www.tiggypig.com/acatalog/THETUBE.html The bottom right hand corner has the image. You have to then enter the email address in the outlook express. How do you this?

Thank you for your help.

NormanRouxel
14-Nov-2003, 08:16 PM
You could try this - it should do what you want:

<img src="myimage.jpg" onclick="var thisloc=location.href + '#NETQUOTEVAR:PRODUCTANCHOR';location.href='mailto:' + '?subject=Take a look at '+thisloc+'&body=I saw '+thisloc+' and thought you would be interested.'">

I've not tested this but perhaps you get the isea,

Aby
14-Nov-2003, 08:25 PM
Norman, your a genius!

It worked, thanks for your help.

harlequin
14-Nov-2003, 08:41 PM
and the code is below, one thing though Norman, this one captures all the <BR> and <P> tags etc from the product description, can you make that not happen please....if its possible..im being lazy i know...

<A HREF="mailto:?Subject=I%20saw%20this%20NETQUOTEVAR:PRODUCTNAME%20at%20YOURCOMPANYNAME%20and%20thought%20of%20you!&bcc=YOURBCCADDRESS&Body=I%20saw%20this%20NETQUOTEVAR:PRODUCTNAME%20at%20YOURCOMPANYNAME%20and%20thought%20of%20you!NETQUOTEVAR:PRODUCTDESCRIPTION%20CUSTOMVAR:CGIBINURLss000001.pl?PRODREF=NETQUOTEVAR:PRODUCTREF"><IMG SRC="yourmailafriendimage.jpg" border=0 width="IMAGEWIDTH" height="IMAGEHEIGHT"></A>

In that code, you need to replace YOURCOMPANYNAME with your company name, replace yourmailafriendimage.jpg with the image you want to use, and replace IMAGEWIDTH and IMAGEHEIGHT with the width and height of the image.

Change YOURBCCADDRESS to an email address if you want a copy of the email to be sent to an address you specify.

You will also need to go to View>Business Settings>Options and tick the show product reference in catalog.

the only problem with this method is if there is a space in your product reference, the link to the product in the email is broken.

if you do not want product references to appear in your catalog, you would then need to comment out the NETQUOTEVAR:PRODUCTREF from each of your product templates.

when it works its neat because you get a hyperlink in the email to the friend...

if you do try this type and run into trouble, post back and i should be able to help.....

as i say, the only other issue with this method is the ugly html tags that get brought into the body of the email from the product description.

however, you could actually remove the NETQUOTEVAR:PRODUCTDESCRIPTION from the line above and this would just leave product name and a link to the product in the body of the email..

steve quinn
harlequin domains

NormanRouxel
14-Nov-2003, 09:34 PM
This might work-

In one of the JavaScipt versions (not your <a ...> one I'm afraid) replace NETQUOTEVAR:PRODUCTDESCRIPTION

with

' + 'NETQUOTEVAR:PRODUCTDESCRIPTION'.replace(/<br>|<p>/ig,"%0a") + '

This should replace all those <br> and <p> with a new line.

Norman

harlequin
08-Jan-2004, 01:25 PM
hi everyone, slightly off subject, I am trying to put a bit of javascript in a link to tell it the current page location, like this,

<a href="/scripts/ss000001.pl?SECTIONID='+this.location.href+'">Click here to Login</a>

can anyone help.

thanks

Steve Quinn
Harlequin Domains
www.harlequindomains.com
Actinic Design, Hosting and Marketing

NormanRouxel
08-Jan-2004, 06:35 PM
Try something like

<a href="javascript:location.href='/scripts/ss000001.pl?SECTIONID='+location.href">Click here to Login</a>

Norman

TiggyPig
16-Jul-2004, 12:04 PM
So....

was there a definitive script produced that will let you email product details to a friend using a button on a page?

My button is OK, but I get a lot of HTML BR tags showing in the product description that looks unprofessional.

Like this:

Power Ball <BR>The Powerball is a cracking little device, which is great for building up those much needed wrist muscles (insert your own mucky joke here). <BR><BR>It has been designed specifically for the sportsman in mind, so if you play golf, tennis, badminton, squash or martial arts at all, then this is for you. <BR><BR>It works by centrifugal force and you keep the momentum going by dynamically twisting and flexing your wrist. Addictive fun as well.<BR><BR>WAS £14.99 http://www.tiggypig.com/cgibin/ss000001.pl?PRODREF=POWERBALL

Obviously it'd be cool just to have a product link, or a description that avoids all the HTML code being shown.

This is my code on my product pages:

<a href="mailto:?Subject=I%20saw%20this%20NETQUOTEVAR:PRODUCTNAME%20at%20CUSTOMVAR:COMPANYNAME%20and%20thought%20of%20you!&bcc=CUSTOMVAR:BCCRECOMMEND&Body=NETQUOTEVAR:PRODUCTNAME%20NETQUOTEVAR:PRODUCTDESCRIPTION%20CUSTOMVAR:CGIBINURL/ss000001.pl?PRODREF=NETQUOTEVAR:PRODUCTREF"><img src="CUSTOMVAR:EMAILAFRIENDIMAGE" alt="Email NETQUOTEVAR:PRODUCTNAME to a friend..." border="0">

smiffy
30-Sep-2004, 07:32 PM
This might work-

In one of the JavaScipt versions (not your <a ...> one I'm afraid) replace NETQUOTEVAR:PRODUCTDESCRIPTION

with

' + 'NETQUOTEVAR:PRODUCTDESCRIPTION'.replace(/<br>|<p>/ig,"%0a") + '

This should replace all those <br> and <p> with a new line.

Norman

TiggyPig - have you tried this bit of code?

marknc
03-Oct-2009, 12:01 PM
That was it above. Just put this (rather long one-liner) in a suitable place in Act_ProductLine.html.

Enter e-mail address to tell a friend <input type=text value="" size=40 onchange="var thisloc=location.href + '#NETQUOTEVAR:PRODUCTANCHOR';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">

Norman

This does not appear to work in IE 7 or 8. Cannot figure out why. Works fine in Firefox, Chrome, Opera and Safari. I'm not a coder at all so don't really know what to do. I think it's a great function and really want to use it.

marknc
03-Oct-2009, 02:32 PM
Thanks pfb5.