Jump to content


This topic is now archived and is closed to further replies.


Facebook like button on new product page can not pick up correct item image.

Recommended Posts

HI Everyone,


My store is osc 2.3.1, Below is my checkpoint, record what i had done after each modify on the store up to now. And it is procees in order.


1) Clean Install AppServ 2.5.9 & osCommerce 2.3.1.

2) Create Account email Confirmation OK.

3) Admin email to Customer OK.

4) Contact us email OK.

5) Forget password email OK.

6) Change Shipping Method name to HongKong Post OK.

7) Install Paypal Website Payments Standard OK.

8) Add-on Login Box Module OK.

9) Remove Catalog link OK.

10) Add-on Discount Coupon Code Added OK.

11) Newletter Manager OK.

12) Modify /includes/classes/order.php to solved customer view order history.

13) Add-on Paypal Itemized Description OK.

14) Add-on CKEditor osc 2.3.1 OK.

15) Add-on Store Mode (Open Closed Maintenance) v1.3 for osc 2.3.1 OK.

16) MATC V2.3.4 OK.

17) Add Items on live website.

18) Add Condition of use.

19) Add Privacy Notes.

20) Add item 00013/00014/00015.

21) Add Shipping & Return.

22) Add 2 DVR item in catalog.

23) Transfer whole osc store from Appserv to Xampp, Everything works fine.

24) Add-on Modular Front page OK., removed duplicate line.

25) Add-on Tab Menu Section (TMS) OK.

26) Modify product_info.php

27) Add google+1 button and move social bookmark to product_info.php, social bookmark icon need more time to move around.

28) Social bookmark icons are place perfectly.

29) Add Subcategory banner.

30) Add-on Simple Product Short Description. OK

31) Enlarge Product Main Image OK

32) Add-on Tab Menu System OK.

33) Overwrite Add-on Tab Menu System included TMS folder.

34) Restore Iphone 4 case Images.

35) Turn on SSL on configure.php.

36) https://www.veegostore.com works OK.

37) Remove all unsecured link to make https:// work perfectly.

38) Run every page on veegostore.com and make sure all page sercured.

39) Add-on Quickly Update Product Stock OK.

40) Modify product_info.php to display product info my own way.

41) Modify product_info.php to display also bought info to the bottom of page.

42) Product info content require to replace.

43) Add Certificate icon at the bottom of the page.

44) Remove Add command to your order @ shopping_payment.php

45) Add fling game controller product.

46) Add Iphone care reset of other 3 style.

47) Update checkout_success.php

48) Try to merge the reviews and write reviews into product_info page, not complete.

49) Make Social icon to next line.

50) Add buy now button at new product page.

51) Modify new product page, rearrange display info.

52) Modify Subcategory page, rearrange display info to match new product page.

53) Add back button at shopping_cart page and return to index.php

54) Add back button at checkout_shipping and return to shopping_cart page.

55) Move models # from product_info.php to next line.

56) Addon Shop by price OK.

57) Addon generic box OK.

58) Create new mouse / keyboard banner.

59) Add PSVITA product info.

60) Modify product_info page, we previous merge review and write review into the page, but require warning user to login, so add and Sign button.

61) Add-on Facebook Like button at the new product page, thumbnail need to correct.


Sorry for a long list, I hope the above give you the idea of my store. Now I m trying to add a facebook like button under each product show on new product page, it works find except the thumbnail image didn't pick up the correct image.


Please visit my page https://www.veegostore.com/, you can click on the facebook like button, when click, some like button will pick up all correct info except a product image is incorrect, and some like button even have no image.


I try to search the solution and one page teach us to add some code on template_top.php to add <meta> info, used for facebook tool to pick up the correct info, include product name, like description and images.


Meta script on template_top is

<?php $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); $product_info = tep_db_fetch_array($product_info_query);?>

<meta property="fb:app_id" content="my_id" />

<meta property="og:site_name" content="<?php echo STORE_NAME;?>" />

<meta property="og:url" content="<?php echo 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ;?>" >

<meta property="og:image" content="<?php print HTTP_SERVER . DIR_WS_HTTP_CATALOG . DIR_WS_IMAGES . $product_info['products_image']; ?>" />

<meta property="og:title" content="<?php echo $product_info['products_name']; ?>" />

<meta property="og:description" content="<?php echo preg_replace('/[^a-zA-Z0-9\s]/','',preg_replace('/\s+/',' ',preg_replace("/<br>/", "",strip_tags($product_info['products_description'])))); ?>" />

<meta property="og:type" content="product" />


The facebook script on template_top is

<div id="fb-root"></div>

<script>(function(d, s, id) {

var js, fjs = d.getElementsByTagName(s)[0];

if (d.getElementById(id)) return;

js = d.createElement(s); js.id = id;

js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";

fjs.parentNode.insertBefore(js, fjs);

}(document, 'script', 'facebook-jssdk'));</script>


My facebook like code on new product page is

<div class="fb-like" data-href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '" data-send="false" data-layout="button_count" data-width="60" data-show-faces="false"></div>


Current situation is, when i click the like button on new product page, the store pop up a confirmed page (from facebook), inside the popup, the product title, description and link are correct, but the image it pick up is incorrect. So when it is done, the info show on the fackbook will have a incorrect image. And this is what i wanta correct.


Remark the fb:app_id" content="my_id", my_id has been replace by a correct id. but it seem no help.


Does anyone know what to do?!

Share this post

Link to post
Share on other sites

HI Juto,


Thank for your reply, I heard from other thread that their facebook button suddenly disappear on their product info page because facebook have changed the code.

My store also have the facebook icon on indvidual product info page, but they are still there and work fine.


My problem still remain, is the any idea?


By the way, about the checkpoint 12), Sometime during the modification on the store the delivery_date from database being fail when page is loading, so I just deselect the delivery_date from the tep_db_query for $order_query veriabe.

Share this post

Link to post
Share on other sites

Hi Juto,


I read the page, but I may missing something!? Still not fix.


One thing happening today.


I was testing my store webpage at night with my home notebook. But when i testing the facebook like button @ office PC on next day. All facebook like appear a confirm hyperlink after click on it, and it pop up a box show all correct infos included the product image. I test it for at least 5-6 different items and they got all correct. Then i think i fix my problem without doing anything. But unfortunely during afternoon. I retest those facebook like, no confirm hyperlink appear, an facebook share the link with incorrect image again.

I haven't change any code. I wonder Y facebook like button act like that.?!

Share this post

Link to post
Share on other sites