Page 1 of 5

[MOD] Facebook Like Button on Product Page

Posted: Mon Jul 19, 2010 11:19 am
by Chrissy Poo
Image

Requirements:
- SEO URLs Must be Enabled

Demo:
Demo Link: http://www.stylemyapple.co.uk

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: [MOD] Facebook Like Button on Product Page

Posted: Wed Jul 21, 2010 5:33 pm
by Signserve
Can confirm that this is an awesome script, just installed it and tested it on our store! :)

Thumbs up!

Re: [MOD] Facebook Like Button on Product Page

Posted: Wed Jul 21, 2010 7:08 pm
by Chrissy Poo
Signserve wrote:Can confirm that this is an awesome script, just installed it and tested it on our store! :)

Thumbs up!
Glad you like :)

Re: [MOD] Facebook Like Button on Product Page

Posted: Fri Jul 23, 2010 3:03 am
by musicofthehart
VERY cool, but when I click on like it, then go to my facebook page it says... likes Product not found!

not sure what to do. Thanks for your help in advance

Re: [MOD] Facebook Like Button on Product Page

Posted: Fri Jul 23, 2010 6:09 am
by Chrissy Poo
musicofthehart wrote:VERY cool, but when I click on like it, then go to my facebook page it says... likes Product not found!

not sure what to do. Thanks for your help in advance
Do you have SEO URLs enabled?

Is your site live and viewable to the public?

Re: [MOD] Facebook Like Button on Product Page

Posted: Fri Jul 23, 2010 11:55 am
by musicofthehart
I did NOT have SEO URLS enabled, I am sure that was my problem, but now I have opened up a whole new can of worms since I turned that on.... all of my pages are not found. I am sure it has to do with the fact that I am using godady hosting. Ill try to figure out this problem and get back to you. Great mod btw... and I am sure it works once I get my new problem fixed.

Re: [MOD] Facebook Like Button on Product Page

Posted: Fri Jul 23, 2010 1:41 pm
by musicofthehart
All better now, the SEO URLS are enabled, and your script works great. Thank you very much for this!

Re: [MOD] Facebook Like Button on Product Page

Posted: Sat Jul 24, 2010 1:35 am
by Chrissy Poo
musicofthehart wrote:All better now, the SEO URLS are enabled, and your script works great. Thank you very much for this!
No problems, glad to help :)

Re: [MOD] Facebook Like Button on Product Page

Posted: Mon Aug 30, 2010 11:21 am
by felizone
Hello,

I added to my code, but it shows error while i clicked the like button.
The page showed.
http://www.facebook.com/connect/connect ... _error.php
cannot access and cannot find item.

What's the matter?
My server problem or my code error?

Thanks,
Felix

Re: [MOD] Facebook Like Button on Product Page

Posted: Mon Aug 30, 2010 6:09 pm
by Chrissy Poo
felizone wrote:Hello,

I added to my code, but it shows error while i clicked the like button.
The page showed.
http://www.facebook.com/connect/connect ... _error.php
cannot access and cannot find item.

What's the matter?
My server problem or my code error?

Thanks,
Felix
Whats the url for your store?

Re: [MOD] Facebook Like Button on Product Page

Posted: Tue Sep 07, 2010 11:22 pm
by DirtyJeeves
Great script.

Having troubles with the "likes Product Not Found" as mentioned earlier. We have SEO URLs enabled. URL is below.

Any help would be greatly appreciated.

Thanks,
Chad

(STILL IN DEVELOPMENT) http://www.onecraftymother.net

Re: [MOD] Facebook Like Button on Product Page

Posted: Tue Sep 07, 2010 11:47 pm
by DirtyJeeves
I guess it would help to add SEO Keywords. :laugh:

I got it figured out. Again, great script!

Re: [MOD] Facebook Like Button on Product Page

Posted: Wed Sep 08, 2010 1:38 am
by Chrissy Poo
DirtyJeeves wrote:I guess it would help to add SEO Keywords. :laugh:

I got it figured out. Again, great script!
Glad you got it sorted! Enjoy :)

Re: [MOD] Facebook Like Button on Product Page

Posted: Thu Sep 16, 2010 3:50 pm
by ifone_developer
Hi guyz,
Tanx for the code.. It works great for me.. But i have a small problem.
When i log in, and if i like a particular product, counter gets incremented by 1.
After that when i move to a new product, counter status is still 1.. It juz shows the same value as
it shows for previous product...
I guess its becuz it doesn't recognize my product id....
Here's my code..

<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=box_count&show_faces=true&width=450&action=like&font=arial&colorscheme=light&height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:65px;" allowTransparency="true"></iframe>
</td>
</tr>
</table>
</div>

Now what i want is , counter should be distinct for each product.
Can anyone plz tell me how to fix this??? Any ideas or code????
Tanx in advance

Re: [MOD] Facebook Like Button on Product Page

Posted: Sun Oct 03, 2010 11:35 am
by henryq30
I need help with this.
I added the code but in facebook is displayed "Product not finded". I actiivated SEO Url and added keyword to the products.

I apreciate any help.

My store is this: http://gedyan.com/new/index.php?route=common/home

Re: [MOD] Facebook Like Button on Product Page

Posted: Mon Oct 04, 2010 12:57 am
by henryq30
Ready, it is working.
I added the file .htaccess
with this text inside:

Code: Select all

# 1.To use URL Alias you need to be running apache with mod_rewrite enabled. 

# 2. In your opencart directory rename htaccess.txt to .htaccess.

# For any support issues please visit: http://www.opencart.com

# For security reasons, Option followsymlinks cannot be overridden.
#Options +FollowSymlinks
Options +SymLinksIfOwnerMatch

RewriteEngine On
RewriteBase / 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php?_route_=$1 [L,QSA]
Also I added SEO keywords to the products and categories

Re: [MOD] Facebook Like Button on Product Page

Posted: Thu Oct 14, 2010 4:17 am
by FabioSwiss
Does this MOD work on 1.3.2 version? Thanks!

Re: [MOD] Facebook Like Button on Product Page

Posted: Mon Nov 08, 2010 5:34 am
by CEOself
When I turn on the SEO URLs everything goes out the window. The product pages run to "Page Not Found". I have multiple SEO keywords in for each item. They are separated by commas. Any ideas of what I am doing wrong?

Re: [MOD] Facebook Like Button on Product Page

Posted: Mon Nov 15, 2010 4:19 am
by sketchi
The Facebook Like iframe works for me (running OpenCart 1.4.9.2) but the wrong product image is displayed in my Facebook feed. Any ideas how to fix?

Edit: I think what's needed is an Open Graph meta tag with the correct image path, so I've tried entering this into header.tpl, but I don't get it to display the thumb:

Code: Select all

<?php if ($thumb) { ?>
<meta property="og:image" content="<?php echo $thumb; ?>" />
<?php } ?>

Re: [MOD] Facebook Like Button on Product Page

Posted: Tue Nov 16, 2010 9:35 am
by leomazz
Thank you so much. I worked grate to me.
How can I change the colors of the text in de IFRAME?

Thanks!