I'm trying to figure out how to add the Facebook Like button into my VirtueMart 2.0 product pages. I'm using MyFolio template on Joomla 1.7
I added this code into my VM template product override file where I want my social icons to display:
- Code: Select all
$cur_url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
<gavern:social><div id="gkSocialAPI"></gavern:social>
<gavern:social><fb:like href="<?php echo $cur_url; ?>" GK_FB_LIKE_SETTINGS></fb:like></gavern:social>
<gavern:social><g:plusone GK_GOOGLE_PLUS_SETTINGS callback="<?php echo $cur_url; ?>"></g:plusone></gavern:social>
<gavern:social><a href="http://twitter.com/share" class="twitter-share-button" data-text="<?php echo $this->item->title; ?>" data-url="<?php $cur_url; ?>" GK_TWEET_BTN_SETTINGS>Tweet</a></gavern:social>
<gavern:social><a class="DiggThisButton GK_DIGG_SETTINGS" href="<?php echo $cur_url; ?>"></a></gavern:social>
<gavern:social><a href="http://www.delicious.com/save" onclick="window.open('http://www.delicious.com/save?v=5&noui&jump=close&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title), 'delicious','toolbar=no,width=550,height=550'); return false;" class="deliciousBtn" title="<?php echo JText::_('TPL_GK_LANG_DELICIOUS_TITLE'); ?>"></a></gavern:social>
<gavern:social><a href="http://www.instapaper.com/hello2?url=<?php echo urlencode($cur_url); ?>&title=<?php echo urlencode($this->item->title); ?>" class="instapaperBtn" title="<?php echo JText::_('TPL_GK_LANG_INSTAPAPER_TITLE'); ?>"></a></gavern:social>
<gavern:social><div class="clr"></div></div></gavern:social>
I can see the icons, but when I try it, I get an "error" message, and nothing appears on my Facebook profile.
I tried also with this code, to generate a VM url (with of course the domain name of the website which I had to hide):
- Code: Select all
$menu = & JSite::getMenu();
$item = $menu->getActive();
$id=$item->itemid;
jimport('joomla.language.helper');
$languages = JLanguageHelper::getLanguages('lang_code');
$lang_code = JFactory::getLanguage()->getTag();
$lang_code = 'en-US';
$sef = $languages[$lang_code]->sef;
$siteurl = 'http://----------------/index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id='.$this->product->virtuemart_product_id.$id;
<gavern:social><div id="gkSocialAPI"></gavern:social>
<gavern:social><fb:like href="<?php echo $siteurl; ?>" GK_FB_LIKE_SETTINGS></fb:like></gavern:social>
... but again, it gives me an error, but this way at least the "like" url is displayed on my facebook account, which maybe is a good sign
Any suggestion about how to make this work?
Thanks!