my site http://goo.gl/aWQnd9
Opencart 1.5.5.1
I use this codes for dynamically get properly product images
<meta property="og:image" content="<?php echo $thumb; ?>"/>
or
<meta property="og:image" content="<?php echo _GET['image] ?>"/>
or
<meta property="og:image" content="<?= $_GET['image'] ?>" />
But with no result. Every time Fb shows store logo and proper title with proper description, but when I try to share product pages via addthis.com extension, fb shows store logo instead of product images.
What to do?
In your theme header.tpl add:
<!-- mod og:image para FB -->
<?php if ($thumb || $images) { ?>
<meta property="og:image" content="<?php echo $thumb; ?>">
<?php } else { ?>
<meta property="og:image" content="<?php echo $logo; ?>">
<?php } ?>
<!-- mod og:image para FB -->
In controller/common/header.php, just after: $this->data['name'] = $this->config->get('config_name'); add:
if (isset($this->request->get['product_id'])) {
$product_id = (int)$this->request->get['product_id'];
} else {
$product_id = 0;
}
$this->load->model('catalog/product');
$product_info = $this->model_catalog_product->getProduct($product_id);
$this->data['product_info'] = $product_info;
if ($product_info['image']) {
$this->data['thumb'] = $this->model_tool_image->resize($product_info['image'], $this->config->get('config_image_thumb_width'), $this->config->get('config_image_thumb_height'));
} else {
$this->data['thumb'] = '';
}
$this->data['images'] = array();