Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Facebook Share og:image multiple thumbnail images on FB post


98stratos

Recommended Posts

Posted

Ok......here is the line of code from my template_top.php file that includes the thumbnail that is included on my FB share....

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

Now this meta tag only includes one image once the "share" button is clicked.....my question is this..

 

How can I specify in this line of code to have the "share" post the additional images included on that specific product page so that the thumbnails will be included on the FB post?

 

thoughts about this anyone?

Posted

As far as I recall, you can have more than 1 instance of og:image - so...

 

Iterate through the large product images, and for each one, do similar as the code you have posted.

 

However, that code (I don't know where it comes from, is it in a template you're using?) is not the way to do it.  This is cleaner:

 

<meta property="og:image" content="<?php echo tep_href_link(DIR_WS_IMAGES . $product_info['products_image'], '', 'NONSSL', false, false); ?>" />
Posted

Thanks Burt for the response, the line of code I provided was actually found on another post here and once implemented into the template_top.php file it began working.....I changed that line to the line of code that you provided and I am happy to say that it is still working as it should. 

 

With that being said, are you telling me that I can add the line of code you provided multiple times?  This will allow multiple images to be scraped by FB and included in a share from my store?

 

Will test and see and post back........

 

thanks again....

 

UPDATE:

 

After adding the same line more than once, it pulled the same image twice......not any of the other ones that I have on the same product_info page.......

Posted

are you telling me that I can add the line of code you provided multiple times

 

No.

You need to grab the image locations from the table products_images and output each in turn using an og:image call.

 

I'd suggest that you rip out all this OG stuff you've found, and instead download addon 8864.

