Announcement

Collapse
No announcement yet.

BUG. Advanced Guide - Email A Friend - fails if single quote in product name.

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

    BUG. Advanced Guide - Email A Friend - fails if single quote in product name.

    The Advanced Guide, page 90 "Including an 'Email A Friend' Link into Actinic" needs a tweak or it will fail if there is a single quote in the product name. E.g. O'Reilly PHP Cookbook.

    The quick fix is to replace the fragment
    Code:
    <Actinic:Variable Name="ProductName"/>
    with
    Code:
    <actinic:block php="true">echo rawurlencode('<Actinic:Variable Name="ProductName" encoding="perl" selectable="false" />');</actinic:block>
    But the better fix would be to replace the article with the following
    Code:
    Enter e-mail address to tell a friend
    <input type=text value="" size=40 onchange="
    	var thisloc=location.href + '%23<Actinic:Variable Name="EncodedProductAnchor"/>';
    	if (this.value != '') {
    		location.href = 'mailto:' + this.value + '?subject=' + escape('Take a look at ') 
    		+ '<actinic:block php="true">echo rawurlencode('<Actinic:Variable Name="ProductName" encoding="perl" selectable="false" />');</actinic:block>'
    		+ '&body=' + escape('I saw ') + thisloc + escape(' and thought you would be interested.');
    		}
    ">
    <input type=button value="OK">
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    #2
    Thanks Norman, I'll pass this on to the relevant person and also update the knowledgebase article.
    ********************
    Tracey
    SellerDeck

    Comment


      #3
      Ive recently removed this from my sites and replaced it with a widget see the bottom of this page

      Comment


        #4
        Widget

        Hi Mal.
        That looks a good widget, obvious question coming up: where did you get it and is it easy to add to an Actinic page?
        Steve Griggs.

        "People in business often miss opportunities, mainly because they usually arrive dressed in overalls and looking like work."



        www.kitchenwareonline.com
        www.microwave-repair.co.uk

        Comment


          #5
          http://secure.socialtwist.com/web/signup - copy and paste supplied code into layout

          Comment


            #6
            Thanks

            Thanks for the link Mal. I'll have a look, that looks worth trying out.
            Steve Griggs.

            "People in business often miss opportunities, mainly because they usually arrive dressed in overalls and looking like work."



            www.kitchenwareonline.com
            www.microwave-repair.co.uk

            Comment


              #7
              Mal - I'm getting "nullnullnull" after the first recently viewed item, "nullnull" after the second etc - were you aware?

              Aquazuro - designer stainless steel accessories

              Comment


                #8
                Yes its something I cannot be arsed to fix

                Comment


                  #9
                  Seems reasonable

                  Aquazuro - designer stainless steel accessories

                  Comment


                    #10
                    What are the advantages and disadvantages of using Mal's "email a friend" method compared with Norman's "email a friend method"?

                    Is there any way you can get feedback on which products have had emails sent about them? Is there any way you can get feedback as to who sent the email and where the email was sent to?

                    Comment


                      #11
                      Tracy,

                      The KB version of this has been horribly munged (all the + signs are missing).

                      Here's an update that also fixes a minor problem when the existing page URL had an anchor in it.

                      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 being typed when in email address field from inadvertantly adding product to cart.
                      Norman - www.drillpine.biz
                      Edinburgh, U K / Bitez, Turkey

                      Comment


                        #12
                        The KB version of this has been horribly munged (all the + signs are missing).
                        Hmm, don't know how that happened. I've updated it now so thanks for that. I'll also pass it on to get the AUG updated too.
                        ********************
                        Tracey
                        SellerDeck

                        Comment


                          #13
                          I've just posted an update to this on http://community.actinic.com/showpos...43&postcount=6

                          I've also updated post #11 above.

                          Someone hitting the enter key while typing the email address could inadvertantly add to Cart. A problem that's been in the Other Info field forever.
                          Norman - www.drillpine.biz
                          Edinburgh, U K / Bitez, Turkey

                          Comment


                            #14
                            Thanks Norman, the kb has been updated.
                            ********************
                            Tracey
                            SellerDeck

                            Comment


                              #15
                              Thanks, Tracey. I think it might be in the AUG too.
                              Norman - www.drillpine.biz
                              Edinburgh, U K / Bitez, Turkey

                              Comment

                              Working...
                              X