This commit is contained in:
Thibault GUILLAUME 2015-09-17 12:00:08 +02:00
parent a72d09932c
commit 3e72899c10
62 changed files with 2181 additions and 3 deletions

@ -1 +0,0 @@
Subproject commit 4f10eb0b8bdbff307e0321e9af46f28113e98260

View File

@ -0,0 +1,4 @@
2014-03-28 11:50:51 +0100 // MO : min ps_versions_compliancy modified (1.5 => 1.6)
2014-03-25 19:09:51 +0100 [*] BO : Retrocompatibility with old theme ajax query
2014-03-24 18:26:48 +0100 / MO sendtoafriend : ps_versions_compliancy added
2014-03-21 10:55:23 +0100 Initial commit

View File

@ -0,0 +1,37 @@
# Send to a Friend module
## About
Allows customers to send a product link to a friend.
## Contributing
PrestaShop modules are open-source extensions to the PrestaShop e-commerce solution. Everyone is welcome and even encouraged to contribute with their own improvements.
### Requirements
Contributors **must** follow the following rules:
* **Make your Pull Request on the "dev" branch**, NOT the "master" branch.
* Do not update the module's version number.
* Follow [the coding standards][1].
### Process in details
Contributors wishing to edit a module's files should follow the following process:
1. Create your GitHub account, if you do not have one already.
2. Fork the sendtoafriend project to your GitHub account.
3. Clone your fork to your local machine in the ```/modules``` directory of your PrestaShop installation.
4. Create a branch in your local clone of the module for your changes.
5. Change the files in your branch. Be sure to follow [the coding standards][1]!
6. Push your changed branch to your fork in your GitHub account.
7. Create a pull request for your changes **on the _'dev'_ branch** of the module's project. Be sure to follow [the commit message norm][2] in your pull request. If you need help to make a pull request, read the [Github help page about creating pull requests][3].
8. Wait for one of the core developers either to include your change in the codebase, or to comment on possible improvements you should make to your code.
That's it: you have contributed to this open-source project! Congratulations!
[1]: http://doc.prestashop.com/display/PS16/Coding+Standards
[2]: http://doc.prestashop.com/display/PS16/How+to+write+a+commit+message
[3]: https://help.github.com/articles/using-pull-requests

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>sendtoafriend</name>
<displayName><![CDATA[Send to a Friend module]]></displayName>
<version><![CDATA[1.7.3]]></version>
<description><![CDATA[Allows customers to send a product link to a friend.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[front_office_features]]></tab>
<is_configurable>0</is_configurable>
<need_instance>0</need_instance>
<limited_countries></limited_countries>
</module>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>sendtoafriend</name>
<displayName><![CDATA[Module envoyer &agrave; un ami]]></displayName>
<version><![CDATA[1.7.3]]></version>
<description><![CDATA[Permet &agrave; vos clients d&#039;envoyer des liens &agrave; leurs amis]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[front_office_features]]></tab>
<is_configurable>0</is_configurable>
<need_instance>0</need_instance>
<limited_countries></limited_countries>
</module>

View File

@ -0,0 +1,35 @@
<?php
/*
* 2007-2014 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-2014 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: 633 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1,35 @@
<?php
/*
* 2007-2014 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-2014 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;

View File

@ -0,0 +1,105 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<title>Message from {shop_name}</title>
<style>
/****** responsive ********/
@media only screen and (max-width: 300px){
body {
width:218px !important;
margin:auto !important;
}
.table {width:195px !important;margin:auto !important;}
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto !important;display: block !important;}
span.title{font-size:20px !important;line-height: 23px !important}
span.subtitle{font-size: 14px !important;line-height: 18px !important;padding-top:10px !important;display:block !important;}
td.box p{font-size: 12px !important;font-weight: bold !important;}
.table-recap table, .table-recap thead, .table-recap tbody, .table-recap th, .table-recap td, .table-recap tr {
display: block !important;
}
.table-recap{width: 200px!important;}
.table-recap tr td, .conf_body td{text-align:center !important;}
.address{display: block !important;margin-bottom: 10px !important;}
.space_address{display: none !important;}
}
@media only screen and (min-width: 301px) and (max-width: 500px) {
body {width:308px!important;margin:auto!important;}
.table {width:285px!important;margin:auto!important;}
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto!important;display: block!important;}
.table-recap table, .table-recap thead, .table-recap tbody, .table-recap th, .table-recap td, .table-recap tr {
display: block !important;
}
.table-recap{width: 293px !important;}
.table-recap tr td, .conf_body td{text-align:center !important;}
}
@media only screen and (min-width: 501px) and (max-width: 768px) {
body {width:478px!important;margin:auto!important;}
.table {width:450px!important;margin:auto!important;}
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto!important;display: block!important;}
}
/* Mobile */
@media only screen and (max-device-width: 480px) {
body {width:308px!important;margin:auto!important;}
.table {width:285px;margin:auto!important;}
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto!important;display: block!important;}
.table-recap{width: 285px!important;}
.table-recap tr td, .conf_body td{text-align:center!important;}
.address{display: block !important;margin-bottom: 10px !important;}
.space_address{display: none !important;}
}
</style>
</head>
<body style="background-color:#fff;width:650px;font-family:Open-sans, sans-serif;color:#555454;font-size:13px;line-height:18px;margin:auto">
<table class="table table-mail" style="width:100%;margin-top:10px;-moz-box-shadow:0 0 5px #afafaf;-webkit-box-shadow:0 0 5px #afafaf;-o-box-shadow:0 0 5px #afafaf;box-shadow:0 0 5px #afafaf;filter:progid:DXImageTransform.Microsoft.Shadow(color=#afafaf,Direction=134,Strength=5)">
<tr>
<td class="space" style="width:20px;border:none;padding:7px 0">&nbsp;</td>
<td align="center" style="border:none;padding:7px 0">
<table class="table" style="width:100%;background-color:#fff">
<tr>
<td align="center" class="logo" style="border-bottom:4px solid #333!important;border:none;padding:7px 0">
<a title="{shop_name}" href="{shop_url}" style="color:#337ff1">
<img src="{shop_logo}" alt="{shop_name}" />
</a>
</td>
</tr>
<tr>
<td align="center" class="titleblock" style="border:none;padding:7px 0">
<span class="title" style="font-weight:500;font-size:28px;text-transform:uppercase;line-height:33px">Hi {name},</span><br/>
</td>
</tr>
<tr>
<td class="space_footer" style="padding:0!important;border:none">&nbsp;</td>
</tr>
<tr>
<td class="box" style="background-color:#fbfbfb;border:1px solid #d6d4d4!important;padding:10px!important">
<p style="margin:3px 0 7px;text-transform:uppercase;font-weight:500;font-size:18px;border-bottom:1px solid #d6d4d4!important;padding-bottom:10px">
{customer} has sent you a link to a product that (s)he thinks may interest you.</p>
<span style="color:#777">
Click here to view this item: <a href="{product_link}" style="color:#337ff1">{product}</a>
</span>
</td>
</tr>
<tr>
<td class="space_footer" style="padding:0!important;border:none">&nbsp;</td>
</tr>
<tr>
<td class="footer" style="border-top:4px solid #333!important;border:none;padding:7px 0">
<span><a href="{shop_url}" style="color:#337ff1">{shop_name}</a> powered by <a href="http://www.prestashop.com/" style="color:#337ff1">PrestaShop&trade;</a></span>
</td>
</tr>
</table>
</td>
<td class="space" style="width:20px;border:none;padding:7px 0">&nbsp;</td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,14 @@
[{shop_url}]
Hi {name},
{customer} has sent you a link to a product that (s)he thinks may
interest you.
Click here to view this item: {product}
[{product_link}]
{shop_name} [{shop_url}] powered by
PrestaShop(tm) [http://www.prestashop.com/]

View File

@ -0,0 +1,27 @@
{*
* 2007-2014 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-2014 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<li class="sendtofriend"><a href="{$this_path}sendtoafriend-form.php?id_product={$smarty.get.id_product|intval}">{l s='Send to a friend' mod='sendtoafriend'}</a></li>

View File

@ -0,0 +1,97 @@
{*
* 2007-2014 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-2014 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<script type="text/javascript">
{literal}
$('document').ready(function(){
$('#send_friend_button').fancybox({
'hideOnContentClick': false
});
$('#sendEmail').click(function(){
var name = $('#friend_name').val();
var email = $('#friend_email').val();
var id_product = $('#id_product_comment_send').val();
if (name && email && !isNaN(id_product))
{
$.ajax({
{/literal}url: "{$module_dir}sendtoafriend_ajax.php",{literal}
type: "POST",
headers: {"cache-control": "no-cache"},
data: {action: 'sendToMyFriend', secure_key: '{/literal}{$stf_secure_key}{literal}', name: name, email: email, id_product: id_product},{/literal}{literal}
dataType: "json",
success: function(result) {
$.fancybox.close();
var msg = result ? "{/literal}{l s='Your e-mail has been sent successfully' mod='sendtoafriend'}{literal}" : "{/literal}{l s='Your e-mail could not be sent. Please check the e-mail address and try again.' mod='sendtoafriend'}{literal}";
var title = "{/literal}{l s='Send to a friend' mod='sendtoafriend'}{literal}";
fancyMsgBox(msg, title);
}
});
}
else
$('#send_friend_form_error').text("{/literal}{l s='You did not fill required fields' mod='sendtoafriend' js=1}{literal}");
});
});
{/literal}
</script>
<li class="sendtofriend">
<a id="send_friend_button" href="#send_friend_form">{l s='Send to a friend' mod='sendtoafriend'}</a>
</li>
<div style="display: none;">
<div id="send_friend_form">
<h2 class="title">{l s='Send to a friend' mod='sendtoafriend'}</h2>
<div class="product clearfix">
<img src="{$link->getImageLink($stf_product->link_rewrite, $stf_product_cover, 'home_default')|escape:'html'}" height="{$homeSize.height}" width="{$homeSize.width}" alt="{$stf_product->name|escape:html:'UTF-8'}" />
<div class="product_desc">
<p class="product_name"><strong>{$stf_product->name}</strong></p>
{$stf_product->description_short}
</div>
</div>
<div class="send_friend_form_content" id="send_friend_form_content">
<div id="send_friend_form_error"></div>
<div id="send_friend_form_success"></div>
<div class="form_container">
<p class="intro_form">{l s='Recipient' mod='sendtoafriend'} :</p>
<p class="text">
<label for="friend_name">{l s='Name of your friend' mod='sendtoafriend'} <sup class="required">*</sup> :</label>
<input id="friend_name" name="friend_name" type="text" value=""/>
</p>
<p class="text">
<label for="friend_email">{l s='E-mail address of your friend' mod='sendtoafriend'} <sup class="required">*</sup> :</label>
<input id="friend_email" name="friend_email" type="text" value=""/>
</p>
<p class="txt_required"><sup class="required">*</sup> {l s='Required fields' mod='sendtoafriend'}</p>
</div>
<p class="submit">
<input id="id_product_comment_send" name="id_product" type="hidden" value="{$stf_product->id}" />
<a href="#" onclick="$.fancybox.close();">{l s='Cancel' mod='sendtoafriend'}</a>&nbsp;{l s='or' mod='sendtoafriend'}&nbsp;
<input id="sendEmail" class="button" name="sendEmail" type="submit" value="{l s='Send' mod='sendtoafriend'}" />
</p>
</div>
</div>
</div>

View File

@ -0,0 +1,46 @@
/* ************************************************************************************************
PAGE SEND TO FRIEND
************************************************************************************************ */
#sendfriendpage form.std fieldset {
margin:0 0 20px 0;
padding: 10px 15px;
background: none repeat scroll 0 0 #eee
}
#sendfriendpage .product {}
#sendfriendpage .product .img_link {float:left}
#sendfriendpage .product .img_link img {
margin:0 10px 0 0;
border:1px solid #ccc;
}
#sendfriendpage .product .product_desc {
float:left;
width:200px;
font-weight:bold;
font-size:12px;
color:#000;
}
#sendfriendpage #send_friend_form_content {margin-top:40px}
#sendfriendpage #send_friend_form_content .text {
padding-bottom: 10px
}
#sendfriendpage #send_friend_form_content .text label {
display: inline-block;
padding: 6px 15px;
width: 180px;
font-size: 12px;
text-align: right
}
#sendfriendpage #send_friend_form_content .text input {
padding: 0 5px;
height: 22px;
width: 260px;
border: 1px solid #ccc;
font-size: 12px
}
#sendfriendpage #send_friend_form_content .submit {
margin:0 20px 0 0;
padding:5px 0;
text-align:right
}