Inside that addon, you will find a HT module called ht_product_opengraph (and obviously it's accompanying language file).

 

Upload just those two files, and then turn it on in your admin area.  

Admin > Modules > Header Tags > {install}

 

Once done, you are on a firm foundation, and further assistance can be provided.

Posted

Burt,

 

  I appreciate the specific instructions to install the particular module needed to accomplish what I am trying to do.  It works great!

 

  All the images for a specific product are larger than 200x200 so the scraper will read them from FB......but it is still not allowing multiple thumbnails to be posted when I share a specific product from the store....

 

You had said in your earlier post...."further assistance can be provided"     Have I not done something yet?

 

And thanks again for the advice......

Posted

Burt,

 

  Am hoping you can share some advice on this issue I have found.  I installed the contrib "Product Tabs" and now the description of the product is not showing from the "product open graph meta tags" module you advised me to install.  I have used the FB debugger tool to confirm this and by also viewing the source of a product does not include the description, so this is now a issue for me.

 

Here is the original code from the "Product Tabs" contrib:

<?php
/*
  $Id$

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2010 osCommerce

  Released under the GNU General Public License
*/
?>

<script type="text/javascript">
  $(function() {
      $( "#tabs" ).tabs();
  });
</script>
<div id="tabs">
  <ul>
      <li><a href="#tabs-0"><?php echo TEXT_TAB_DESCRIPTION; ?></a></li>
<?php
// Tab 1
  if ($product_info['products_tab_1'] > '') {
?>
      <li><a href="#tabs-1"><?php echo PRODUCT_TABS_TAB_1; ?></a></li>
<?php } ?>
<?php
// Ttab 2
  if ($product_info['products_tab_2'] > '') {
?>
      <li><a href="#tabs-2"><?php echo PRODUCT_TABS_TAB_2; ?></a></li>
<?php } ?>
<?php
// Tab 3
  if ($product_info['products_tab_3'] > '') {
?>
      <li><a href="#tabs-3"><?php echo PRODUCT_TABS_TAB_3; ?></a></li>
<?php } ?>
<?php
// Tab 4
  if ($product_info['products_tab_4'] > '') {
?>
      <li><a href="#tabs-4"><?php echo PRODUCT_TABS_TAB_4; ?></a></li>
<?php } ?>
<?php
// Tab 5
  if ($product_info['products_tab_5'] > '') {
?>
      <li><a href="#tabs-5"><?php echo PRODUCT_TABS_TAB_5; ?></a></li>
<?php } ?>
<?php
// Review Tab
  if (PRODUCT_TABS_REVIEWS_TAB == 'True') {
?>
      <li><a href="#tabs-6"><?php echo TEXT_TAB_REVIEWS; ?></a></li>
<?php } ?>
<?php
// Ask a Question Tab
  if (PRODUCT_TABS_QUESTION_TAB == 'True') {
?>
      <li><a href="#tabs-7"><?php echo TEXT_TAB_ASK_A_QUESTION; ?></a></li>
<?php } ?>
<?php
// Tell a Friend Tab
  if (PRODUCT_TABS_FRIEND_TAB == 'True') {
?>
      <li><a href="#tabs-8"><?php echo TEXT_TAB_TELL_A_FRIEND; ?></a></li>
<?php } ?>
    </ul>
    <div id="tabs-0">
<?php
  echo stripslashes($product_info['products_description']);
?>
                  </div>
<?php
// Tab 1
  if ($product_info['products_tab_1'] > '') {
?>
    <div id="tabs-1">
      <br>
<?php
    echo stripslashes ($product_info['products_tab_1']);
?>
    </div>
<?php } ?>
<?php
// Tab 2
  if ($product_info['products_tab_2'] > '') {
?>
    <div id="tabs-2">
      <br>
<?php
    echo stripslashes ($product_info['products_tab_2']);
?>
    </div>
<?php } ?>
<?php
// Tab 3
  if ($product_info['products_tab_3'] > '') {
?>
    <div id="tabs-3">
      <br>
<?php
    echo stripslashes ($product_info['products_tab_3']);
?>
    </div>
<?php } ?>
<?php
// Tab 4
  if ($product_info['products_tab_4'] > '') {
?>
    <div id="tabs-4">
      <br>
<?php
    echo stripslashes ($product_info['products_tab_4']);
?>
    </div>
<?php } ?>
<?php
// Tab 5
  if ($product_info['products_tab_5'] > '') {
?>
    <div id="tabs-5">
      <br>
<?php
    echo stripslashes ($product_info['products_tab_5']);
?>
    </div>
<?php } ?>
<?php
// Review Tab
    if (PRODUCT_TABS_REVIEWS_TAB == 'True') {
    	echo '    <div id="tabs-6">';
      include( DIR_WS_MODULES . FILENAME_PRODUCT_REVIEWS );
    	echo '    </div><div style="clear: both;"></div>';
    }
?>
<?php
// Ask a Question Tab
    if (PRODUCT_TABS_QUESTION_TAB == 'True') {
    	echo '    <div id="tabs-7">';
      include( DIR_WS_MODULES . FILENAME_ASK_A_QUESTION );
    	echo '    </div><div style="clear: both;"></div>';
    }
?>
<?php
// Tell a Friend Tab
    if (PRODUCT_TABS_FRIEND_TAB == 'True') {
    	echo '    <div id="tabs-8">';
      include( DIR_WS_MODULES . FILENAME_TELL_A_FRIEND );
    	echo '    </div><div style="clear: both;"></div>';
    }
?>
  </div>

And here is the code modified by me to suit my products......

<?php
/*
  $Id$

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2010 osCommerce

  Released under the GNU General Public License
*/
?>
<table width="450" border="0" cellspacing="0" cellpadding="0">
<tr>
    <td valign="top">
<script type="text/javascript">
  $(function() {
      $( "#tabs" ).tabs();
  });
</script>





<div id="tabs">
  <ul>
      <li>      </li>
<?php
// Tab 1
  if ($product_info['products_tab_1'] > '') {
?>
      <li><a href="#tabs-1"><?php echo PRODUCT_TABS_TAB_1; ?></a></li>
<?php } ?>
<?php
// Ttab 2
  if ($product_info['products_tab_2'] > '') {
?>
      <li><a href="#tabs-2"><?php echo PRODUCT_TABS_TAB_2; ?></a></li>
<?php } ?>
<?php
// Tab 3
  if ($product_info['products_tab_3'] > '') {
?>
      <li><a href="#tabs-3"><?php echo PRODUCT_TABS_TAB_3; ?></a></li>
<?php } ?>
<?php
// Tab 4
  if ($product_info['products_tab_4'] > '') {
?>
      <li><a href="#tabs-4"><?php echo PRODUCT_TABS_TAB_4; ?></a></li>
<?php } ?>
<?php
// Tab 5
  if ($product_info['products_tab_5'] > '') {
?>
      <li><a href="#tabs-5"><?php echo PRODUCT_TABS_TAB_5; ?></a></li>
<?php } ?>
<?php
// Review Tab
  if (PRODUCT_TABS_REVIEWS_TAB == 'True') {
?>
      <li><a href="#tabs-6"><?php echo TEXT_TAB_REVIEWS; ?></a></li>
<?php } ?>
<?php
// Ask a Question Tab
  if (PRODUCT_TABS_QUESTION_TAB == 'True') {
?>
      <li><a href="#tabs-7"><?php echo TEXT_TAB_ASK_A_QUESTION; ?></a></li>
<?php } ?>
<?php
// Tell a Friend Tab
  if (PRODUCT_TABS_FRIEND_TAB == 'True') {
?>
      <li><a href="#tabs-8"><?php echo TEXT_TAB_TELL_A_FRIEND; ?></a></li>
<?php } ?>
    </ul>
    <div id="tabs-1">
<?php
  echo stripslashes($product_info['products_description']);
?>
                  </div>
<?php
// Tab 1
  if ($product_info['products_tab_1'] > '') {
?>
    <div id="tabs-1">
      <br>
<?php
    echo stripslashes ($product_info['products_tab_1']);
?>
    </div>
<?php } ?>
<?php
// Tab 2
  if ($product_info['products_tab_2'] > '') {
?>
    <div id="tabs-2">
      <br>
<?php
    echo stripslashes ($product_info['products_tab_2']);
?>
    </div>
<?php } ?>
<?php
// Tab 3
  if ($product_info['products_tab_3'] > '') {
?>
    <div id="tabs-3">
      <br>
<?php
    echo stripslashes ($product_info['products_tab_3']);
?>
    </div>
<?php } ?>
<?php
// Tab 4
  if ($product_info['products_tab_4'] > '') {
?>
    <div id="tabs-4">
      <br>
<?php
    echo stripslashes ($product_info['products_tab_4']);
?>
    </div>
<?php } ?>
<?php
// Tab 5
  if ($product_info['products_tab_5'] > '') {
?>
    <div id="tabs-5">
      <br>
<?php
    echo stripslashes ($product_info['products_tab_5']);
?>
    </div>
<?php } ?>
<?php
// Review Tab
    if (PRODUCT_TABS_REVIEWS_TAB == 'True') {
    	echo '    <div id="tabs-6">';
      include( DIR_WS_MODULES . FILENAME_PRODUCT_REVIEWS );
    	echo '    </div><div style="clear: both;"></div>';
    }
?>
<?php
// Ask a Question Tab
    if (PRODUCT_TABS_QUESTION_TAB == 'True') {
    	echo '    <div id="tabs-7">';
      include( DIR_WS_MODULES . FILENAME_ASK_A_QUESTION );
    	echo '    </div><div style="clear: both;"></div>';
    }
?>
<?php
// Tell a Friend Tab
    if (PRODUCT_TABS_FRIEND_TAB == 'True') {
    	echo '    <div id="tabs-8">';
      include( DIR_WS_MODULES . FILENAME_TELL_A_FRIEND );
    	echo '    </div><div style="clear: both;"></div>';
    }
?>
  </div>
  </td>
</tr>
</table>

Would you look over and advise?  What do you think?

Archived

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

×
×
  • Create New...