Joomla Extensions
IOS and Android
eCommerce Templates
Hosting + Joobi Apps + eCommerce Theme
Hi lovelies,
Just running into some problems with sharing to facebook and the images not showing up in posts or the "wrong" image showing up.
I am wondering if there is a way we can set the og:image to be the main product image for product pages and the Vendor Logo image for vendor pages? You have meta data and tags for each product and vendor. Is this a possibility or can you recommend a way to do this or a plug in (http://extensions.joomla.org/extensions/site-management/seo-a-metadata/open-graph) that will achieve this?
I found this thread (https://www.facebook.com/help/community/question/?id=10200708365214182) where the guy suggests the following, would something like this work?:
"In my Joomla template, this is how I do it:meta property="og:title" content="getTitle() ?>" />meta property="og:description" content="getDescription() ?>" />meta property="og:url" content="" />meta property="og:image" content="" />That $thumbnail variable is the article's thumbnail image. I initialize it like this:$thumbnail = 'images/thumbnails/thumbnail_' . $_GET['id'] . '.png';This is customized to my needs, you'll have to change it accordingly.
"
Michelle,
So this will be included in next release in 2 weeks. However if you want to implment it right now here is what to do:
1. For items:
edit the file : joobi/node/item/view/item_page_item.php
In the function:
protected function prepareTheme() {
add the following code:
$mainCredentialsC = WClass::get( 'main.credentials' ); $appID = $mainCredentialsC->loadFromType( 'facebook', 'username' ); if ( !empty($appID) ) { WPage::setMetaTag( 'og:title', $this->getValue( 'name' ) ); WPage::setMetaTag( 'og:image', WGlobals::get( 'imageURL' ) ); WPage::setMetaTag( 'og:type', strtolower( $this->itemTypeInfoO->name ) ); WPage::setMetaTag( 'og:url', JOOBI_SITE . WPage::routeURL( 'controller=catalog&task=show&eid=' . $this->pid, JOOBI_SITE, 'home' ) ); }
2. For vendors:
edit the file : joobi/node/output/form/image.php
after the line : $thumbnail_url = $myNewImageO->fileURL();
add the line : WGlobals::set( 'imageURL', $thumbnail_url );
edit the file : joobi/node/vendors/view/vendors_home_main.php
add the following function into the class
$mainCredentialsC = WClass::get( 'main.credentials' ); $appID = $mainCredentialsC->loadFromType( 'facebook', 'username' ); if ( !empty($appID) ) { //facebook special page tag WPage::setMetaTag( 'og:title', $this->getValue( 'name' ) ); WPage::setMetaTag( 'og:image', WGlobals::get( 'imageURL' ) ); WPage::setMetaTag( 'og:type', 'vendor' ); // the type of item WPage::setMetaTag( 'og:url', JOOBI_SITE . WPage::routeURL( 'controller=vendors&task=home&eid=' . $this->_vendid, JOOBI_SITE, 'home' ) ); }//endif
return true;
}//endfct
Keep in mind for this to work you need to have entered the Facebook AppID