View File

View File

@ -0,0 +1,90 @@
<?php
/*
* 2007-2014 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-2014 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 sendToAFriend extends Module
{
private $_html = '';
private $_postErrors = array();
public $context;
function __construct($dontTranslate = false)
{
$this->name = 'sendtoafriend';
$this->version = '1.7.3';
$this->author = 'PrestaShop';
$this->tab = 'front_office_features';
$this->need_instance = 0;
$this->secure_key = Tools::encrypt($this->name);
parent::__construct();
if (!$dontTranslate)
{
$this->displayName = $this->l('Send to a Friend module');
$this->description = $this->l('Allows customers to send a product link to a friend.');
}
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
}
public function install()
{
return (parent::install() && $this->registerHook('extraLeft') && $this->registerHook('header'));
}
public function uninstall()
{
return (parent::uninstall() && $this->unregisterHook('header') && $this->unregisterHook('extraLeft'));
}
public function hookExtraLeft($params)
{
/* Product informations */
$product = new Product((int)Tools::getValue('id_product'), false, $this->context->language->id);
$image = Product::getCover((int)$product->id);
$this->context->smarty->assign(array(
'stf_product' => $product,
'stf_product_cover' => (int)$product->id.'-'.(int)$image['id_image'],
'stf_secure_key' => $this->secure_key
));
return $this->display(__FILE__, 'sendtoafriend-extra.tpl');
}
public function hookHeader($params)
{
$this->page_name = Dispatcher::getInstance()->getController();
if ($this->page_name == 'product')
{
$this->context->controller->addCSS($this->_path.'sendtoafriend.css', 'all');
$this->context->controller->addJS($this->_path.'sendtoafriend.js');
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B

View File

@ -0,0 +1,66 @@
{*
* 2007-2014 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-2014 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{capture name=path}{l s='Send to a friend' mod='sendtoafriend'}{/capture}
{include file="$tpl_dir./breadcrumb.tpl"}
<div id="sendfriendpage">
<h1>{l s='Send to a friend' mod='sendtoafriend'}</h1>
<p class="bold"><strong>{l s='Send this page to a friend who might be interested in the item below.' mod='sendtoafriend'}.</strong></p>
{include file="$tpl_dir/errors.tpl"}
{if isset($smarty.get.submited)}
<p class="success">{l s='Your email has been sent successfully' mod='sendtoafriend'}</p>
{else}
<form method="post" action="{$request_uri}" class="std">
<fieldset>
<div class="product clearfix">
<a href="{$productLink}" class="img_link"><img src="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'small_default')|escape:'html'}" alt="" title="{$cover.legend}" /></a>
<a href="{$productLink}" class="product_desc"><br />{$product->name}</a>
</div>
<div id="send_friend_form_content">
<p class="text">
<label for="friend-name">{l s='Friend\'s name' mod='sendtoafriend'}</label>
<input type="text" id="friend-name" name="name" value="{if isset($smarty.post.name)}{$smarty.post.name|escape:'html':'UTF-8'|stripslashes}{/if}" />
</p>
<p class="text">
<label for="friend-address">{l s='Friend\'s email' mod='sendtoafriend'}</label>
<input type="text" id="friend-address" name="email" value="{if isset($smarty.post.name)}{$smarty.post.email|escape:'html'|stripslashes}{/if}" />
</p>
<p class="submit">
<input type="submit" name="submitAddtoafriend" value="{l s='send' mod='sendtoafriend'}" class="button" />
</p>
</div>
</fieldset>
</form>
{/if}
<ul class="footer_links">
<li><a href="{$productLink}">&laquo; {l s='Back to product page' mod='sendtoafriend'}</a></li>
</ul>
</div>

View File

@ -0,0 +1,86 @@
<?php
/*
* 2007-2014 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-2014 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
require_once(dirname(__FILE__).'/../../config/config.inc.php');
require_once(dirname(__FILE__).'/../../init.php');
include_once(dirname(__FILE__).'/sendtoafriend.php');
$module = new SendToAFriend();
if (Tools::getValue('action') == 'sendToMyFriend' && Tools::getValue('secure_key') == $module->secure_key)
{
// Retrocompatibilty with old theme
if($friend = Tools::getValue('friend'))
{
$friend = Tools::jsonDecode($friend, true);
foreach ($friend as $key => $value)
{
if ($value['key'] == 'friend_name')
$friendName = $value['value'];
elseif ($value['key'] == 'friend_email')
$friendMail = $value['value'];
elseif ($value['key'] == 'id_product')
$id_product = $value['value'];
}
}
else
{
$friendName = Tools::getValue('name');
$friendMail = Tools::getValue('email');
$id_product = Tools::getValue('id_product');
}
if (!$friendName || !$friendMail || !$id_product)
die('0');
/* Email generation */
$product = new Product((int)$id_product, false, $module->context->language->id);
$productLink = $module->context->link->getProductLink($product);
$customer = $module->context->cookie->customer_firstname ? $module->context->cookie->customer_firstname.' '.$module->context->cookie->customer_lastname : $module->l('A friend', 'sendtoafriend_ajax');
$templateVars = array(
'{product}' => $product->name,
'{product_link}' => $productLink,
'{customer}' => $customer,
'{name}' => Tools::safeOutput($friendName)
);
/* Email sending */
if (!Mail::Send((int)$module->context->cookie->id_lang,
'send_to_a_friend',
sprintf(Mail::l('%1$s sent you a link to %2$s', (int)$module->context->cookie->id_lang), $customer, $product->name),
$templateVars, $friendMail,
null,
($module->context->cookie->email ? $module->context->cookie->email : null),
($module->context->cookie->customer_firstname ? $module->context->cookie->customer_firstname.' '.$module->context->cookie->customer_lastname : null),
null,
null,
dirname(__FILE__).'/mails/'))
die('0');
die('1');
}
die('0');

View File

@ -0,0 +1,30 @@
<?php
global $_MODULE;
$_MODULE = array();
$_MODULE['<{sendtoafriend}prestashop>sendtoafriend_ajax_22c4733a9ceb239bf825a0cecd1cfaec'] = 'Un ami';
$_MODULE['<{sendtoafriend}prestashop>sendtoafriend_2074615eb70699e55b1f9289c6c77c25'] = 'Module envoyer à un ami';
$_MODULE['<{sendtoafriend}prestashop>sendtoafriend_3234e2609dd694d8763c390fe97eba04'] = 'Permet à vos clients d\'envoyer des liens à leurs amis';
$_MODULE['<{sendtoafriend}prestashop>product_page_2107f6398c37b4b9ee1e1b5afb5d3b2a'] = 'Envoyer à un ami';
$_MODULE['<{sendtoafriend}prestashop>sendtoafriend-extra_11cbd9ec2e4b628c371094b6361b9c96'] = 'Votre e-mail a bien été envoyé';
$_MODULE['<{sendtoafriend}prestashop>sendtoafriend-extra_36fb3f59b4a75949a0db90e7011b21f2'] = 'Votre e-mail n\'a pas pu être envoyé. Veuillez vérifier l\'adresse et réessayer.';
$_MODULE['<{sendtoafriend}prestashop>sendtoafriend-extra_2107f6398c37b4b9ee1e1b5afb5d3b2a'] = 'Envoyer à un ami';
$_MODULE['<{sendtoafriend}prestashop>sendtoafriend-extra_d1f092e79827eaffce4a33fa011fde24'] = 'Vous n\'avez pas rempli les champs requis';
$_MODULE['<{sendtoafriend}prestashop>sendtoafriend-extra_5d6103b662f41b07e10687f03aca8fdc'] = 'Destinataire';
$_MODULE['<{sendtoafriend}prestashop>sendtoafriend-extra_bb6aa0be8236a10e6d3b315ebd5f2547'] = 'Nom de votre ami';
$_MODULE['<{sendtoafriend}prestashop>sendtoafriend-extra_099bc8914b5be9e522a29e48cb3c01c4'] = 'Adresse e-mail de votre ami';
$_MODULE['<{sendtoafriend}prestashop>sendtoafriend-extra_70397c4b252a5168c5ec003931cea215'] = 'Champs requis';
$_MODULE['<{sendtoafriend}prestashop>sendtoafriend-extra_ea4788705e6873b424c65e91c2846b19'] = 'Annuler';
$_MODULE['<{sendtoafriend}prestashop>sendtoafriend-extra_e81c4e4f2b7b93b481e13a8553c2ae1b'] = 'OU';
$_MODULE['<{sendtoafriend}prestashop>sendtoafriend-extra_94966d90747b97d1f0f206c98a8b1ac3'] = 'Envoyer';
$_MODULE['<{sendtoafriend}prestashop>sendtoafriend_2107f6398c37b4b9ee1e1b5afb5d3b2a'] = 'Envoyer à un ami';
$_MODULE['<{sendtoafriend}prestashop>sendtoafriend_20589174124c25654cac3736e737d2a3'] = 'Envoyer cette page à un ami susceptible d\'être intéressé par le produit ci-dessous';
$_MODULE['<{sendtoafriend}prestashop>sendtoafriend_b31afdfa73c89b567778f15180c2dd6c'] = 'Votre e-mail a bien été envoyé';
$_MODULE['<{sendtoafriend}prestashop>sendtoafriend_e55de03786f359e2b133f2a74612eba6'] = 'Nom de votre ami :';
$_MODULE['<{sendtoafriend}prestashop>sendtoafriend_19f41c3d6db934fb2db1840ddefd2c51'] = 'E-mail de votre ami';
$_MODULE['<{sendtoafriend}prestashop>sendtoafriend_2541d938b0a58946090d7abdde0d3890'] = 'Envoyer';
$_MODULE['<{sendtoafriend}prestashop>sendtoafriend_68728c1897e5936032fe21ffb6b10c2e'] = 'Retour à la fiche produit';
return $_MODULE;

View File

@ -0,0 +1,35 @@
<?php
/*
* 2007-2014 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-2014 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;

@ -1 +0,0 @@
Subproject commit 95989e9b926c2f669b27be5ce13ebfa7f314ad10

View File

@ -0,0 +1,3 @@
2014-04-17 11:44:08 +0200 // Version compliancy
2014-03-24 15:22:35 +0100 / MO socialsharing : ps_versions_compliancy added
2014-03-20 14:35:52 +0100 Initial commit

View File

@ -0,0 +1,37 @@
# Social sharing
## About
Displays social sharing buttons (Twitter, Facebook, Google+ and Pinterest) on every product page.
## Contributing
PrestaShop modules are open-source extensions to the PrestaShop e-commerce solution. Everyone is welcome and even encouraged to contribute with their own improvements.
### Requirements
Contributors **must** follow the following rules:
* **Make your Pull Request on the "dev" branch**, NOT the "master" branch.
* Do not update the module's version number.
* Follow [the coding standards][1].
### Process in details
Contributors wishing to edit a module's files should follow the following process:
1. Create your GitHub account, if you do not have one already.
2. Fork the socialsharing project to your GitHub account.
3. Clone your fork to your local machine in the ```/modules``` directory of your PrestaShop installation.
4. Create a branch in your local clone of the module for your changes.
5. Change the files in your branch. Be sure to follow [the coding standards][1]!
6. Push your changed branch to your fork in your GitHub account.
7. Create a pull request for your changes **on the _'dev'_ branch** of the module's project. Be sure to follow [the commit message norm][2] in your pull request. If you need help to make a pull request, read the [Github help page about creating pull requests][3].
8. Wait for one of the core developers either to include your change in the codebase, or to comment on possible improvements you should make to your code.
That's it: you have contributed to this open-source project! Congratulations!
[1]: http://doc.prestashop.com/display/PS16/Coding+Standards
[2]: http://doc.prestashop.com/display/PS16/How+to+write+a+commit+message
[3]: https://help.github.com/articles/using-pull-requests

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>socialsharing</name>
<displayName><![CDATA[Social sharing]]></displayName>
<version><![CDATA[1.3.0]]></version>
<description><![CDATA[Displays social sharing buttons (Twitter, Facebook, Google+ and Pinterest) on every product page.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[advertising_marketing]]></tab>
<is_configurable>1</is_configurable>
<need_instance>0</need_instance>
<limited_countries></limited_countries>
</module>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>socialsharing</name>
<displayName><![CDATA[Partage sur les r&eacute;seaux sociaux]]></displayName>
<version><![CDATA[1.3.0]]></version>
<description><![CDATA[Affiche des boutons de partage sur les r&eacute;seaux sociaux (Twitter, Facebook, Google+ et Pinterest) sur chaque page produit.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[advertising_marketing]]></tab>
<is_configurable>1</is_configurable>
<need_instance>0</need_instance>
<limited_countries></limited_countries>
</module>

View File

@ -0,0 +1,3 @@
.socialsharing_product button {
margin-bottom: 3px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -0,0 +1,35 @@
<?php
/*
* 2007-2014 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-2014 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: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -0,0 +1,35 @@
<?php
/*
* 2007-2014 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-2014 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;

View File

@ -0,0 +1,35 @@
<?php
/*
* 2007-2014 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-2014 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;

View File

@ -0,0 +1,48 @@
/**
* 2007-2014 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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/osl-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-2014 PrestaShop SA
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
$(document).ready(function(){
$('button.social-sharing').on('click', function(){
type = $(this).attr('data-type');
if (type.length)
{
switch(type)
{
case 'twitter':
window.open('https://twitter.com/intent/tweet?text=' + sharing_name + ' ' + encodeURIComponent(sharing_url), 'sharertwt', 'toolbar=0,status=0,width=640,height=445');
break;
case 'facebook':
window.open('http://www.facebook.com/sharer.php?u=' + sharing_url, 'sharer', 'toolbar=0,status=0,width=660,height=445');
break;
case 'google-plus':
window.open('https://plus.google.com/share?url=' + sharing_url, 'sharer', 'toolbar=0,status=0,width=660,height=445');
break;
case 'pinterest':
window.open('http://www.pinterest.com/pin/create/button/?media=' + sharing_img + '&url=' + sharing_url, 'sharerpinterest', 'toolbar=0,status=0,width=660,height=445');
break;
}
}
});
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -0,0 +1,270 @@
<?php
/**
* 2007-2015 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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/osl-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-2015 PrestaShop SA
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
if (!defined('_PS_VERSION_'))
exit;
class SocialSharing extends Module
{
protected static $networks = array('Facebook', 'Twitter', 'Google', 'Pinterest');
protected $html = '';
public function __construct()
{
$this->name = 'socialsharing';
$this->author = 'PrestaShop';
$this->tab = 'advertising_marketing';
$this->need_instance = 0;
$this->version = '1.3.0';
$this->bootstrap = true;
$this->_directory = dirname(__FILE__);
parent::__construct();
$this->displayName = $this->l('Social sharing');
$this->description = $this->l('Displays social sharing buttons (Twitter, Facebook, Google+ and Pinterest) on every product page.');
}
public function install()
{
if (!parent::install())
return false;
// Activate every option by default
Configuration::updateValue('PS_SC_TWITTER', 1);
Configuration::updateValue('PS_SC_FACEBOOK', 1);
Configuration::updateValue('PS_SC_GOOGLE', 1);
Configuration::updateValue('PS_SC_PINTEREST', 1);
// The module will add a meta in the product page header and add a javascript file
$this->registerHook('header');
// This hook could have been called only from the product page, but it's better to add the JS in all the pages with CCC
/*
$id_hook_header = Hook::getIdByName('header');
$pages = array();
foreach (Meta::getPages() as $page)
if ($page != 'product')
$pages[] = $page;
$this->registerExceptions($id_hook_header, $pages);
*/
// The module need to clear the product page cache after update/delete
$this->registerHook('actionObjectProductUpdateAfter');
$this->registerHook('actionObjectProductDeleteAfter');
// The module will then be hooked on the product and comparison pages
$this->registerHook('displayRightColumnProduct');
$this->registerHook('displayCompareExtraInformation');
// The module will then be hooked and accessible with Smarty function
$this->registerHook('displaySocialSharing');
return true;
}
public function getConfigFieldsValues()
{
$values = array();
foreach (self::$networks as $network)
$values['PS_SC_'.Tools::strtoupper($network)] = (int)Tools::getValue('PS_SC_'.Tools::strtoupper($network), Configuration::get('PS_SC_'.Tools::strtoupper($network)));
return $values;
}
public function getContent()
{
if (Tools::isSubmit('submitSocialSharing'))
{
foreach (self::$networks as $network)
Configuration::updateValue('PS_SC_'.Tools::strtoupper($network), (int)Tools::getValue('PS_SC_'.Tools::strtoupper($network)));
$this->html .= $this->displayConfirmation($this->l('Settings updated'));
Tools::clearCache(Context::getContext()->smarty, $this->getTemplatePath('socialsharing.tpl'));
Tools::clearCache(Context::getContext()->smarty, $this->getTemplatePath('socialsharing_compare.tpl'));
Tools::redirectAdmin($this->context->link->getAdminLink('AdminModules', true).'&conf=6&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name);
}
$helper = new HelperForm();
$helper->submit_action = 'submitSocialSharing';
$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());
$fields = array();
foreach (self::$networks as $network)
$fields[] = array(
'type' => 'switch',
'label' => $network,
'name' => 'PS_SC_'.Tools::strtoupper($network),
'values' => array(
array(
'id' => Tools::strtolower($network).'_active_on',
'value' => 1,
'label' => $this->l('Enabled')
),
array(
'id' => Tools::strtolower($network).'_active_off',
'value' => 0,
'label' => $this->l('Disabled')
)
)
);
return $this->html.$helper->generateForm(array(
array(
'form' => array(
'legend' => array(
'title' => $this->displayName,
'icon' => 'icon-share'
),
'input' => $fields,
'submit' => array(
'title' => $this->l('Save')
)
)
)
));
}
public function hookDisplayHeader($params)
{
if (!isset($this->context->controller->php_self) || !in_array($this->context->controller->php_self, array('product', 'products-comparison')))
return;
$this->context->controller->addCss($this->_path.'css/socialsharing.css');
$this->context->controller->addJS($this->_path.'js/socialsharing.js');
// Exception are managed with Module::registerExceptions() but this is needed in case the merchant added new controllers afterwards
if (!isset($this->context->controller->php_self) || $this->context->controller->php_self != 'product')
return;
$product = $this->context->controller->getProduct();
if (!$this->isCached('socialsharing_header.tpl', $this->getCacheId('socialsharing_header|'.(isset($product->id) && $product->id ? (int)$product->id : ''))))
{
$this->context->smarty->assign(array(
'price' => Tools::ps_round($product->getPrice(!Product::getTaxCalculationMethod((int)$this->context->cookie->id_customer), null), _PS_PRICE_COMPUTE_PRECISION_),
'pretax_price' => Tools::ps_round($product->getPrice(false, null), _PS_PRICE_COMPUTE_PRECISION_),
'weight' => $product->weight,
'weight_unit' => Configuration::get('PS_WEIGHT_UNIT'),
'cover' => isset($product->id) ? Product::getCover((int)$product->id) : '',
'link_rewrite' => isset($product->link_rewrite) && $product->link_rewrite ? $product->link_rewrite : '',
));
}
return $this->display(__FILE__, 'socialsharing_header.tpl', $this->getCacheId('socialsharing_header|'.(isset($product->id) && $product->id ? (int)$product->id : '')));
}
public function hookDisplaySocialSharing()
{
$product = $this->context->controller->getProduct();
if (isset($product) && Validate::isLoadedObject($product))
{
$image_cover_id = $product->getCover($product->id);
if (is_array($image_cover_id) && isset($image_cover_id['id_image']))
$image_cover_id = (int)$image_cover_id['id_image'];
else
$image_cover_id = 0;
Media::addJsDef(array(
'sharing_name' => addcslashes($product->name, "'"),
'sharing_url' => addcslashes($this->context->link->getProductLink($product), "'"),
'sharing_img' => addcslashes($this->context->link->getImageLink($product->link_rewrite, $image_cover_id), "'")
));
}
if (!$this->isCached('socialsharing.tpl', $this->getCacheId('socialsharing|'.(isset($product->id) && $product->id ? (int)$product->id : ''))))
{
$this->context->smarty->assign(array(
'product' => isset($product) ? $product : '',
'PS_SC_TWITTER' => Configuration::get('PS_SC_TWITTER'),
'PS_SC_GOOGLE' => Configuration::get('PS_SC_GOOGLE'),
'PS_SC_FACEBOOK' => Configuration::get('PS_SC_FACEBOOK'),
'PS_SC_PINTEREST' => Configuration::get('PS_SC_PINTEREST')
));
}
return $this->display(__FILE__, 'socialsharing.tpl', $this->getCacheId('socialsharing|'.(isset($product->id) && $product->id ? (int)$product->id : '')));
}
protected function clearProductHeaderCache($id_product)
{
return $this->_clearCache('socialsharing_header.tpl', 'socialsharing_header|'.(int)$id_product);
}
public function hookDisplayCompareExtraInformation($params)
{
Media::addJsDef(array(
'sharing_name' => addcslashes($this->l('Product comparison'), "'"),
'sharing_url' => addcslashes($this->context->link->getPageLink('products-comparison', null, $this->context->language->id,
array('compare_product_list' => Tools::getValue('compare_product_list'))), "'"),
'sharing_img' => addcslashes(_PS_IMG_DIR_.Configuration::get('PS_LOGO_MAIL', null, null, $this->context->shop->id), "'"
)
));
if (!$this->isCached('socialsharing_compare.tpl', $this->getCacheId('socialsharing_compare')))
{
$this->context->smarty->assign(array(
'PS_SC_TWITTER' => Configuration::get('PS_SC_TWITTER'),
'PS_SC_GOOGLE' => Configuration::get('PS_SC_GOOGLE'),
'PS_SC_FACEBOOK' => Configuration::get('PS_SC_FACEBOOK'),
'PS_SC_PINTEREST' => Configuration::get('PS_SC_PINTEREST')
));
}
return $this->display(__FILE__, 'socialsharing_compare.tpl', $this->getCacheId('socialsharing_compare'));
}
public function hookDisplayRightColumnProduct($params)
{
return $this->hookDisplaySocialSharing();
}
public function hookExtraleft($params)
{
return $this->hookDisplaySocialSharing();
}
public function hookProductActions($params)
{
return $this->hookDisplaySocialSharing();
}
public function hookProductFooter($params)
{
return $this->hookDisplaySocialSharing();
}
public function hookActionObjectProductUpdateAfter($params)
{
return $this->clearProductHeaderCache($params['object']->id);
}
public function hookActionObjectProductDeleteAfter($params)
{
return $this->clearProductHeaderCache($params['object']->id);
}
}

