Community Forums

[MOD] Facebook Like Button on Product Page

Free manual modifications can be contributed here. Modifications are manual snippets of code that are pasted into the forums for others to use.

[MOD] Facebook Like Button on Product Page

Postby Chrissy Poo » Mon Jul 19, 2010 3:19 am

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']); ?>&amp;layout=standard&amp;show_faces=false&amp;width=280&amp;action=like&amp;colorscheme=light&amp;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 :)
10% Discount on all Shared and Reseller Hosting Packages at Vidahost.com

Discount Code: DISCOUNT10
Chrissy Poo
 
Posts: 166
Joined: Mon Jun 29, 2009 12:48 am
Location: UK

Re: [MOD] Facebook Like Button on Product Page

Postby Signserve » Wed Jul 21, 2010 9:33 am

Can confirm that this is an awesome script, just installed it and tested it on our store! :)

Thumbs up!
Signserve
 
Posts: 14
Joined: Mon Jul 19, 2010 12:27 pm

Re: [MOD] Facebook Like Button on Product Page

Postby Chrissy Poo » Wed Jul 21, 2010 11:08 am

Signserve wrote:Can confirm that this is an awesome script, just installed it and tested it on our store! :)

Thumbs up!


Glad you like :)
10% Discount on all Shared and Reseller Hosting Packages at Vidahost.com

Discount Code: DISCOUNT10
Chrissy Poo
 
Posts: 166
Joined: Mon Jun 29, 2009 12:48 am
Location: UK

Re: [MOD] Facebook Like Button on Product Page

Postby musicofthehart » Thu Jul 22, 2010 7:03 pm

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
musicofthehart
 
Posts: 31
Joined: Fri Jul 16, 2010 7:42 am

Re: [MOD] Facebook Like Button on Product Page

Postby Chrissy Poo » Thu Jul 22, 2010 10:09 pm

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?
10% Discount on all Shared and Reseller Hosting Packages at Vidahost.com

Discount Code: DISCOUNT10
Chrissy Poo
 
Posts: 166
Joined: Mon Jun 29, 2009 12:48 am
Location: UK

Re: [MOD] Facebook Like Button on Product Page

Postby musicofthehart » Fri Jul 23, 2010 3:55 am

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.
musicofthehart
 
Posts: 31
Joined: Fri Jul 16, 2010 7:42 am

Re: [MOD] Facebook Like Button on Product Page

Postby musicofthehart » Fri Jul 23, 2010 5:41 am

All better now, the SEO URLS are enabled, and your script works great. Thank you very much for this!
musicofthehart
 
Posts: 31
Joined: Fri Jul 16, 2010 7:42 am

Re: [MOD] Facebook Like Button on Product Page

Postby Chrissy Poo » Fri Jul 23, 2010 5:35 pm

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 :)
10% Discount on all Shared and Reseller Hosting Packages at Vidahost.com

Discount Code: DISCOUNT10
Chrissy Poo
 
Posts: 166
Joined: Mon Jun 29, 2009 12:48 am
Location: UK

Re: [MOD] Facebook Like Button on Product Page

Postby felizone » Mon Aug 30, 2010 3:21 am

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
felizone
 
Posts: 59
Joined: Thu Apr 08, 2010 7:28 am

Re: [MOD] Facebook Like Button on Product Page

Postby Chrissy Poo » Mon Aug 30, 2010 10:09 am

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?
10% Discount on all Shared and Reseller Hosting Packages at Vidahost.com

Discount Code: DISCOUNT10
Chrissy Poo
 
Posts: 166
Joined: Mon Jun 29, 2009 12:48 am
Location: UK

Re: [MOD] Facebook Like Button on Product Page

Postby DirtyJeeves » Tue Sep 07, 2010 3:22 pm

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
DirtyJeeves
 
Posts: 2
Joined: Tue Sep 07, 2010 3:17 pm

Re: [MOD] Facebook Like Button on Product Page

Postby DirtyJeeves » Tue Sep 07, 2010 3:47 pm

I guess it would help to add SEO Keywords. :laugh:

I got it figured out. Again, great script!
DirtyJeeves
 
Posts: 2
Joined: Tue Sep 07, 2010 3:17 pm

Re: [MOD] Facebook Like Button on Product Page

Postby Chrissy Poo » Tue Sep 07, 2010 5:38 pm

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 :)
10% Discount on all Shared and Reseller Hosting Packages at Vidahost.com

Discount Code: DISCOUNT10
Chrissy Poo
 
Posts: 166
Joined: Mon Jun 29, 2009 12:48 am
Location: UK

Re: [MOD] Facebook Like Button on Product Page

Postby ifone_developer » Thu Sep 16, 2010 7:50 am

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']); ?>&amp;layout=box_count&amp;show_faces=true&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;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
ifone_developer
 
Posts: 28
Joined: Sat Jul 10, 2010 10:48 am

Re: [MOD] Facebook Like Button on Product Page

Postby henryq30 » Sun Oct 03, 2010 3:35 am

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
henryq30
 
Posts: 2
Joined: Sun Oct 03, 2010 3:20 am

Re: [MOD] Facebook Like Button on Product Page

Postby henryq30 » Sun Oct 03, 2010 4:57 pm

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
henryq30
 
Posts: 2
Joined: Sun Oct 03, 2010 3:20 am

Re: [MOD] Facebook Like Button on Product Page

Postby FabioSwiss » Wed Oct 13, 2010 8:17 pm

Does this MOD work on 1.3.2 version? Thanks!
FabioSwiss
 
Posts: 18
Joined: Thu Sep 16, 2010 8:06 pm

Re: [MOD] Facebook Like Button on Product Page

Postby CEOself » Sun Nov 07, 2010 9:34 pm

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?
CEOself
 
Posts: 15
Joined: Tue Dec 29, 2009 7:05 am

Re: [MOD] Facebook Like Button on Product Page

Postby sketchi » Sun Nov 14, 2010 8:19 pm

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 } ?>
User avatar
sketchi
 
Posts: 32
Joined: Wed Sep 22, 2010 9:04 am

Re: [MOD] Facebook Like Button on Product Page

Postby leomazz » Tue Nov 16, 2010 1:35 am

Thank you so much. I worked grate to me.
How can I change the colors of the text in de IFRAME?

Thanks!
Mamma mia! Donde me meti...?
leomazz
 
Posts: 41
Joined: Mon Jan 04, 2010 2:45 am
Location: Banfield - Buenos Aires

Next

Return to Modifications

Who is online

Users browsing this forum: No registered users and 7 guests

Hosted by Arvixe Web Hosting