Page 1 of 2

Facebook Like Button

Posted: Sun Jul 11, 2010 4:43 am
by Chrissy Poo
I am trying to add the Facebook Like Button to my product page as you can see here:

Image

In the code I need to add the page URL, but what do I put?

Re: Facebook Like Button

Posted: Sun Jul 11, 2010 10:09 am
by JAY6390

Code: Select all

<?php echo $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/product&product_id='.$this->request->get['product_id']); ?>
That should do it

Re: Facebook Like Button

Posted: Mon Jul 12, 2010 12:12 am
by Chrissy Poo
Thanks works perfect :)

If anyone else wants to add the Facebook Like Button to their Opencart Store Follow the Following Instructions:

Requirements:
- SEO URLs Must be Enabled

Instructions:

Edit the file: catalog/view/theme/default/template/product/product.tpl

Find this piece of code:

Code: Select all

</table>
            <br />
            <?php if ($display_price) { ?>
Replace the <br /> with the following:

Code: Select all

<div style="width: 100%; padding-top:10px;">
            <table>
               <tr>
              <td><iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/product&product_id='.$this->request->get['product_id']); ?>&layout=standard&show_faces=false&width=280&action=like&colorscheme=light&height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:270px; height:35px;" allowTransparency="true"></iframe>
              </td>
              </tr>
            </table>
            </div>
I have tested this on OpenCart 1.4.8b in IE6, IE7, IE8, FF 3.6.6

Let me know if you find any problems :)

Re: Facebook Like Button

Posted: Mon Jul 12, 2010 3:37 am
by SteveSherry
Great work,
This also works in Google Chrome

Re: Facebook Like Button

Posted: Mon Jul 12, 2010 3:50 am
by Chrissy Poo
No Problems and thanks for testing in Google Chrome :)

Re: Facebook Like Button

Posted: Sat Sep 04, 2010 10:52 am
by stonehinged
Nice work! Thanks for the instructions. I've tested on OC 1.4.7. in Safari 5.0.1. All looks great!

Re: Facebook Like Button

Posted: Wed Sep 08, 2010 6:22 am
by InfiniteDezigns
This did not work for me. It won't show up. I'm using OC 1.4.9. Here's the URL:

http://www.dyelyfe.com/Store

Re: Facebook Like Button

Posted: Wed Sep 08, 2010 6:36 am
by Chrissy Poo
InfiniteDezigns wrote:This did not work for me. It won't show up. I'm using OC 1.4.9. Here's the URL:

http://www.dyelyfe.com/Store
Are you sure you are editing the right file?

Also you site seems really really slow to me, might want to work on the speed.

Re: Facebook Like Button

Posted: Wed Sep 08, 2010 6:45 am
by InfiniteDezigns
Yeah I'm sure. The directions are to edit this page:

Edit the file: catalog/view/theme/default/template/product/product.tpl

I pasted the code above and it won't show up. This site is a work in progress so speed is not a siiue now. Just trying to get the kinks out first.

Re: Facebook Like Button

Posted: Wed Sep 08, 2010 6:56 am
by Chrissy Poo
InfiniteDezigns wrote:Yeah I'm sure. The directions are to edit this page:

Edit the file: catalog/view/theme/default/template/product/product.tpl

I pasted the code above and it won't show up. This site is a work in progress so speed is not a siiue now. Just trying to get the kinks out first.
Just searched your source code and its not even showing there so you must be doing something wrong.

Re: Facebook Like Button

Posted: Wed Sep 08, 2010 6:57 am
by SteveSherry
The instructions above are based upon your using the default store.
If you have a custom theme (as you do) you need to change :
catalog/view/theme/default/template/product/product.tpl
into
catalog/view/theme/YOURTHEME/template/product/product.tpl
(i.e - catalog/view/theme/dyelyfe/template/product/product.tpl)

Once this is done it should then show.

Re: Facebook Like Button

Posted: Wed Sep 08, 2010 7:13 am
by InfiniteDezigns
Ok I got it to show up. But now it doesn't show or calculate how many people like the product. It also doesn't show up on facebook newsfeed or profile page at all.

Re: Facebook Like Button

Posted: Wed Sep 08, 2010 7:26 am
by Chrissy Poo
InfiniteDezigns wrote:Ok I got it to show up. But now it doesn't show or calculate how many people like the product. It also doesn't show up on facebook newsfeed or profile page at all.
You need to enable SEO Urls and also give the products keywords.

To show faces you need to edit the facebook code, look for show_faces=false and change to show_faces=true

Re: Facebook Like Button

Posted: Wed Sep 08, 2010 12:34 pm
by InfiniteDezigns
Nope. still doesn't show how many people like nor does it post to their page. and everything has keywords and the seo urls is active.

Re: Facebook Like Button

Posted: Wed Sep 08, 2010 7:06 pm
by Chrissy Poo
InfiniteDezigns wrote:Nope. still doesn't show how many people like nor does it post to their page. and everything has keywords and the seo urls is active.
Your products to not have SEO urls, look at this url:

http://dyelyfe.com/Store/index.php?rout ... uct_id=102

then compare to this one:

http://www.stylemyapple.co.uk/ipad-acce ... pad-itouch

That is your problem.

Re: Facebook Like Button

Posted: Wed Sep 15, 2010 5:38 pm
by Incan11
I have my store located at www.one.com is it possible to make this facebook like button work?

Enabled the SEO kewords but then the products are not showing.

Re: Facebook Like Button

Posted: Sat Sep 18, 2010 2:36 pm
by naz_eg
Works perfect ;) Thank you..

Re: Facebook Like Button

Posted: Sun Oct 10, 2010 1:55 am
by anmgra
Everything works fine expect that the title is not returned correct at facebook. I only get the title I have on my maintenance site. Has anyone experienced this? Or do someone know if there is a solution?
v.1.4.9.1

Re: Facebook Like Button

Posted: Mon Oct 11, 2010 12:44 am
by Twist
Does this work in version: v1.4.9.1?

I have put the code in and the facebook like button shows up fine. but when I press the like button I get the following appear on Facebook: Mark likes Product not found! on party-kits.com. I have tried putting an SEO keyword in but it is not making any difference. any ideas what could be wrong?

Re: Facebook Like Button

Posted: Wed Oct 13, 2010 4:18 pm
by Twist
Well I have tried everything I can think of now and still no luck ??? It seems that when I put an SEO keyword onto a product then the product will not show when I click on it on my website hence why it will not show up on Facebook. What a bummer! Is there any other alternative ways of doing this at all?

Thank You :-)