Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

<link rel="img_src" for facebook share


acidvertigo

Recommended Posts

Hello,

 

I'want to control the thumbnail that facebook show when a user share a link on my site.

 

Following this directive: Facebook Meta tags

 

I need that in the meta tag:

<link rel="image_src" href="http://www.example.com/catalog/images/product_picture.jpg" />

 

in my product_info.php page points directly to the image of my product generated

 

is this possible?

Link to comment
Share on other sites

  • 9 months later...

Hi

 

I realise that this thread is very old; however it is the only one I found in a Google search so I will post the solution here.

 

I have installed Social Bookmarks from the code of osCv2.3 at Github and the wrong image was displayed on Facebook.

 

The solution is to add a link to the default image to the Product_info Header between <head> and </head> (or template top in v2.3)

 

<link rel="image_src" href="<?php echo tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) ?>" >

 

Hope this helps someone who is searching for the answer in the future.

 

Regards

 

Ken

Link to comment
Share on other sites

Hi

 

I realise that this thread is very old; however it is the only one I found in a Google search so I will post the solution here.

 

I have installed Social Bookmarks from the code of osCv2.3 at Github and the wrong image was displayed on Facebook.

 

The solution is to add a link to the default image to the Product_info Header between <head> and </head> (or template top in v2.3)

 

<link rel="image_src" href="<?php echo tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) ?>" >

 

Hope this helps someone who is searching for the answer in the future.

 

Regards

 

Ken

 

 

Thanks Ken you are helping to me on the way. In the source code the path to my product images shows up in the <link rel="image_src" link but this stops wiith /images and not absoltue link to my product is found. How can I integrate the Product ID in this tag so the absolute link will be present for FB?

 

Regards,

 

John

Link to comment
Share on other sites

  • 2 months later...

Thanks Ken you are helping to me on the way. In the source code the path to my product images shows up in the <link rel="image_src" link but this stops wiith /images and not absoltue link to my product is found. How can I integrate the Product ID in this tag so the absolute link will be present for FB?

 

Regards,

 

John

 

 

<link rel="image_src" href="<?php echo tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) ?>" >

 

I think the problem lies in $product_info['products_image'] is not defined yet in the head section of the page. Later in the page the sql is asserted to define it. the question is How to get $product_info['products_image'] defined in the header section?

 

Any Ideas on how to get this done. I have other $product_info things working in the head section.

Link to comment
Share on other sites

  • 2 weeks later...

<link rel="image_src" href="<?php echo tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) ?>" >

 

I think the problem lies in $product_info['products_image'] is not defined yet in the head section of the page. Later in the page the sql is asserted to define it. the question is How to get $product_info['products_image'] defined in the header section?

 

Any Ideas on how to get this done. I have other $product_info things working in the head section.

 

Hi,

 

Anyone found a solution for this? Thnaks.

Link to comment
Share on other sites

Hi,

 

Anyone found a solution for this? Thnaks.

 

 

osC 2.3.1...

 

works for me

My store is currently running Phoenix 1.0.3.0

I'm currently working on 1.0.7.2 and hope to get it live before 1.0.8.0 arrives (maybe 🙄 )

I used to have a list of add-ons here but I've found that with the ones that supporters of Phoenix get any other add-ons are not really neccessary

Link to comment
Share on other sites

  • 1 month later...

Still looking for a fix for this.

Surely it cant be that difficult.

I have the share to facebook working, but it does not add the prodcut image from that page,

facebook adds the (gives a choice) of the images in colunm right and colnum left and footer, but not the product_info.

 

Any help would be great

Piperman

Link to comment
Share on other sites

  • 2 months later...

<link rel="image_src" href="<?php echo tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) ?>" >

 

I think the problem lies in $product_info['products_image'] is not defined yet in the head section of the page. Later in the page the sql is asserted to define it. the question is How to get $product_info['products_image'] defined in the header section?

 

Any Ideas on how to get this done. I have other $product_info things working in the head section.

 

Anyone solved the problem how to use $product_info['products_image'] in header section?

Please help me with this.

Link to comment
Share on other sites

  • 1 month later...

OK, I found a solution, but it will require you to be running the STS contribution.

 

1. Put this in includes/modules/sts_inc/product_info.php:

 

$sts->template['image_src'] = '<link rel="image_src" href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '">';

 

(make sure product_info.php has the appropriate $product_info query and that the above code is underneath it)

 

2. Put this in the <head> of includes/sts_templates/product_info.php.html:

 

$image_src$

 

The output of link rel should now have the product image and should display once Liked.

 

Confirmed working on oSC 2.2 rc2a.

Link to comment
Share on other sites

Try this in your head section:

 

<?

$product_pic_query = tep_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");

$product_pic = tep_db_fetch_array($product_pic_query);

 

if (tep_not_null($product_pic['products_image'])) {

$products_image = '<link rel="image_src" href="' . tep_href_link(DIR_WS_IMAGES . $product_pic['products_image']) . '">';

} else {

$products_image = '';

}

?>

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...