View File

@ -0,0 +1,24 @@
<?php
global $_MODULE;
$_MODULE = array();
$_MODULE['<{socialsharing}prestashop>socialsharing_7dba9afe5ed3bbd1683c2c1a9e168cab'] = 'Partage sur les réseaux sociaux';
$_MODULE['<{socialsharing}prestashop>socialsharing_622e2c510964bb1eb4e2e721ec6148c5'] = 'Affiche des boutons de partage sur les réseaux sociaux (Twitter, Facebook, Google+ et Pinterest) sur chaque page produit.';
$_MODULE['<{socialsharing}prestashop>socialsharing_c888438d14855d7d96a2724ee9c306bd'] = 'Mise à jour réussie';
$_MODULE['<{socialsharing}prestashop>socialsharing_00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Activé';
$_MODULE['<{socialsharing}prestashop>socialsharing_b9f5c797ebbf55adccdd8539a65a0241'] = 'Désactivé';
$_MODULE['<{socialsharing}prestashop>socialsharing_c9cc8cce247e49bae79f15173ce97354'] = 'Enregistrer';
$_MODULE['<{socialsharing}prestashop>socialsharing_368140d2caf6b43106964fd615756d1b'] = 'Comparaison de produits';
$_MODULE['<{socialsharing}prestashop>socialsharing_compare_6e55f5917f1f34501fc37388eb4b780d'] = 'Partager cette comparaison avec vos amis :';
$_MODULE['<{socialsharing}prestashop>socialsharing_compare_3746d4aa96f19672260a424d76729dd1'] = 'Tweet';
$_MODULE['<{socialsharing}prestashop>socialsharing_compare_5a95a425f74314a96f13a2f136992178'] = 'Partager';
$_MODULE['<{socialsharing}prestashop>socialsharing_compare_5b2c8bfd1bc974966209b7be1cb51a72'] = 'Google+';
$_MODULE['<{socialsharing}prestashop>socialsharing_compare_86709a608bd914b28221164e6680ebf7'] = 'Pinterest';
$_MODULE['<{socialsharing}prestashop>socialsharing_3746d4aa96f19672260a424d76729dd1'] = 'Tweet';
$_MODULE['<{socialsharing}prestashop>socialsharing_5a95a425f74314a96f13a2f136992178'] = 'Partager';
$_MODULE['<{socialsharing}prestashop>socialsharing_5b2c8bfd1bc974966209b7be1cb51a72'] = 'Google+';
$_MODULE['<{socialsharing}prestashop>socialsharing_86709a608bd914b28221164e6680ebf7'] = 'Pinterest';
return $_MODULE;

View File

@ -0,0 +1,35 @@
<?php
/*
* 2007-2014 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-2014 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;

View File

@ -0,0 +1,35 @@
<?php
/*
* 2007-2014 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-2014 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;

View File

@ -0,0 +1,53 @@
{*
* 2007-2014 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-2014 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 $PS_SC_TWITTER || $PS_SC_FACEBOOK || $PS_SC_GOOGLE || $PS_SC_PINTEREST}
<p class="socialsharing_product list-inline no-print">
{if $PS_SC_TWITTER}
<button data-type="twitter" type="button" class="btn btn-default btn-twitter social-sharing">
<i class="icon-twitter"></i> {l s="Tweet" mod='socialsharing'}
<!-- <img src="{$link->getMediaLink("`$module_dir`img/twitter.gif")}" alt="Tweet" /> -->
</button>
{/if}
{if $PS_SC_FACEBOOK}
<button data-type="facebook" type="button" class="btn btn-default btn-facebook social-sharing">
<i class="icon-facebook"></i> {l s="Share" mod='socialsharing'}
<!-- <img src="{$link->getMediaLink("`$module_dir`img/facebook.gif")}" alt="Facebook Like" /> -->
</button>
{/if}
{if $PS_SC_GOOGLE}
<button data-type="google-plus" type="button" class="btn btn-default btn-google-plus social-sharing">
<i class="icon-google-plus"></i> {l s="Google+" mod='socialsharing'}
<!-- <img src="{$link->getMediaLink("`$module_dir`img/google.gif")}" alt="Google Plus" /> -->
</button>
{/if}
{if $PS_SC_PINTEREST}
<button data-type="pinterest" type="button" class="btn btn-default btn-pinterest social-sharing">
<i class="icon-pinterest"></i> {l s="Pinterest" mod='socialsharing'}
<!-- <img src="{$link->getMediaLink("`$module_dir`img/pinterest.gif")}" alt="Pinterest" /> -->
</button>
{/if}
</p>
{/if}

View File

@ -0,0 +1,51 @@
{*
* 2007-2014 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-2014 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 $PS_SC_TWITTER || $PS_SC_FACEBOOK || $PS_SC_GOOGLE || $PS_SC_PINTEREST}
<div id="social-share-compare">
<p>{l s="Share this comparison with your friends:" mod='socialsharing'}</p>
<p class="socialsharing_product">
{if $PS_SC_TWITTER}
<button data-type="twitter" type="button" class="btn btn-default btn-twitter social-sharing">
<i class="icon-twitter"></i> {l s="Tweet" mod='socialsharing'}
</button>
{/if}
{if $PS_SC_FACEBOOK}
<button data-type="facebook" type="button" class="btn btn-default btn-facebook social-sharing">
<i class="icon-facebook"></i> {l s="Share" mod='socialsharing'}
</button>
{/if}
{if $PS_SC_GOOGLE}
<button data-type="google-plus" type="button" class="btn btn-default btn-google-plus social-sharing">
<i class="icon-google-plus"></i> {l s="Google+" mod='socialsharing'}
</button>
{/if}
{if $PS_SC_PINTEREST}
<button data-type="pinterest" type="button" class="btn btn-default btn-pinterest social-sharing">
<i class="icon-pinterest"></i> {l s="Pinterest" mod='socialsharing'}
</button>
{/if}
</p>
</div>
{/if}

View File

@ -0,0 +1,40 @@
{*
* 2007-2014 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-2014 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<meta property="og:type" content="product" />
<meta property="og:url" content="{$request}" />
<meta property="og:title" content="{$meta_title|escape:'html':'UTF-8'}" />
<meta property="og:site_name" content="{$shop_name}" />
<meta property="og:description" content="{$meta_description|escape:'html':'UTF-8'}" />
{if isset($link_rewrite) && isset($cover) && isset($cover.id_image)}
<meta property="og:image" content="{$link->getImageLink($link_rewrite, $cover.id_image, large_default)}" />
{/if}
<meta property="product:pretax_price:amount" content="{$pretax_price}" />
<meta property="product:pretax_price:currency" content="{$currency->iso_code}" />
<meta property="product:price:amount" content="{$price}" />
<meta property="product:price:currency" content="{$currency->iso_code}" />
{if isset($weight) && ($weight != 0)}
<meta property="product:weight:value" content="{$weight}" />
<meta property="product:weight:units" content="{$weight_unit}" />
{/if}

View File

@ -0,0 +1,35 @@
<?php
/*
* 2007-2014 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-2014 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;

@ -1 +0,0 @@
Subproject commit 95c5f5767e6f9092317625ff5d607d6d254a0359

View File

@ -0,0 +1,7 @@
2014-04-18 17:05:53 +0200 // update version for release
2014-04-18 16:55:22 +0200 [-] Fix retrocompat PrestaShop 1.5
2014-04-17 11:40:40 +0200 Bug fix (PS 1.5): ps_version_compliancy removed
2014-03-25 11:47:05 +0100 Merge branch 'master' of https://github.com/PrestaShop/vatnumber
2014-03-24 16:07:23 +0100 // Typo.
2014-03-24 15:23:12 +0100 / MO vatnumber : ps_versions_compliancy added
2014-03-20 14:41:47 +0100 Initial commit

View File

@ -0,0 +1,37 @@
# European VAT number
## About
Enables you to enter the intra-community VAT number when creating the address. You must fill in the company field to allow entering the VAT number.
## Contributing
PrestaShop modules are open-source extensions to the PrestaShop e-commerce solution. Everyone is welcome and even encouraged to contribute with their own improvements.
### Requirements
Contributors **must** follow the following rules:
* **Make your Pull Request on the "dev" branch**, NOT the "master" branch.
* Do not update the module's version number.
* Follow [the coding standards][1].
### Process in details
Contributors wishing to edit a module's files should follow the following process:
1. Create your GitHub account, if you do not have one already.
2. Fork the vatnumber project to your GitHub account.
3. Clone your fork to your local machine in the ```/modules``` directory of your PrestaShop installation.
4. Create a branch in your local clone of the module for your changes.
5. Change the files in your branch. Be sure to follow [the coding standards][1]!
6. Push your changed branch to your fork in your GitHub account.
7. Create a pull request for your changes **on the _'dev'_ branch** of the module's project. Be sure to follow [the commit message norm][2] in your pull request. If you need help to make a pull request, read the [Github help page about creating pull requests][3].
8. Wait for one of the core developers either to include your change in the codebase, or to comment on possible improvements you should make to your code.
That's it: you have contributed to this open-source project! Congratulations!
[1]: http://doc.prestashop.com/display/PS16/Coding+Standards
[2]: http://doc.prestashop.com/display/PS16/How+to+write+a+commit+message
[3]: https://help.github.com/articles/using-pull-requests

View File

@ -0,0 +1,45 @@
<?php
/*
* 2007-2014 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-2014 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
class VATNumberTaxManager implements TaxManagerInterface
{
public static function isAvailableForThisAddress(Address $address)
{
return (!empty($address->vat_number)
&& $address->id_country != Configuration::get('VATNUMBER_COUNTRY')
&& Configuration::get('VATNUMBER_MANAGEMENT')
);
}
public function getTaxCalculator()
{
// If the address matches the european vat number criterias no taxes are applied
$tax = new Tax();
$tax->rate = 0;
return new TaxCalculator(array($tax));
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
* 2007-2014 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-2014 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
include(dirname(__FILE__).'/../../config/config.inc.php');
include(dirname(__FILE__).'/../../init.php');
include(dirname(__FILE__).'/vatnumber.php');
echo VatNumber::isApplicable(Tools::getValue('id_country'));

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>vatnumber</name>
<displayName><![CDATA[European VAT number]]></displayName>
<version><![CDATA[1.7.2]]></version>
<description><![CDATA[Enables you to enter the intra-community VAT number when creating the address. You must fill in the company field to allow entering the VAT number.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[billing_invoicing]]></tab>
<is_configurable>1</is_configurable>
<need_instance>0</need_instance>
<limited_countries></limited_countries>
</module>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>vatnumber</name>
<displayName><![CDATA[Num&eacute;ro de TVA Europeen]]></displayName>
<version><![CDATA[1.7.2]]></version>
<description><![CDATA[Activer la saisie du num&eacute;ro de TVA intra-communautaire lors de la cr&eacute;ation de l&#039;adresse. Vous devez remplir le champ de la soci&eacute;t&eacute; pour permettre la saisie du num&eacute;ro de TVA.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[billing_invoicing]]></tab>
<is_configurable>1</is_configurable>
<need_instance>0</need_instance>
<limited_countries></limited_countries>
</module>

View File

@ -0,0 +1,36 @@
<?php
/*
* 2007-2014 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-2014 PrestaShop SA
* @version Release: $Revision$
* @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;

BIN
modules/vatnumber/logo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
modules/vatnumber/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -0,0 +1,23 @@
<?php
global $_MODULE;
$_MODULE = array();
$_MODULE['<{vatnumber}prestashop>vatnumber_b0b9a606a1c251323825ca45d40964dc'] = 'é';
$_MODULE['<{vatnumber}prestashop>vatnumber_cee549912e318726d2c4989bb507665f'] = 'Numéro de TVA Europeen';
$_MODULE['<{vatnumber}prestashop>vatnumber_9fa70ad6139f2a83269df74eb6747816'] = 'Activer la saisie du numéro de TVA intra-communautaire lors de la création de l\'adresse. Vous devez remplir le champ de la société pour permettre la saisie du numéro de TVA.';
$_MODULE['<{vatnumber}prestashop>vatnumber_162b29cf61678af2aaac37f440265c28'] = 'Votre pays a été mis à jour.';
$_MODULE['<{vatnumber}prestashop>vatnumber_0ca51bcd22e4d7b56b6f1d8a01cefc1f'] = 'La vérification du numéro de TVA avec le service web est maintenant activé.';
$_MODULE['<{vatnumber}prestashop>vatnumber_467c214bb76759108ece49873eda44e4'] = 'La vérification du numéro de TVA avec le service web est maintenant désactivé.';
$_MODULE['<{vatnumber}prestashop>vatnumber_038b34b36ec9eaf5f96d11e17f208f1b'] = 'Choisissez un pays';
$_MODULE['<{vatnumber}prestashop>vatnumber_f4f70727dc34561dfde1a3c529b6205c'] = 'Paramètres';
$_MODULE['<{vatnumber}prestashop>vatnumber_fa01fd956e87307bce4c90a0de9b0437'] = 'Pays du client';
$_MODULE['<{vatnumber}prestashop>vatnumber_c0859b0a5241dff468da2a9a93c3284f'] = 'Filtrer les clients par pays';
$_MODULE['<{vatnumber}prestashop>vatnumber_da0e4b4c2ffe78456b5a1d67fd854389'] = 'Activer la vérification du numéro de TVA via le service web';
$_MODULE['<{vatnumber}prestashop>vatnumber_59e1a8522a3bfca342cd7110b1d67b24'] = 'La vérification par le service web est lent. Activer cette option peut ralentir votre boutique.';
$_MODULE['<{vatnumber}prestashop>vatnumber_00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Activé';
$_MODULE['<{vatnumber}prestashop>vatnumber_b9f5c797ebbf55adccdd8539a65a0241'] = 'Désactivé';
$_MODULE['<{vatnumber}prestashop>vatnumber_c9cc8cce247e49bae79f15173ce97354'] = 'Enregistrer';
return $_MODULE;

View File

@ -0,0 +1,35 @@
<?php
/*
* 2007-2014 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-2014 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;

View File

@ -0,0 +1,293 @@
<?php
/*
* 2007-2014 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-2014 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 VatNumber extends TaxManagerModule
{
public function __construct()
{
$this->name = 'vatnumber';
$this->tab = 'billing_invoicing';
$this->version = '1.7.2';
$this->author = 'PrestaShop';
$this->need_instance = 0;
$this->tax_manager_class = 'VATNumberTaxManager';
$this->bootstrap = true;
parent::__construct();
$id_country = (int)Configuration::get('VATNUMBER_COUNTRY');
if ($id_country == 0)
$this->warning = $this->l('No default country set.');
$this->displayName = $this->l('European VAT number');
$this->description = $this->l('Enables you to enter the intra-community VAT number when creating the address. You must fill in the company field to allow entering the VAT number.');
}
public function install()
{
return (parent::install() && Configuration::updateValue('VATNUMBER_MANAGEMENT', 1));
}
public function uninstall()
{
return (parent::uninstall() && Configuration::updateValue('VATNUMBER_MANAGEMENT', 0));
}
public function enable($force_all = false)
{
parent::enable($force_all);
Configuration::updateValue('VATNUMBER_MANAGEMENT', 1);
}
public function disable($force_all = false)
{
parent::disable($force_all);
Configuration::updateValue('VATNUMBER_MANAGEMENT', 0);
}
public static function getPrefixIntracomVAT()
{
$intracom_array = array(
'AT' => 'AT',
//Austria
'BE' => 'BE',
//Belgium
'DK' => 'DK',
//Denmark
'FI' => 'FI',
//Finland
'FR' => 'FR',
//France
'FX' => 'FR',
//France métropolitaine
'DE' => 'DE',
//Germany
'GR' => 'EL',
//Greece
'IE' => 'IE',
//Irland
'IT' => 'IT',
//Italy
'LU' => 'LU',
//Luxembourg
'NL' => 'NL',
//Netherlands
'PT' => 'PT',
//Portugal
'ES' => 'ES',
//Spain
'SE' => 'SE',
//Sweden
'GB' => 'GB',
//United Kingdom
'CY' => 'CY',
//Cyprus
'EE' => 'EE',
//Estonia
'HU' => 'HU',
//Hungary
'LV' => 'LV',
//Latvia
'LT' => 'LT',
//Lithuania
'MT' => 'MT',
//Malta
'PL' => 'PL',
//Poland
'SK' => 'SK',
//Slovakia
'CZ' => 'CZ',
//Czech Republic
'SI' => 'SI',
//Slovenia
'RO' => 'RO',
//Romania
'BG' => 'BG',
//Bulgaria
'HR' => 'HR',
//Croatia
);
return $intracom_array;
}
public static function isApplicable($id_country)
{
return (((int)$id_country && array_key_exists(Country::getIsoById($id_country), self::getPrefixIntracomVAT())) ? 1 : 0);
}
public static function WebServiceCheck($vat_number)
{
if (empty($vat_number))
return array();
$vat_number = str_replace(' ', '', $vat_number);
$prefix = Tools::substr($vat_number, 0, 2);
if (array_search($prefix, self::getPrefixIntracomVAT()) === false)
return array(Tools::displayError('Invalid VAT number'));
$vat = Tools::substr($vat_number, 2);
$url = 'http://ec.europa.eu/taxation_customs/vies/viesquer.do?ms='.urlencode($prefix).'&iso='.urlencode($prefix).'&vat='.urlencode($vat);
@ini_set('default_socket_timeout', 2);
for ($i = 0; $i < 3; $i++)
{
if ($page_res = Tools::file_get_contents($url))
{
if (preg_match('/invalid VAT number/i', $page_res))
{
@ini_restore('default_socket_timeout');
return array(Tools::displayError('VAT number not found'));
}
else if (preg_match('/valid VAT number/i', $page_res))
{
@ini_restore('default_socket_timeout');
return array();
}
else
++$i;
}
else
sleep(1);
}
@ini_restore('default_socket_timeout');
return array(Tools::displayError('VAT number validation service unavailable'));
}
public function getContent()
{
$echo = '';
if (Tools::isSubmit('submitVatNumber'))
{
if (Configuration::updateValue('VATNUMBER_COUNTRY', (int)Tools::getValue('VATNUMBER_COUNTRY')))
$echo .= $this->displayConfirmation($this->l('Your country has been updated.'));
if (Configuration::updateValue('VATNUMBER_CHECKING', (int)Tools::getValue('VATNUMBER_CHECKING')))
$echo .= ((bool)Tools::getValue('VATNUMBER_CHECKING') ? $this->displayConfirmation($this->l('The check of the VAT number with the WebService is now enabled.')) : $this->displayConfirmation($this->l('The check of the VAT number with the WebService is now disabled.')));
}
$echo .= $this->renderForm();
return $echo;
}
public function renderForm()
{
$countries = Country::getCountries($this->context->language->id);
$countries_fmt = array(
0 => array(
'id' => 0,
'name' => $this->l('-- Choose a country --')
)
);
foreach ($countries as $country)
$countries_fmt[] = array(
'id' => $country['id_country'],
'name' => $country['name']
);
$fields_form = array(
'form' => array(
'legend' => array(
'title' => $this->l('Settings'),
'icon' => 'icon-cogs'
),
'input' => array(
array(
'type' => 'select',
'label' => $this->l('Customers\' country'),
'desc' => $this->l('Operate a filter on customers\' country.'),
'name' => 'VATNUMBER_COUNTRY',
'required' => false,
'default_value' => (int)$this->context->country->id,
'options' => array(
'query' => $countries_fmt,
'id' => 'id',
'name' => 'name',
)
),
array(
'type' => 'switch',
'label' => $this->l('Enable checking of the VAT number with the web service'),
'name' => 'VATNUMBER_CHECKING',
'is_bool' => true,
'desc' => $this->l('The verification by the web service is slow. Enabling this option can slow down your shop.'),
'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'),
)
),
);
$helper = new HelperForm();
$helper->module = $this;
$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 = 'submitVatNumber';
$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(
'VATNUMBER_COUNTRY' => Tools::getValue('VATNUMBER_COUNTRY', Configuration::get('VATNUMBER_COUNTRY')),
'VATNUMBER_CHECKING' => Tools::getValue('VATNUMBER_CHECKING', Configuration::get('VATNUMBER_CHECKING')),
);
}
}

View File

@ -0,0 +1,35 @@
<?php
/*
* 2007-2014 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-2014 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;

View File

@ -0,0 +1,52 @@
{*
* 2007-2014 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-2014 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{extends file="helpers/form/form.tpl"}
{block name="input"}
{if $input.type == 'switch' && $smarty.const._PS_VERSION_|@addcslashes:'\'' < '1.6'}
{foreach $input.values as $value}
<input type="radio" name="{$input.name}" id="{$value.id}" value="{$value.value|escape:'html':'UTF-8'}"
{if $fields_value[$input.name] == $value.value}checked="checked"{/if}
{if isset($input.disabled) && $input.disabled}disabled="disabled"{/if} />
<label class="t" for="{$value.id}">
{if isset($input.is_bool) && $input.is_bool == true}
{if $value.value == 1}
<img src="../img/admin/enabled.gif" alt="{$value.label}" title="{$value.label}" />
{else}
<img src="../img/admin/disabled.gif" alt="{$value.label}" title="{$value.label}" />
{/if}
{else}
{$value.label}
{/if}
</label>
{if isset($input.br) && $input.br}<br />{/if}
{if isset($value.p) && $value.p}<p>{$value.p}</p>{/if}
{/foreach}
{else}
{$smarty.block.parent}
{/if}
{/block}

View File

@ -0,0 +1,35 @@
<?php
/*
* 2007-2014 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-2014 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;

View File

@ -0,0 +1,35 @@
<?php
/*
* 2007-2014 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-2014 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;