Announcement

Collapse
No announcement yet.

Email Friend Link Product Anchor

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Email Friend Link Product Anchor

    The email friend script in the KB appends the URL with the encoded product anchor to enable the friend to be taken straight to the product.

    If the product is initially accessed via the marketing lists the url displays are :

    page.html#aWidget

    sending the link appends the anchor again eg:

    page.html#aWidget#aWidget

    Is there a way to check the URL already has the anchor and not append again?


    Bikster
    SellerDeck Designs and Responsive Themes

    #2
    The KB article ( http://community.actinic.com/showthread.php?t=45404 ) is riddled with bugs (someone has removed all the plus signs from the code).

    Could you post what you're using and I'll see if I can fix it.
    Last edited by KB2; 22-Mar-2010, 04:43 PM. Reason: Updating kb links
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Cheers Norman,

      the default code is :

      Code:
      <input type=text value="" size=52 onchange="var thisloc=location.href + '%23<Actinic:Variable Name="EncodedProductAnchor"/>';
      	if (this.value != '') {
      		location.href='mailto:' + this.value +'?subject=Take%20a%20look%20at%20<Actinic:Variable 
      
      Name="ProductName"/>&body=I%20saw%20' + thisloc + '%20and%20thought%20you%20would%20be%20interested.'
      		}
      ">
      <input type=button value="Send Email">
      .. works perfect when sending from the product direct but not if the product has been accessed via the cgi-bin


      Bikster
      SellerDeck Designs and Responsive Themes

      Comment


        #4
        Try this:
        Code:
        <input type=text value="" size=52 onchange="var thisloc=location.href; if (thisloc.indexOf('#') == -1) thisloc += '%23<Actinic:Variable Name="EncodedProductAnchor"/>';
        	if (this.value != '') {
        		location.href='mailto:' + this.value +'?subject=Take%20a%20look%20at%20<Actinic:Variable 
        
        Name="ProductName"/>&body=I%20saw%20' + thisloc + '%20and%20thought%20you%20would%20be%20interested.'
        		}
        ">
        <input type=button value="Send Email">
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          Top stuff Norman - the tweak to this.loc does indeed only append a single instance of the product anchor whether accessed direct or via the cgi-bin.

          Would one of the Mods please update the KB with this important change please?


          Bikster
          SellerDeck Designs and Responsive Themes

          Comment


            #6
            This would be better. It prevents JavaScript errors if the product name contains quotes. And also deals better with pages accessed from the search results.

            Tell a friend.

            Put the following in your overall layout just above the </head> line:
            Code:
            <script type="text/javascript">
            function testkey(ev){
            	return ((ev.which ? ev.which : ev.keyCode) != '13');
            }
            
            function tellfriend(anc, pname){
            	var friend = document.getElementById('tell-' + anc);
            	var thisloc=location.href.replace(/%23/g, '#');
            	if (thisloc.indexOf('#') == -1)	// no anchor so add one in 
            		{
            		thisloc += '#' + anc;
            		}
            	else	// replace existing anchor with our own
            		{
            		thisloc = thisloc.replace(/#.*/, '#' + anc)
            		}
            	if (friend.value != '') {
            		location.href = 'mailto:' + friend.value + '?subject=' + escape('Take a look at ') + pname
            		+ '&body=' + escape('I saw ' + thisloc + ' and thought you would be interested.');
            		}
            }
            </script>
            Put the following in your product layout(s):
            Code:
            Enter e-mail address to tell a friend 
            <input type=text id="tell-<Actinic:Variable Name="EncodedProductAnchor"/>" value="" size="40" onKeypress="return testkey(event);"/>
            <input type=button value="SEND" onclick="tellfriend('<Actinic:Variable Name="EncodedProductAnchor"/>','<actinic:block php="true">echo rawurlencode('<Actinic:Variable Name="ProductName" encoding="perl" selectable="false" />');</actinic:block>');">
            Updated 06-02-09. Disable enter key in email address field from adding to cart.
            Norman - www.drillpine.biz
            Edinburgh, U K / Bitez, Turkey

            Comment


              #7
              Top drawer Norman - works a treat


              Bikster
              SellerDeck Designs and Responsive Themes

              Comment


                #8
                Super. It's interesting that what started out as a one-line tweak is now 21 times as long!
                Norman - www.drillpine.biz
                Edinburgh, U K / Bitez, Turkey

                Comment


                  #9
                  I've just added this to my site and it works a treat.
                  Thanks all.
                  julie.
                  www.toys-to-you.co.uk
                  Affordable ethical, fairtrade and green childrens toys

                  Comment


                    #10
                    Is it just me but with the default code if the user hits enter after adding the email address the product also gets added to the cart?


                    Bikster
                    SellerDeck Designs and Responsive Themes

                    Comment


                      #11
                      Julie,

                      Your site's layout looks very broken in FF

                      Army Gore-tex
                      Winter Climbing Mitts
                      webD's Blog: Website design, SEO and other ramblings…
                      Twitter LinkedIN

                      If you think a post is good, rate it!

                      Find the answers in the Knowledge Base | Have you read the User Guides

                      Comment


                        #12
                        Jont,

                        You're right. That needed fixing. I've amended post #6 above to disable the enter key when in the email field.

                        Something Actinic's never got round to for the Other Info field.
                        Norman - www.drillpine.biz
                        Edinburgh, U K / Bitez, Turkey

                        Comment


                          #13
                          Hmmm... I just tried the "Suggest changes" capability for the corresponding Knowledge Base article and there was no indication whether it went through or not.

                          The form there uses a CAPTCHA and when I tried a test with an invalid code there was still no indication that I'd done anything right or wrong.

                          So someone who gets the CAPTCHA wrong, may have submitted nothing but be unaware of that.
                          Norman - www.drillpine.biz
                          Edinburgh, U K / Bitez, Turkey

                          Comment


                            #14
                            Hi

                            I have used your code above Norman (Or I hope I have!) and I am still getting the oddity of the item being added to the basket?

                            Example: http://edgeandwax.co.uk/acatalog/Onl...n_Puck_28.html

                            Any ideas?

                            Thanks!

                            ScottyDog
                            www.edgeandwax.co.uk
                            Edge & Wax
                            Ski & Snowboard Workshop

                            Comment


                              #15
                              Scott.

                              You are using code that is generated as:
                              Code:
                               <input type="image" value="SEND" src="mail2.gif" align="top" border="0" onclick="tellfriend('a18','');">
                              And this is acting as a submit button for the form containing the product.

                              Try:
                              Code:
                               <input type="image" value="SEND" src="mail2.gif" align="top" border="0" onclick="tellfriend('a18','');return false;">
                              Where the return false; should inhibit the submit.
                              Norman - www.drillpine.biz
                              Edinburgh, U K / Bitez, Turkey

                              Comment

                              Working...
                              X