Jump to content

Facebook-fan-knappe


Sarah1101

Recommended Posts

Jeg brugte denne her:
http://www.prestashop.com/forums/viewthread/26570/modules___development/twitter_plurk_and_facebook_widget

Og installerede så kun den til facebook...

Den placerer sig i den modulgruppe der hedder home-content...

Jeg har ændret lidt i filen, så den er i højre...

<?php


class Facebook extends Module
{
function __construct()
{
$this->name = 'facebook';
$this->tab = 'Advertisement';
$this->version = '0.1';
$this->displayName = $this->l('Facebook Widget');

parent::__construct();

if (!Configuration::get('FACEBOOK_ID'))
$this->warning = $this->l('You have not yet set your Facebook Widget code');
$this->description = $this->l('Integrate the Facebook Widget script into your shop');
$this->confirmUninstall = $this->l('Are you sure you want to delete your details ?');
}

function install()
{
if (!parent::install() OR !$this->registerHook('RightColumn'))
return false;
return true;
}

function uninstall()
{
if (!Configuration::deleteByName('FACEBOOK_ID') OR !parent::uninstall())
return false;
return true;
}

public function getContent()
{
$output = '

'.$this->displayName.'

';
if (Tools::isSubmit('submitFacebook') AND ($gai = Tools::getValue('facebook_id')))
{
$gai = htmlentities($gai, ENT_COMPAT, 'UTF-8');
Configuration::updateValue('facebook_ID', $gai);

}
return $output.$this->displayForm();
}

public function displayForm()
{
$output = '
<form action="'.$_SERVER['REQUEST_URI'].'" method="post">
'.$this->l('Settings').'
'.$this->l('Your code').'

<textarea name="facebook_id" cols="90" rows="10" />'.Tools::getValue('facebook_id', Configuration::get('FACEBOOK_ID')).'</textarea>

'.$this->l('Example:').'

 

translate_script.gif



<input type="submit" name="submitFacebook" value="'.$this->l('Update settings').'" class="button" />


</form>';
return $output;
}

function hookLeftColumn($params)
{
return $this->hookRightColumn($params);
}

function hookHome($params)
{
return $this->hookRightColumn($params);
}

function hookTop($params)
{
return $this->hookRightColumn($params);
}

function hookRightColumn($params)
{
$output = html_entity_decode(Configuration::get('FACEBOOK_ID'), ENT_COMPAT, 'UTF-8');
return $output;
}

}
?>
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...