Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 27 of 27

Thread: How to Add Facebook 'like' button to every product page

  1. #1
    toofast is offline Senior Member
    Join Date
    Dec 2005
    Location
    Cherry Hill, NJ, USA
    Posts
    239

    Default How to Add Facebook 'like' button to every product page

    first, add xmlns:fb="http://www.facebook.com/2008/fbml" to your xmlpackage like this.....

    Code:
    <PackageTransform>
    
            <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:aspdnsf="urn:aspdnsf" exclude-result-prefixes="aspdnsf" xmlns:fb="http://www.facebook.com/2008/fbml">

    second, create a product link variable....
    Code:
    <xsl:param name="pLink" select="aspdnsf:ProductLink(ProductID, SEName, 0)" />
    third, add this code where you want the "like" button to show up. change the width if needed and of course hard code your root domain....

    Code:
    <div id="fb-root"></div>
    <script>
      window.fbAsyncInit = function() {
        FB.init({appId: 'your app id', status: true, cookie: true,
                 xfbml: true});
      };
      (function() {
        var e = document.createElement('script'); e.async = true;
        e.src = document.location.protocol +
          '//connect.facebook.net/en_US/all.js';
        document.getElementById('fb-root').appendChild(e);
      }());
    </script>
    
    <div style="padding:25px 0 0 0;" align="left">
    <fb:like href="http://www.pinupshoes.com/{$pLink}" layout="standard" show_faces="false" width="300" action="like" font="arial" colorscheme="light"></fb:like>
    </div>
    you can see this in action here:
    http://www.toofastonline.com/p-10243...mini-tube.aspx
    Last edited by AspDotNetStorefront Staff - Scott; 05-03-2010 at 10:36 AM.

  2. #2
    Upscale_Automotive is offline Senior Member
    Join Date
    Apr 2008
    Posts
    201

    Default

    This is gold! Thank you very much!

  3. #3
    mariamir is offline Junior Member
    Join Date
    Jul 2010
    Posts
    10

    Default

    Can you please tell which xmlpackage do i need to modify for this functionality?

  4. #4
    AspDotNetStorefront Staff - Scott's Avatar
    AspDotNetStorefront Staff - Scott is offline Administrator
    Join Date
    Mar 2007
    Location
    Ashland, OR
    Posts
    2,390

    Default

    That would go in the XML package(s) you're using for product display. Check the 'Display Format XML Package' attribute for your products in the admin site.

  5. #5
    Brian3434 is offline Junior Member
    Join Date
    Aug 2010
    Posts
    2

    Default

    When I add the second step:
    HTML Code:
    <xsl:param name="pLink" select="aspdnsf:ProductLink(ProductID, SEName, 0)" />
    I also tried
    HTML Code:
    <xsl:param name="pLink" select="aspdnsf:ProductLink(ProductID, SEName, '',0)" />
    Any ideas?

    I get error message:

    Message:Error Calling XSLTExtension Function ProductLink: Invalid value specified for ProductID ()
    Stack Trace:
    at AspDotNetStorefrontCore.InputValidator.ReportError (String ParamName, String ParamValue)
    at AspDotNetStorefrontCore.InputValidator.ValidateInt (String ParamName, String ParamValue)
    at AspDotNetStorefrontCore.XSLTExtensionBase.ProductL ink(String sProductID, String sSEName, String sIncludeATag, String sTagInnerText, String sJustProductPage)
    at AspDotNetStorefrontCore.XSLTExtensionBase.ProductL ink(String sProductID, String sSEName, String sIncludeATag, String sTagInnerText)

  6. #6
    Toadkillerdg is offline Junior Member
    Join Date
    Sep 2010
    Posts
    0

    Default Doesn't work in IE

    The above instructions don't appear to work. If I embed the <fb:Like> tag in the XML package, nothing displays. If I use the Production page to place it an Extension area. It works fine in all browsers but IE. Any suggestions?

  7. #7
    Brian3434 is offline Junior Member
    Join Date
    Aug 2010
    Posts
    2

    Default

    Quote Originally Posted by Toadkillerdg View Post
    The above instructions don't appear to work. If I embed the <fb:Like> tag in the XML package, nothing displays. If I use the Production page to place it an Extension area. It works fine in all browsers but IE. Any suggestions?
    I had the same issue. The fix I found was the order of the name sapce in the stylesheet tag.

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:aspdnsf="urn:aspdnsf" exclude-result-prefixes="aspdnsf" xmlns:fb="http://www.facebook.com/2008/fbml">

    If I put the xmlns:fb last in this order, it worked. If I put it first, nothing showed up. Not sure, but works for me now. Maybe this will work for you also.

  8. #8
    Canterbury is offline Junior Member
    Join Date
    Nov 2010
    Posts
    3

    Default Not displaying on screen

    After following these suggestions my rendered page contains the FB code in the source but nothing is displayed on the page in IE.

    I just created a table at the bottom of the XHTML and inserted the FB code. To ensure plain text would render, I added a comment to the table which renders just fine.

    Any suggestions?

  9. #9
    flammaaeterna is offline Member
    Join Date
    Sep 2006
    Posts
    58

    Default

    I can't get it to work in IE, either. Chrome and Firefox seem to work fine, so far.

  10. #10
    chazandchaz is offline Member
    Join Date
    Jul 2006
    Posts
    70

    Smile

    This is an example of FF and Chrome being more forgiving than IE.

    You will need to add
    C#/VB.NET Code:
    xmlns:fb="http://www.facebook.com/2008/fbml" 
    to your first html tag.

    so that it reads

    C#/VB.NET Code:
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" 
    Depending on what version of ASPDNSF you are using you would make the change in template.ascx or template.master.

    Chaz.

  11. #11
    tuffy is offline Member
    Join Date
    Nov 2008
    Posts
    76

    Default

    Do you need the source code to do this?

  12. #12
    jsimacek is offline Senior Member
    Join Date
    Dec 2008
    Location
    Phoenix, AZ
    Posts
    373

    Default

    No, source code is not needed.

    BTW, there's an add-on for that ;-) http://www.ecommercecartmods.com/p-8...torefront.aspx

    And even more important for Facebook commerce exposure, the Facebook Commerce Shop tab/app! http://www.ecommercecartmods.com/p-9...torefront.aspx
    Jan Simacek - Compunix, LLC
    AspDotNetStorefront trusted Devnet Partner and Reseller since 2005

    AspDotNetStorefront Mods and Add-Ons at http://www.ecommercecartmods.com/
    - Searching, Filtering and Sorting (like cSearch, Dealer Locator, Price Ranges, Blog)
    - Reports (like Cart Abandonment and Net Sales)
    - Customer Experience (like Question/Answers)
    - Site and Data Management (like Entity Product Mapper, Bulk Updaters, Make/Model/Year filters)

  13. #13
    SRT is offline Senior Member
    Join Date
    Sep 2008
    Posts
    108

    Default

    Quote Originally Posted by jsimacek View Post
    No, source code is not needed.

    BTW, there's an add-on for that ;-) http://www.ecommercecartmods.com/p-8...torefront.aspx

    And even more important for Facebook commerce exposure, the Facebook Commerce Shop tab/app! http://www.ecommercecartmods.com/p-9...torefront.aspx
    Has anyone out there used either the "Like" and/or ecommerce package? How well has the Facebook commerce exposure worked; i.e., is it worth the investment?

  14. #14
    Tanios is offline Junior Member
    Join Date
    Apr 2010
    Posts
    2

    Default Facebook Commerce For AspDotNetStoreFront

    Until some “real” clients reply , I thought I’d go ahead and answer your questions about Facebook commerce:
    1) Yes, there are clients using the Facebook commerce solution. A couple of them have posted their feedback here: http://forums.aspdotnetstorefront.co...ebook+commerce

    Here is a partial list of clients using our Facebook commerce solution: http://ecommercecartmods.com/t-Faceb...erceDemos.aspx

    2) Good question, I’m sure it’s one that crosses everyone’s mind – “is it worth the investment?”
    Since the app can serve many purposes, and add value in different ways, it all depends on what you are trying to achieve. For example, one of our clients sells concert/event tickets and uses the shopping app as their FB landing page to deliver dynamic content. Their fans are able to see the latest concert ticket offerings, webcasts, and newest announcements. All this content is fed directly from their storefront in real-time (no data feeds required). For this client, publishing a product on their storefront causes the new content to be published on FB, informs FB visitors of new events, and gives them a call to action (making a purchase).

    Based on client feedback, the app has increased traffic to their website. One of our clients has reported Facebook to be their second highest source of web traffic. Another client is receiving nearly 1,300 users a month.

    Here is an interesting article about generating sales with Facebook:
    http://www.allfacebook.com/facebook-...funnel-2009-06
    Interesting article about Facebook e-commerce
    http://www.businessinsider.com/faceb...rove-it-2011-3

    Social commerce is a new and growing trend with a lot of potential. Some e-commerce solutions are including a FB shop integration as a standard feature.

  15. #15
    save@gt is offline Junior Member
    Join Date
    Apr 2009
    Posts
    4

    Default

    Quote Originally Posted by Brian3434 View Post

    I get error message:

    Message:Error Calling XSLTExtension Function ProductLink: Invalid value specified for ProductID ()
    Stack Trace:
    at AspDotNetStorefrontCore.InputValidator.ReportError (String ParamName, String ParamValue)
    at AspDotNetStorefrontCore.InputValidator.ValidateInt (String ParamName, String ParamValue)
    at AspDotNetStorefrontCore.XSLTExtensionBase.ProductL ink(String sProductID, String sSEName, String sIncludeATag, String sTagInnerText, String sJustProductPage)
    at AspDotNetStorefrontCore.XSLTExtensionBase.ProductL ink(String sProductID, String sSEName, String sIncludeATag, String sTagInnerText)
    Haven't seen a follow up to this issue. I've experienced the same & not having luck correcting the problem. Any help?

  16. #16
    macecase is offline Member
    Join Date
    Feb 2011
    Posts
    44

    Default

    Did you ever get this problem solved? I am getting the same error.

    Code:
    Message:Error Calling XSLTExtension Function ProductLink: Invalid value specified for ProductID ()

    Quote Originally Posted by Brian3434 View Post
    When I add the second step:
    HTML Code:
    <xsl:param name="pLink" select="aspdnsf:ProductLink(ProductID, SEName, 0)" />
    I also tried
    HTML Code:
    <xsl:param name="pLink" select="aspdnsf:ProductLink(ProductID, SEName, '',0)" />
    Any ideas?

    I get error message:

    Message:Error Calling XSLTExtension Function ProductLink: Invalid value specified for ProductID ()
    Stack Trace:
    at AspDotNetStorefrontCore.InputValidator.ReportError (String ParamName, String ParamValue)
    at AspDotNetStorefrontCore.InputValidator.ValidateInt (String ParamName, String ParamValue)
    at AspDotNetStorefrontCore.XSLTExtensionBase.ProductL ink(String sProductID, String sSEName, String sIncludeATag, String sTagInnerText, String sJustProductPage)
    at AspDotNetStorefrontCore.XSLTExtensionBase.ProductL ink(String sProductID, String sSEName, String sIncludeATag, String sTagInnerText)

  17. #17
    BFG 9000 is offline Senior Member
    Join Date
    Oct 2006
    Location
    South UK
    Posts
    882

    Default

    Have you tried following this guide?


    TTFN

    BFG

  18. #18
    save@gt is offline Junior Member
    Join Date
    Apr 2009
    Posts
    4

    Default

    Quote Originally Posted by macecase View Post
    Did you ever get this problem solved? I am getting the same error.
    Location seemed to be the issue. Putting the product link variable & code after <xsl:template match="Product"> made the difference for us.

    Though I've started playing with the other package linked here by BFG 9000. Would much rather have a thumbnail image & cleaner title show up on FB.

  19. #19
    joecalardo is offline Member
    Join Date
    May 2011
    Posts
    61

    Default

    Anyone having problems with the incorrect image being pulled from the site once you like the page ? When I like the page, it pulls the product fine, but uses a different image from somewhere else on the page rather than the product. Anyone know a fix for this ?

  20. #20
    BFG 9000 is offline Senior Member
    Join Date
    Oct 2006
    Location
    South UK
    Posts
    882

    Default

    Quote Originally Posted by joecalardo View Post
    Anyone having problems with the incorrect image being pulled from the site once you like the page ? When I like the page, it pulls the product fine, but uses a different image from somewhere else on the page rather than the product. Anyone know a fix for this ?
    Yup - you need to specify the image in the og tags : http://forums.aspdotnetstorefront.co...read.php?30658


    TTFN

    BFG

  21. #21
    hotdog is offline Member
    Join Date
    Jun 2011
    Location
    Daytona Beach, FL
    Posts
    46

    Thumbs up Took a little tweaking...

    but it worked like a champ! Thanks for the code.

  22. #22
    don.irwin is offline Member
    Join Date
    Apr 2006
    Location
    Phoenix AZ
    Posts
    81

    Default

    the manual recommends against using ProductLink - the easier way to get it is:

    Code:
    <xsl:param name="pLink" select="concat(/root/System/StoreUrl, /root/System/PageName)" />

  23. #23
    shark92651 is offline Member
    Join Date
    Jan 2006
    Posts
    81

    Default

    Quote Originally Posted by don.irwin View Post
    the manual recommends against using ProductLink - the easier way to get it is:

    Code:
    <xsl:param name="pLink" select="concat(/root/System/StoreUrl, /root/System/PageName)" />
    This doesn't work for me. I end up with a URL like this:

    "https://www.mydomain.com/showproduct.aspx"

    Any idea why I am not getting the actual product page here?

  24. #24
    don.irwin is offline Member
    Join Date
    Apr 2006
    Location
    Phoenix AZ
    Posts
    81

    Default

    sorry - I'm using URL rewriting with showproduct.aspx being rewritten with the following rule:

    Code:
    <add name="Product" url="p-{ProductID}-{SEName}" virtualPath="~/showproduct.aspx" checkPhysicalUrlAccess="false" />
    so /root/System/PageName = "p-12-some-product"

    If you aren't using url rewriting, you'll have to use one of the previously mentioned methods for getting the URL - to see what is being returned, set debug="true" in the XML package and review the XML data returned (should be 2nd textbox.).

  25. #25
    swak is offline Junior Member
    Join Date
    Sep 2011
    Posts
    1

    Default What is the appId: 'your app id'

    What do I need for the appId: 'your app id'

  26. #26
    Ydeveloper is offline Junior Member
    Join Date
    Nov 2010
    Location
    Waltham
    Posts
    7

    Default

    I found a blog where this topic [facebook like button integration] nicely explained. For more information you can visit, http://developers.facebook.com/docs/.../plugins/like/

  27. #27
    BFG 9000 is offline Senior Member
    Join Date
    Oct 2006
    Location
    South UK
    Posts
    882

    Default

    You found a blog?

    That blog just happens to be on a domain that matches your username?

    Smells like spam to me...


    TTFN

    BFG