This commit is contained in:
TMMeilleur
2013-10-31 15:51:25 +02:00
parent ff2954b1d2
commit 68a98b29a6
141 changed files with 8112 additions and 4912 deletions
+188
View File
@@ -0,0 +1,188 @@
<?php
if (!defined('_PS_VERSION_')) {
exit;
}
class AddShareThis extends Module
{
function __construct()
{
$this->name = 'addsharethis';
$this->author = 'Custom';
$this->tab = 'front_office_features';
$this->need_instance = 0;
$this->_directory = dirname(__FILE__);
parent::__construct();
$this->displayName = $this->l('Add Sharethis');
$this->description = $this->l('Display social count button on the home page');
}
public function install()
{
Configuration::updateValue('CONF_ROW', 'ea22d519-9f98-4018-99a9-5b5f1b100fa8');
Configuration::updateValue('ADDTHISSHARE_TWITTER',1);
Configuration::updateValue('ADDTHISSHARE_GOOGLE',1);
Configuration::updateValue('ADDTHISSHARE_PINTEREST',1);
Configuration::updateValue('ADDTHISSHARE_FACEBOOK',1);
if (!parent::install() OR
!$this->registerHook('Extraright') OR
!$this->registerHook('header'))
return false;
return true;
}
public function uninstall()
{
if (!parent::uninstall() OR
!Configuration::deleteByName('CONF_ROW') OR
!Configuration::deleteByName('ADDTHISSHARE_TWITTER') OR
!Configuration::deleteByName('ADDTHISSHARE_GOOGLE') OR
!Configuration::deleteByName('ADDTHISSHARE_PINTEREST') OR
!Configuration::deleteByName('ADDTHISSHARE_FACEBOOK') OR
!$this->unregisterHook('Extraright') OR
!$this->unregisterHook('header'))
return false;
else return true;
}
public function getContent()
{
$this->_html .= '<h2>'.$this->displayName.'<span style=" float:right;"></span></h2><div class="clear"></div>';
if (isset($_POST['submitCog'])) $this->updateCog();
if (Tools::isSubmit('submitCog'))
{
$conf_row = Tools::getValue('conf_row');
Configuration::updateValue('CONF_ROW', $conf_row);
}
$this->_html .= '
<fieldset class="space" id="cogField">
<legend><img src="'.$this->_path.'logo.png" alt="" title="" /> '.$this->l('Configuration').'</legend>
<form id="cogForm" name="cogForm" method="post" action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'">
<br/>
<em>'.$this->l('(Key in your account statistic http://sharethis.com)').'</em>
<div class="clearfix"></div><br/><br/>
<label>'.$this->l('Publisher Pub Key:').'</label>
<div class="margin-form">
<input type="text" name="conf_row" id="conf_row" size="60" value="'.Tools::getValue('conf_row', Configuration::get('CONF_ROW')).'" />
</div><br/><br/>
<div class="margin-form">
<input style="margin:-8px 20px 0 0;" type="checkbox" name="Twitter" id="Twitter" '.( (Configuration::get('ADDTHISSHARE_TWITTER') == 1) ? 'checked="checked"' : '').' />
<img src="'.($this->_path).'img/twitter.gif" />
</div>
<div class="margin-form">
<input style="margin:-8px 20px 0 0;" type="checkbox" name="Google" id="Google" '.( (Configuration::get('ADDTHISSHARE_GOOGLE') == 1) ? 'checked="checked"' : '').' />
<img src="'.($this->_path).'img/google.gif" />
</div>
<div class="margin-form">
<input style="margin:-8px 20px 0 0;" type="checkbox" name="Pinterest" id="Pinterest" '.( (Configuration::get('ADDTHISSHARE_PINTEREST') == 1) ? 'checked="checked"' : '').' />
<img src="'.($this->_path).'img/pinterest.gif" />
</div>
<div class="margin-form">
<input style="margin:-8px 20px 0 0;" type="checkbox" name="Facebook" id="Facebook" '.( (Configuration::get('ADDTHISSHARE_FACEBOOK') == 1) ? 'checked="checked"' : '').' />
<img src="'.($this->_path).'img/facebook.gif" />
</div>
<br/><br/><div class="margin-form">
<input type="submit" class="button" name="submitCog" id="submitCog" value="'.$this->l('Save').'" />
</div>
</form>
</fieldset>';
return $this->_html;
}
public function updateCog()
{
Configuration::updateValue('ADDTHISSHARE_TWITTER', (isset($_POST['Twitter']) ? 1 : 0));
Configuration::updateValue('ADDTHISSHARE_GOOGLE', (isset($_POST['Google']) ? 1 : 0));
Configuration::updateValue('ADDTHISSHARE_PINTEREST', (isset($_POST['Pinterest']) ? 1 : 0));
Configuration::updateValue('ADDTHISSHARE_FACEBOOK', (isset($_POST['Facebook']) ? 1 : 0));
}
function hookDisplayHeader($params)
{
global $smarty, $cookie;
global $link;
$product = new Product((int)Tools::getValue('id_product'), false, (int)$cookie->id_lang);
$productLink = $link->getProductLink($product);
$images = $product->getImages((int)$cookie->id_lang);
foreach ($images AS $k => $image)
if ($image['cover'])
{
$cover['id_image'] = (int)$product->id.'-'.(int)$image['id_image'];
$cover['legend'] = $image['legend'];
}
if (!isset($cover))
$cover = array('id_image' => Language::getIsoById((int)$cookie->id_lang).'-default', 'legend' => 'No picture');
$this->context->smarty->assign(array(
'cover' => $cover,
'product' => $product,
'productLink' => $productLink,
'this_path' => $this->_path
));
return $this->display(__FILE__, 'addsharethis_header.tpl');
}
public function hookExtraRight($params)
{
global $smarty, $cookie, $link;
$conf_row = Configuration::get('CONF_ROW');
$this->context->smarty->assign(array(
'conf_row' => $conf_row,
));
if (Configuration::get('ADDTHISSHARE_TWITTER') == 1)
$data['twitter'] = '<span class="st_twitter_hcount sharebtn" displayText="Tweet"></span>';
if (Configuration::get('ADDTHISSHARE_GOOGLE') == 1)
{
$data['google'] = '<span class="st_googleplus_hcount" displayText="Google +"></span>';
}
if (Configuration::get('ADDTHISSHARE_PINTEREST') == 1)
$data['pinterest'] = '<span class="st_pinterest_hcount sharebtn" displayText="Pinterest"></span>';
if (Configuration::get('ADDTHISSHARE_FACEBOOK') == 1)
$data['facebook'] = '<span class="st_facebook_hcount sharebtn" displayText="Facebook"></span>';
$smarty->assign('addsharethis_data', $data);
return $this->display(__FILE__, 'addsharethis.tpl');
}
function hookLeftColumn($params)
{
return $this->hookExtraRight($params);
}
function hookFooter($params)
{
return $this->hookExtraRight($params);
}
function hookHome($params)
{
return $this->hookExtraRight($params);
}
function hookExtraleft($params)
{
return $this->hookExtraRight($params);
}
function hookProductActions($params)
{
return $this->hookExtraRight($params);
}
function hookProductFooter($params)
{
return $this->hookExtraRight($params);
}
}
?>
+25
View File
@@ -0,0 +1,25 @@
<link rel="stylesheet" type="text/css" href="{$module_dir}css/addsharethis.css"/>
{if isset($addsharethis_data)}
<div id="ShareDiv" class="addsharethis">
<div class="addsharethisinner">
<script type="text/javascript">var switchTo5x=true;</script>
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
{literal}
<script type="text/javascript">stLight.options({publisher: "{/literal}{$conf_row}{literal}", nativeCount:true });</script>
{/literal}
{if isset($addsharethis_data.twitter)}
{$addsharethis_data.twitter}
{/if}
{if isset($addsharethis_data.google)}
{$addsharethis_data.google}
{/if}
{if isset($addsharethis_data.pinterest)}
{$addsharethis_data.pinterest}
{/if}
{if isset($addsharethis_data.facebook)}
{$addsharethis_data.facebook}
{/if}
</div>
</div>
{/if}
@@ -0,0 +1,2 @@
<meta property="og:image" content="{$link->getImageLink($product->link_rewrite, $cover.id_image, large_default)}" />
+36
View File
@@ -0,0 +1,36 @@
<link rel="stylesheet" type="text/css" href="{$module_dir}css/addsharethis.css"/>
{if isset($addsharethis_data)}
<div class="addsharethis topaddsharethis">
<div class="addsharethisinner">
{if isset($addsharethis_data.twitter)}
{$addsharethis_data.twitter}
{/if}
{if isset($addsharethis_data.google)}
{$addsharethis_data.google}
{/if}
{if isset($addsharethis_data.pinterest)}
{$addsharethis_data.pinterest}
{/if}
{if isset($addsharethis_data.facebook)}
{$addsharethis_data.facebook}
{/if}
</div>
</div>
{/if}
<script type="text/javascript">
$(function(){
$(".addsharethis").addClass("loader");
$(window).load(function() {
$(".addsharethis").removeClass("loader");
$(".addsharethisinner").show(400);
});
});
$(function(){
$(".addsharethis .sharebtn").click(function(){
$(this).find("img").show("medium");
})
});
</script>
<script type="text/javascript">var switchTo5x=true;</script>
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">{literal}stLight.options({publisher: "{/literal}{$conf_row}{literal}", doNotHash: false, doNotCopy: false, hashAddressBar: false});{/literal}</script>
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>addsharethis</name>
<displayName><![CDATA[Add Sharethis]]></displayName>
<version><![CDATA[]]></version>
<description><![CDATA[Display social count button on the home page]]></description>
<author><![CDATA[Custom]]></author>
<tab><![CDATA[front_office_features]]></tab>
<is_configurable>1</is_configurable>
<need_instance>0</need_instance>
<limited_countries></limited_countries>
</module>
@@ -0,0 +1,6 @@
.topaddsharethis{ position:absolute; right:-170px; top:160px; width:150px;}
.stButton .stFb, .stButton .stTwbutton, .stButton .stMainServices, .stButton .stButton_gradient {height:22px !important;}
.stButton .stButton_gradient:hover {background: -moz-linear-gradient(center top , #D5D5D5 0px, #EFEFEF 48%, #FFFFFF 94%) repeat scroll 0 0 transparent!important;}
.stButton .chicklets:hover{ opacity:1!important;}
.stButton{ margin-bottom:15px;}
.addsharethis .stButton:hover{ opacity:0.6;}
View File
+4
View File
@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();
View File
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 723 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File
+133
View File
@@ -0,0 +1,133 @@
<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
if (!defined('_PS_VERSION_'))
exit;
class Blockquickview extends Module
{
public function __construct()
{
$this->name = 'blockquickview';
$this->tab = 'front_office_features';
$this->version = '1.0';
parent::__construct();
$this->displayName = $this->l('Quick view');
$this->description = $this->l('Add Quick information about product.');
}
public function install()
{
Configuration::updateValue('PS_QUICK_VIEW',1);
if (!parent::install())
return false;
return true;
}
public function uninstall()
{
if (!parent::uninstall() OR
!Configuration::deleteByName('PS_QUICK_VIEW'))
return false;
else return true;
}
public function getContent()
{
$html = '';
// If we try to update the settings
if (Tools::isSubmit('submitModule'))
{
Configuration::updateValue('PS_QUICK_VIEW', Tools::getValue('PS_QUICK_VIEW'));
$html .= $this->displayConfirmation($this->l('Configuration updated'));
}
$html .= $this->renderForm();
return $html;
}
public function renderForm()
{
$fields_form = array(
'form' => array(
'legend' => array(
'title' => $this->l('Settings'),
'icon' => 'icon-cogs'
),
'input' => array(
array(
'type' => 'switch',
'label' => $this->l('Display Quick view'),
'name' => 'PS_QUICK_VIEW',
'values' => array(
array(
'id' => 'active_on',
'value' => 1,
'label' => $this->l('Enabled')
),
array(
'id' => 'active_off',
'value' => 0,
'label' => $this->l('Disabled')
)
),
),
),
'submit' => array(
'title' => $this->l('Save'),
'class' => 'btn btn-primary')
),
);
$helper = new HelperForm();
$helper->show_toolbar = false;
$helper->table = $this->table;
$lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
$helper->default_form_language = $lang->id;
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
$this->fields_form = array();
$helper->identifier = $this->identifier;
$helper->submit_action = 'submitModule';
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;
$helper->token = Tools::getAdminTokenLite('AdminModules');
$helper->tpl_vars = array(
'fields_value' => $this->getConfigFieldsValues(),
'languages' => $this->context->controller->getLanguages(),
'id_language' => $this->context->language->id
);
return $helper->generateForm(array($fields_form));
}
public function getConfigFieldsValues()
{
return array(
'PS_QUICK_VIEW' => Tools::getValue('PS_QUICK_VIEW', Configuration::get('PS_QUICK_VIEW')),
);
}
}
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>blockquickview</name>
<displayName><![CDATA[Quick view]]></displayName>
<version><![CDATA[1.0]]></version>
<description><![CDATA[Add Quick information about product.]]></description>
<author><![CDATA[]]></author>
<tab><![CDATA[front_office_features]]></tab>
<is_configurable>1</is_configurable>
<need_instance>1</need_instance>
<limited_countries></limited_countries>
</module>
+35
View File
@@ -0,0 +1,35 @@
<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA␍
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../../');
exit;
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

@@ -0,0 +1,35 @@
<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;