News:

Support the VirtueMart project and become a member

Main Menu

Wrong image on facebook share

Started by mircot80, March 30, 2013, 11:55:51 AM

Previous topic - Next topic

mircot80

Hi,
I put facebook share and facebook like in virtuemart product but always it takes wrong picture.
This is the changes that I did:

1) At the beginning of the file: /templates/template1/index.php
I insert the following code:

<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/it_IT/all.js#xfbml=1&appId=1111111111111"; (with my id)
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

2) At the beginning of this file: components/com_virtuemart/views/productdetails/tmpl/default.php
I insert the following code:

<html>
   <head>
   <?php
   $og_type = 'article';
   $og_url = JURI::current();
   $og_image =  JRoute::_(JURI::base().$this->product->images[0]->file_url);
   $og_desc = $this->product->product_s_desc;
   $og_title = $this->product->product_name;
   
   $app =& JFactory::getApplication();
   $og_sitename = $app->getCfg('sitename');
   
   $doc = JFactory::getDocument();
   $doc->addCustomTag('<meta property="og:type" content="article"/>');
   $doc->addCustomTag('<meta property="og:url" content="'.$og_url.'"/>');
   $doc->addCustomTag('<meta property="og:site_name" content="'.$og_sitename.'"/>');
   $doc->addCustomTag('<meta property="og:image" content="'.$og_image.'"/>');
   $doc->addCustomTag('<meta property="og:description" content="'.$og_desc.'"/>');
   $doc->addCustomTag('<meta property="og:title" content="'.$og_title.'"/>');
   ?>
   </head>
</html>

3) And in a point that I choice I insert:

<fb:like send="true" width="450" show_faces="false"></fb:like>

This is a product of my site:
http://www.trevisoassistenza.it/shop/modem/modem-gsm-dual-band-seriale-digicom-8d0114-detail.html

With Firebug I find this tag (it seems correct):
<meta content="http://www.trevisoassistenza.it/images/stories/virtuemart/product/8d0114.jpg" property="og:image">
But the image is always wrong.

With this open graph test: https://developers.facebook.com/tools/debug/
It tell me:
Meta Tags In Body:   Your page has meta tags in the body instead of the head. This may be because your HTML was malformed and they fell lower in the parse tree.
Please fix this in order for the tags to be usable.

And

Like Button Tag Missing:   og:image is missing. The og:image meta tag is necessary for Facebook to render a News Feed story that generates a high click-through rate.

Where am I doing wrong?
Thanks
Mirco

mircot80

My version of joomla is 2.5.9 and virtuemart 2.0.20b
Someone can help me?
Thanks

mircot80

#2
Help me please......


Mod edit:  impatient bump message removed. Read  http://forum.virtuemart.net/index.php?board=114.0

mircot80

Is there a Facebook open graph forum?
Thanks
Mirco

jenkinhill

No idea. We have nothing to do with Facebook. Just issues with VirtueMart itself. See http://forum.virtuemart.net/index.php?topic=108212
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

mircot80