// fix new theme / old php in modules

This commit is contained in:
mMarinetti
2011-12-02 16:41:22 +00:00
parent 3cd97f8ae5
commit 301d26fbce
66 changed files with 955 additions and 847 deletions
+1 -1
View File
@@ -201,7 +201,7 @@ class authorizeAIM extends PaymentModule
public function hookHeader() public function hookHeader()
{ {
Tools::addJS(_PS_JS_DIR_.'jquery/jquery.validate.creditcard2-1.0.1.js'); $this->context->controller->addJS(_PS_JS_DIR_.'jquery/jquery.validate.creditcard2-1.0.1.js');
} }
/** /**
+4
View File
@@ -204,6 +204,7 @@ class BankWire extends PaymentModule
$state = $params['objOrder']->getCurrentState(); $state = $params['objOrder']->getCurrentState();
if ($state == Configuration::get('PS_OS_BANKWIRE') OR $state == Configuration::get('PS_OS_OUTOFSTOCK')) if ($state == Configuration::get('PS_OS_BANKWIRE') OR $state == Configuration::get('PS_OS_OUTOFSTOCK'))
{
$this->context->smarty->assign(array( $this->context->smarty->assign(array(
'total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false), 'total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false),
'bankwireDetails' => Tools::nl2br($this->details), 'bankwireDetails' => Tools::nl2br($this->details),
@@ -212,6 +213,9 @@ class BankWire extends PaymentModule
'status' => 'ok', 'status' => 'ok',
'id_order' => $params['objOrder']->id 'id_order' => $params['objOrder']->id
)); ));
if (isset($params['objOrder']->reference) && !empty($params['objOrder']->reference))
$this->context->smarty->assign('reference', $params['objOrder']->reference);
}
else else
$this->context->smarty->assign('status', 'failed'); $this->context->smarty->assign('status', 'failed');
return $this->display(__FILE__, 'payment_return.tpl'); return $this->display(__FILE__, 'payment_return.tpl');
-1
View File
@@ -93,7 +93,6 @@ class BlockCart extends Module
'wrapping_cost' => Tools::displayPrice($wrappingCost, $currency), 'wrapping_cost' => Tools::displayPrice($wrappingCost, $currency),
'product_total' => Tools::displayPrice($params['cart']->getOrderTotal($useTax, Cart::BOTH_WITHOUT_SHIPPING), $currency), 'product_total' => Tools::displayPrice($params['cart']->getOrderTotal($useTax, Cart::BOTH_WITHOUT_SHIPPING), $currency),
'total' => Tools::displayPrice($totalToPay, $currency), 'total' => Tools::displayPrice($totalToPay, $currency),
'id_carrier' => (int)($params['cart']->id_carrier),
'order_process' => Configuration::get('PS_ORDER_PROCESS_TYPE') ? 'order-opc' : 'order', 'order_process' => Configuration::get('PS_ORDER_PROCESS_TYPE') ? 'order-opc' : 'order',
'ajax_allowed' => (int)(Configuration::get('PS_BLOCK_CART_AJAX')) == 1 ? true : false 'ajax_allowed' => (int)(Configuration::get('PS_BLOCK_CART_AJAX')) == 1 ? true : false
)); ));
+2 -2
View File
@@ -87,7 +87,7 @@ class BlockCategories extends Module
Configuration::updateValue('BLOCK_CATEG_NBR_COLUMN_FOOTER', $nbrColumns); Configuration::updateValue('BLOCK_CATEG_NBR_COLUMN_FOOTER', $nbrColumns);
Configuration::updateValue('BLOCK_CATEG_SORT_WAY', Tools::getValue('BLOCK_CATEG_SORT_WAY')); Configuration::updateValue('BLOCK_CATEG_SORT_WAY', Tools::getValue('BLOCK_CATEG_SORT_WAY'));
Configuration::updateValue('BLOCK_CATEG_SORT', Tools::getValue('BLOCK_CATEG_SORT')); Configuration::updateValue('BLOCK_CATEG_SORT', Tools::getValue('BLOCK_CATEG_SORT'));
$this->_clearBlockcategoriesCache(); $this->_clearBlockcategoriesCache();
$output .= '<div class="conf confirm"><img src="../img/admin/ok.gif" alt="'.$this->l('Confirmation').'" />'.$this->l('Settings updated').'</div>'; $output .= '<div class="conf confirm"><img src="../img/admin/ok.gif" alt="'.$this->l('Confirmation').'" />'.$this->l('Settings updated').'</div>';
} }
@@ -121,7 +121,7 @@ class BlockCategories extends Module
<input type="radio" name="BLOCK_CATEG_SORT" id="sort_on" value="0" '.(!Tools::getValue('BLOCK_CATEG_SORT', Configuration::get('BLOCK_CATEG_SORT')) ? 'checked="checked" ' : '').'/> <input type="radio" name="BLOCK_CATEG_SORT" id="sort_on" value="0" '.(!Tools::getValue('BLOCK_CATEG_SORT', Configuration::get('BLOCK_CATEG_SORT')) ? 'checked="checked" ' : '').'/>
<label class="t" for="sort_on"> <img src="../modules/'.$this->name.'/sort_number.png" alt="'.$this->l('Enabled').'" title="'.$this->l('By position').'" />'.$this->l('By position').'</label> <label class="t" for="sort_on"> <img src="../modules/'.$this->name.'/sort_number.png" alt="'.$this->l('Enabled').'" title="'.$this->l('By position').'" />'.$this->l('By position').'</label>
<input type="radio" name="BLOCK_CATEG_SORT" id="sort_off" value="1" '.(Tools::getValue('BLOCK_CATEG_SORT', Configuration::get('BLOCK_CATEG_SORT')) ? 'checked="checked" ' : '').'/> <input type="radio" name="BLOCK_CATEG_SORT" id="sort_off" value="1" '.(Tools::getValue('BLOCK_CATEG_SORT', Configuration::get('BLOCK_CATEG_SORT')) ? 'checked="checked" ' : '').'/>
<label class="t" for="sort_off"> <img src="../modules/'.$this->name.'/sort_alphabet.png" alt="'.$this->l('Disabled').'" title="'.$this->l('By name').'" />'.$this->l('By name').'</label> - <label class="t" for="sort_off"> <img src="../modules/'.$this->name.'/sort_alphabet.png" alt="'.$this->l('Disabled').'" title="'.$this->l('By name').'" />'.$this->l('By name').'</label> -
<select name="BLOCK_CATEG_SORT_WAY"> <select name="BLOCK_CATEG_SORT_WAY">
<option value="0" '.(!Tools::getValue('BLOCK_CATEG_SORT_WAY', Configuration::get('BLOCK_CATEG_SORT_WAY')) ? 'selected="selected" ' : '').'>'.$this->l('Ascending').'</option> <option value="0" '.(!Tools::getValue('BLOCK_CATEG_SORT_WAY', Configuration::get('BLOCK_CATEG_SORT_WAY')) ? 'selected="selected" ' : '').'>'.$this->l('Ascending').'</option>
<option value="1" '.(Tools::getValue('BLOCK_CATEG_SORT_WAY', Configuration::get('BLOCK_CATEG_SORT_WAY')) ? 'selected="selected" ' : '').'>'.$this->l('Descending').'</option> <option value="1" '.(Tools::getValue('BLOCK_CATEG_SORT_WAY', Configuration::get('BLOCK_CATEG_SORT_WAY')) ? 'selected="selected" ' : '').'>'.$this->l('Descending').'</option>
+14 -22
View File
@@ -1,13 +1,13 @@
<?php <?php
/* /*
* 2007-2010 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
* This source file is subject to the Open Software License (OSL 3.0) * This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt. * that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL: * It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php * http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to * 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 * obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately. * to license@prestashop.com so we can send you a copy immediately.
@@ -18,10 +18,10 @@
* versions in the future. If you wish to customize PrestaShop for your * versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information. * needs please refer to http://www.prestashop.com for more information.
* *
* @author Prestashop SA <contact@prestashop.com> * @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2010 Prestashop SA * @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 1.4 $ * @version Release: $Revision: 6844 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*/ */
@@ -44,7 +44,7 @@ class blockcontact extends Module
public function install() public function install()
{ {
return (parent::install() AND Configuration::updateValue('blockcontact_telnumber', '') AND Configuration::updateValue('blockcontact_email', '') AND $this->registerHook('rightColumn') && $this->registerHook('header')); return (parent::install() AND Configuration::updateValue('blockcontact_telnumber', '') AND Configuration::updateValue('blockcontact_email', '') AND $this->registerHook('rightColumn'));
} }
public function uninstall() public function uninstall()
@@ -66,27 +66,19 @@ class blockcontact extends Module
return ' return '
<h2>'.$this->displayName.'</h2> <h2>'.$this->displayName.'</h2>
<form action="'.Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']).'" method="post"> <form action="'.Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']).'" method="post">
<fieldset class="width2"> <fieldset>
<label for="telnumber">'.$this->l('Telephone number : ').'</label> <label for="telnumber">'.$this->l('Telephone number : ').'</label>
<input type="text" id="telnumber" name="telnumber" value="'.((Configuration::get('blockcontact_telnumber') != "") ? Configuration::get('blockcontact_telnumber') : "").'" /> <input type="text" id="telnumber" name="telnumber" value="'.((Configuration::get('blockcontact_telnumber') != "") ? Configuration::get('blockcontact_telnumber') : "").'" />
<div class="clear">&nbsp;</div> <div class="clear">&nbsp;</div>
<label for="email">'.$this->l('Email : ').'</label> <label for="email">'.$this->l('Email : ').'</label>
<input type="text" id="email" name="email" value="'.((Configuration::get('blockcontact_email') != "") ? Configuration::get('blockcontact_email') : "").'" /> <input type="text" id="email" name="email" value="'.((Configuration::get('blockcontact_email') != "") ? Configuration::get('blockcontact_email') : "").'" />
<div class="clear">&nbsp;</div> <div class="clear">&nbsp;</div>
<br /><center><input type="submit" name="submitModule" value="'.$this->l('Update settings').'" class="button" /></center> <div class="margin-form">
<input type="submit" name="submitModule" value="'.$this->l('Update settings').'" class="button" /></center>
</div>
</fieldset> </fieldset>
</form> </form>
<div class="clear">&nbsp;</div> ';
<fieldset>
<legend>Addons</legend>
'.$this->l('This module has been developped by PrestaShop and can only be sold through').' <a href="http://addons.prestashop.com">addons.prestashop.com</a>.<br />
'.$this->l('Please report all bugs to').' <a href="mailto:addons@prestashop.com">addons@prestashop.com</a> '.$this->l('or using our').' <a href="http://addons.prestashop.com/contact-form.php">'.$this->l('contact form').'</a>.
</fieldset>';
}
public function hookHeader()
{
$this->context->controller->addCSS(($this->_path).'blockcontact.css', 'all');
} }
public function hookRightColumn() public function hookRightColumn()
@@ -100,4 +92,4 @@ class blockcontact extends Module
return $this->display(__FILE__, 'blockcontact.tpl'); return $this->display(__FILE__, 'blockcontact.tpl');
} }
} }
?> ?>
+13 -17
View File
@@ -1,13 +1,13 @@
<?php <?php
/* /*
* 2007-2010 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
* This source file is subject to the Open Software License (OSL 3.0) * This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt. * that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL: * It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php * http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to * 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 * obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately. * to license@prestashop.com so we can send you a copy immediately.
@@ -18,10 +18,10 @@
* versions in the future. If you wish to customize PrestaShop for your * versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information. * needs please refer to http://www.prestashop.com for more information.
* *
* @author Prestashop SA <contact@prestashop.com> * @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2010 Prestashop SA * @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 1.4 $ * @version Release: $Revision: 6844 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*/ */
@@ -78,25 +78,21 @@ class blockcontactinfos extends Module
$content = ' $content = '
<h2>'.$this->displayName.'</h2> <h2>'.$this->displayName.'</h2>
<form action="'.Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']).'" method="post"> <form action="'.Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']).'" method="post">
<fieldset class="width2"> <fieldset>
<p><label for="company">'.$this->l('Company name').' :</label> <p><label for="company">'.$this->l('Company name').' :</label>
<input type="text" id="company" name="company" value="'.Configuration::get('blockcontactinfos_company').'" /></p> <input type="text" id="company" name="company" value="'.Configuration::get('blockcontactinfos_company').'" /></p>
<p><label for="address">'.$this->l('Address').' :</label> <p><label for="address">'.$this->l('Address').' :</label>
<textarea id="address" name="address">'.Configuration::get('blockcontactinfos_address').'</textarea></p> <textarea id="address" name="address" cols="60" rows="4">'.Configuration::get('blockcontactinfos_address').'</textarea></p>
<p><label for="phone">'.$this->l('Phone number').' :</label> <p><label for="phone">'.$this->l('Phone number').' :</label>
<input type="text" id="phone" name="phone" value="'.Configuration::get('blockcontactinfos_phone').'" /></p> <input type="text" id="phone" name="phone" value="'.Configuration::get('blockcontactinfos_phone').'" /></p>
<p><label for="email">'.$this->l('Email').' :</label> <p><label for="email">'.$this->l('Email').' :</label>
<input type="text" id="email" name="email" value="'.Configuration::get('blockcontactinfos_email').'" /> </p> <input type="text" id="email" name="email" value="'.Configuration::get('blockcontactinfos_email').'" /> </p>
<div class="clear">&nbsp;</div> <div class="margin-form">
<br /><center><input type="submit" name="submitModule" value="'.$this->l('Update settings').'" class="button" /></center> <input type="submit" name="submitModule" value="'.$this->l('Update settings').'" class="button" /></center>
</div>
</fieldset> </fieldset>
</form> </form>
<div class="clear">&nbsp;</div> ';
<fieldset>
<legend>Addons</legend>
'.$this->l('This module has been developped by PrestaShop and can only be sold through').' <a href="http://addons.prestashop.com">addons.prestashop.com</a>.<br />
'.$this->l('Please report all bugs to').' <a href="mailto:addons@prestashop.com">addons@prestashop.com</a> '.$this->l('or using our').' <a href="http://addons.prestashop.com/contact-form.php">'.$this->l('contact form').'</a>.
</fieldset>';
return $content; return $content;
} }
@@ -62,6 +62,7 @@ class BlockCurrencies extends Module
if (!count(Currency::getCurrencies())) if (!count(Currency::getCurrencies()))
return ''; return '';
// @todo remove this and use smartyTemplate
$this->context->smarty->assign('blockcurrencies_sign', $this->context->currency->sign); $this->context->smarty->assign('blockcurrencies_sign', $this->context->currency->sign);
return $this->display(__FILE__, 'blockcurrencies.tpl'); return $this->display(__FILE__, 'blockcurrencies.tpl');
} }
@@ -1,13 +1,13 @@
<?php <?php
/* /*
* 2007-2010 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
* This source file is subject to the Open Software License (OSL 3.0) * This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt. * that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL: * It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php * http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to * 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 * obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately. * to license@prestashop.com so we can send you a copy immediately.
@@ -18,10 +18,10 @@
* versions in the future. If you wish to customize PrestaShop for your * versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information. * needs please refer to http://www.prestashop.com for more information.
* *
* @author Prestashop SA <contact@prestashop.com> * @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2010 Prestashop SA * @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 1.4 $ * @version Release: $Revision: 6844 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*/ */
@@ -103,3 +103,4 @@ class blockmyaccountfooter extends Module
} }
-36
View File
@@ -1,36 +0,0 @@
<?php
/*
* 2007-2011 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-2011 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 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;
@@ -55,7 +55,7 @@ class BlockPermanentLinks extends Module
* @param array $params Parameters * @param array $params Parameters
* @return string Content * @return string Content
*/ */
function hookDisplayTop($params) function hookTop($params)
{ {
return $this->display(__FILE__, 'blockpermanentlinks-header.tpl'); return $this->display(__FILE__, 'blockpermanentlinks-header.tpl');
} }
@@ -75,13 +75,13 @@ class BlockPermanentLinks extends Module
{ {
return $this->hookLeftColumn($params); return $this->hookLeftColumn($params);
} }
function hookDisplayFooter($params) function hookFooter($params)
{ {
return $this->display(__FILE__, 'blockpermanentlinks-footer.tpl'); return $this->display(__FILE__, 'blockpermanentlinks-footer.tpl');
} }
function hookDisplayHeader($params) function hookHeader($params)
{ {
$this->context->controller->addCSS(($this->_path).'blockpermanentlinks.css', 'all'); $this->context->controller->addCSS(($this->_path).'blockpermanentlinks.css', 'all');
} }
+152 -277
View File
@@ -1,13 +1,13 @@
<?php <?php
/* /*
* 2007-2010 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
* This source file is subject to the Open Software License (OSL 3.0) * This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt. * that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL: * It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php * http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to * 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 * obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately. * to license@prestashop.com so we can send you a copy immediately.
@@ -18,314 +18,189 @@
* versions in the future. If you wish to customize PrestaShop for your * versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information. * needs please refer to http://www.prestashop.com for more information.
* *
* @author Prestashop SA <contact@prestashop.com> * @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2010 Prestashop SA * @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 1.4 $ * @version Release: $Revision: 6844 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*/ */
if (!defined('_PS_VERSION_')) if (!defined('_CAN_LOAD_FILES_'))
exit; exit;
class Blockreinsurance extends Module class blockreinsurance extends Module
{ {
protected $_html = '';
public function __construct() public function __construct()
{ {
$this->name = 'blockreinsurance'; $this->name = 'blockreinsurance';
$this->tab = 'front_office_features'; if(version_compare(_PS_VERSION_, '1.4.0.0') >= 0)
$this->tab = 'front_office_features';
else
$this->tab = 'Blocks';
$this->version = '1.0'; $this->version = '1.0';
$this->author = 'PrestaShop';
$this->need_instance = 0;
parent::__construct(); parent::__construct();
$this->displayName = $this->l('Block reinsurance'); $this->displayName = $this->l('Bloc reinsurance');
$this->description = $this->l('Adds a block to display more infos to reassure your customers'); $this->description = $this->l('Add a block to display more infos to reassure your customers');
} }
public function install() public function install()
{ {
// Module installation return (parent::install() AND $this->installDB() AND Configuration::updateValue('blockreinsurance_nbblocks', 5) AND $this->registerHook('footer'));
$res = parent::install();
// Table creation
$res &= Db::getInstance()->Execute('
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'reinsurance` (
`id_reinsurance` INT UNSIGNED NOT NULL,
`filename` VARCHAR(100) NOT NULL,
PRIMARY KEY (`id_reinsurance`)
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8');
$res &= Db::getInstance()->Execute('
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'reinsurance_lang` (
`id_reinsurance` INT UNSIGNED NOT NULL,
`id_lang` INT UNSIGNED NOT NULL,
`text` VARCHAR(300) NOT NULL,
PRIMARY KEY (`id_reinsurance`, `id_lang`)
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8');
$res &= $this->registerHook('header') AND $this->example();
return $res;
} }
public function installDB()
{
return Db::getInstance()->execute('
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'reinsurance` (
`id_contactinfos` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`filename` VARCHAR(100) NOT NULL,
`text` VARCHAR(300) NOT NULL,
PRIMARY KEY (`id_contactinfos`)
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8 ;');
}
public function uninstall() public function uninstall()
{ {
// Drop table //Delete configuration
$res = Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'reinsurance`'); return (Configuration::deleteByName('blockreinsurance_nbblocks') AND $this->uninstallDB() AND parent::uninstall());
$res &= Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'reinsurance_lang`');
// Uninstall module
$res &= parent::uninstall();
return $res;
} }
public function uninstallDB()
private function example()
{ {
$res = Db::getInstance()->Execute("INSERT INTO `"._DB_PREFIX_."reinsurance` VALUES return Db::getInstance()->execute('
(1, '10299ef6635307f2b4da1e04471ec981.jpg'), DROP TABLE IF EXISTS `'._DB_PREFIX_.'reinsurance`');
(2, 'd02eaac9390f84f26fe9c5cae966a8f7.jpg'),
(3, 'b889e72091b006fd444f63e5de030604.jpg'),
(4, 'a215cb7a215c6976be8b2b80f02765b0.jpg'),
(5, '0f9d7fd7d13cfb5672ac7830be60d6a8.jpg');");
$res &= Db::getInstance()->Execute("INSERT INTO `"._DB_PREFIX_."reinsurance_lang` VALUES
(1, 1, 'Money-back guarantee'),
(1, 2, 'SATISFAIT OU REMBOURSE'),
(1, 3, 'Money-back guarantee'),
(1, 4, 'Money-back guarantee'),
(1, 5, 'Money-back guarantee'),
(2, 1, 'Satisfied or refunded'),
(2, 2, 'ECHANGE EN MAGASIN'),
(2, 3, 'Satisfied or refunded'),
(2, 4, 'Satisfied or refunded'),
(2, 5, 'Satisfied or refunded'),
(3, 1, 'Shipped and paid'),
(3, 2, 'PAIEMENT A L''EXPEDITION'),
(3, 3, 'Shipped and paid'),
(3, 4, 'Shipped and paid'),
(3, 5, 'Shipped and paid'),
(4, 1, 'Free delivery'),
(4, 2, 'LIVRAISON GRATUITE'),
(4, 3, 'Free delivery'),
(4, 4, 'Free delivery'),
(4, 5, 'Free delivery'),
(5, 1, 'Secure payment'),
(5, 2, 'PAIEMENT 100% SECURISE'),
(5, 3, 'Secure payment'),
(5, 4, 'Secure payment'),
(5, 5, 'Secure payment');");
return $res;
} }
public function addToDB()
{
if(isset($_POST['nbblocks']))
{
for($i = 1; $i <= (int)$_POST['nbblocks']; $i++)
{
$filename = explode('.', $_FILES['info'.$i.'_file']['name']);
if (isset($_FILES['info'.$i.'_file']) AND isset($_FILES['info'.$i.'_file']['tmp_name']) AND !empty($_FILES['info'.$i.'_file']['tmp_name']))
{
if ($error = checkImage($_FILES['info'.$i.'_file']))
return false;
elseif (!$tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS') OR !move_uploaded_file($_FILES['info'.$i.'_file']['tmp_name'], $tmpName))
return false;
elseif (!imageResize($tmpName, dirname(__FILE__).'/img/'.$filename[0].'.jpg'))
return false;
unlink($tmpName);
}
Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'reinsurance` (`filename`,`text`)
VALUES ("'.((isset($filename[0]) AND $filename[0] != '') ? pSQL($filename[0]) : '').
'", "'.((isset($_POST['info'.$i.'_text']) AND $_POST['info'.$i.'_text'] != '') ? pSQL($_POST['info'.$i.'_text']) : '').'")');
}
return true;
} else
return false;
}
public function removeFromDB()
{
$dir = opendir(dirname(__FILE__).'/img');
while (false !== ($file = readdir($dir)))
{
$path = dirname(__FILE__).'/img/'.$file;
if ($file != ".." AND $file != "." AND !is_dir($file))
{
unlink($path);
}
}
closedir($dir);
return Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'reinsurance`');
}
public function getAllFromDB()
{
return Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'reinsurance`');
}
public function getContent() public function getContent()
{ {
$this->_html = '<h2>'.$this->displayName.'.</h2>'; // If we try to update the settings
if (isset($_POST['submitModule']))
if (Tools::isSubmit('submitBlock')) {
$this->postProcess(); Configuration::updateValue('blockreinsurance_nbblocks', ((isset($_POST['nbblocks']) AND $_POST['nbblocks'] != '') ? (int)$_POST['nbblocks'] : ''));
$this->displayForm(); if($this->removeFromDB() && $this->addToDB())
echo '<div class="conf confirm"><img src="../img/admin/ok.gif"/>'.$this->l('Configuration updated').'</div>';
return $this->_html;
}
protected function displayForm()
{
$languages = Language::getLanguages(false);
$default_language = Configuration::get('PS_LANG_DEFAULT');
$div_id_language = 'block_1_language¤block_2_language¤block_3_language¤block_4_language¤block_5_language';
$data = $this->getAllReinsurances();
$reinssuarances = array();
foreach ($data as $row)
$reinssuarances[$row['id_reinsurance']][$row['id_lang']] = $row;
$this->_html .= '
<script type="text/javascript">id_language = Number('.$default_language.');</script>
<form method="POST" action="'.Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']).'" enctype="multipart/form-data">
<fieldset class="width2">
<legend>'.$this->l('Block configuration').'</legend>
';
for ($i = 1; $i != 6; $i++)
{
$this->_html .= '
<h3>Block '.$i.'</h3>
';
if ($i == 1)
$this->_html .= '<p style="color: red;">'.$this->l('This block is required').'</p>';
if (isset($reinssuarances[$i][$default_language]) && $reinssuarances[$i][$default_language]['filename'] != null)
$this->_html .= '<div class="margin-form">
<img src="'.$this->_path.'/img/'.$reinssuarances[$i][$default_language]['filename'].'" alt="'.$reinssuarances[$i][$default_language]['text'].'" />
</div>';
$this->_html .= '
<label>'.$this->l('Image:').'</label>
<div class="margin-form">
<input type="file" name="images['.$i.']" />
</div>
';
foreach ($languages as $lang)
$this->_html .= '
<div id="block_'.$i.'_language_'.$lang['id_lang'].'" style="display: '.($lang['id_lang'] == $default_language ? 'block' : 'none').'; float:left;">
<label>'.$this->l('Text:').'</label>
<input type="text" name="texts['.$i.']['.$lang['id_lang'].']" value="'.((isset($reinssuarances[$i][$lang['id_lang']]) && $reinssuarances[$i][$lang['id_lang']]['text']) ? Tools::htmlentitiesUTF8($reinssuarances[$i][$lang['id_lang']]['text']) : 'default').'" />
</div>
';
$this->_html .= $this->displayFlags($languages, $default_language, $div_id_language, 'block_'.$i.'_language', true);
$this->_html .= '
<div class="clear"></div>
';
if ($i != 5)
$this->_html.= '<hr />';
}
$this->_html .= '
<p class="center">
<input type="submit" class="button" name="submitBlock" value="'.$this->l('Save').'" />
</p>
</fieldset>
</form>
';
return $this->_html;
}
protected function postProcess()
{
$languages = Language::getLanguages(false);
$default_language = Configuration::get('PS_LANG_DEFAULT');
$max_image_size = 2 * 1024 * 1024; // 2 Mb
$errors = array();
$res = 1;
for ($i = 1; $i < 6; $i++)
{
$image_name = $_FILES['images']['name'][$i];
if ($image_name != null)
{
$new_image_name = md5($image_name).'.jpg';
$file = array();
$file['name'] = $_FILES['images']['name'][$i];
$file['tmp_name'] = $_FILES['images']['tmp_name'][$i];
$file['type'] = $_FILES['images']['type'][$i];
$file['error'] = $_FILES['images']['error'][$i];
$file['size'] = $_FILES['images']['size'][$i];
if ($error = checkImage($file, $max_image_size))
$errors[] = $error;
elseif (!move_uploaded_file($file['tmp_name'], dirname(__FILE__).'/img/'.$new_image_name))
$errors[] = $this->l('An error occurred during the image upload.');
if (!sizeof($errors))
{
// Clear old rows
$res &= $this->cleanDb($i);
// New rows
$res &= Db::getInstance()->Execute('
INSERT INTO `'._DB_PREFIX_.'reinsurance` (`id_reinsurance`, `filename`)
VALUES (\''.(int)$i.'\', \''.(isset($new_image_name) ? pSQL($new_image_name) : '').'\')
');
}
}
}
foreach ($_POST['texts'] as $key => $text)
{
$res &= $this->cleanTxt($key);
if ($text[$default_language] != null && Validate::isCleanHtml($text[$default_language]))
{
if (!sizeof($errors))
{
foreach ($languages as $lang)
{
if ($text[$lang['id_lang']] == '' || !Validate::isCleanHtml($text[$lang['id_lang']]))
$text[$lang['id_lang']] = $text[$default_language];
$res &= Db::getInstance()->Execute('
INSERT INTO `'._DB_PREFIX_.'reinsurance_lang` (`id_reinsurance`, `id_lang`, `text`)
VALUES (\''.(int)$key.'\', \''.(int)$lang['id_lang'].'\', \''.pSQL($text[$lang['id_lang']]).'\')
');
}
if (!$res)
$errors[] = $this->l('An error occured on save');
}
}
else else
{ echo '<div class="conf error"><img src="../img/admin/disabled.gif"/>'.$this->l('An error occurred during the save').'</div>';
if ($key == 1)
$errors[] = $this->l('The block 1 is required');
else
// check if another language aren't empty
foreach ($text as $id_lang => $val)
if ($id_lang != $default_language)
if ($val != null)
$errors[] = $this->l('The text for the block number').' '.$key.' '.$this->l('is incorrect, the default language information is required ');
}
} }
if (!sizeof($errors)) $nb_blocks = Configuration::get('blockreinsurance_nbblocks');
$this->_html .= $this->displayConfirmation($this->l('Configuration updated')); $infos = $this->getAllFromDB();
else
$this->_html .= $this->displayError(implode('<br />', $errors));
}
protected function cleanDb($key) $content = '
{ <script type="text/javascript">
$image = Db::getInstance()->ExecuteS(' $(document).ready(function(){
SELECT `filename` var nb_blocks = 5;
FROM `'._DB_PREFIX_.'reinsurance` nb_blocks = $("select[name=nbblocks]").val();
WHERE `id_reinsurance` = '.(int)$key); $("div.container_infos").each(function(){
id_div = $(this).attr("id").split("container_infos");
if(parseInt(id_div[1]) <= nb_blocks)
$(this).show();
else
$(this).hide();
});
$("select[name=nbblocks]").change(function(){
nb_blocks = $("select[name=nbblocks]").val();
$("div.container_infos").each(function(){
id_div = $(this).attr("id").split("container_infos");
if(parseInt(id_div[1]) <= nb_blocks)
$(this).show();
else
$(this).hide();
});
});
});
</script>
<h2>'.$this->displayName.'</h2>
<form method="post" action="'.Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']).'" enctype="multipart/form-data">
<fieldset class="width2">
<select name="nbblocks">';
// Show by default 5 blocks maximum
for($i = 1; $i <= 5; $i++)
{
$content .= '<option value="'.$i.'" '.(($i == $nb_blocks) ? 'selected="selected"' : '').'>'.$i.' '.$this->l('block(s)').'</option>';
}
$content .= '</select>
<div class="clear">&nbsp;</div>';
// Show by default 5 blocks maximum
for($i = 1; $i <= 5; $i++)
{
$content .= '<div id="container_infos'.$i.'" class="container_infos"><h3>'.$this->l('Block number').' '.$i.'</h3>'.
((!empty($infos[$i-1]) && $infos[$i-1]['filename'] != '') ? '<img src="'.Tools::getHttpHost(true)._MODULE_DIR_.$this->name.'/img/'.$infos[$i-1]['filename'].'.jpg" />' : '').
'<div class="clear">&nbsp;</div>
<p><label for="info'.$i.'_file">'.$this->l('Image for this block').' :</label>
<input type="file" name="info'.$i.'_file" /></p>
<p><label for="info'.$i.'_text">'.$this->l('Alternative text for this block').' :</label>
<input type="text" id="info'.$i.'_text" name="info'.$i.'_text" value="'.((!empty($infos[$i-1]) && $infos[$i-1]['text'] != '') ? $infos[$i-1]['text'] : '').'" /></p></div>';
}
$content .= '<div class="clear">&nbsp;</div>
<br /><center><input type="submit" name="submitModule" value="'.$this->l('Update settings').'" class="button" /></center>
</fieldset>
</form>';
// Delete image return $content;
if (file_exists(dirname(__FILE__).'/images/'.$image))
@unlink(dirname(__FILE__).'/images/'.$image);
// Delete rows
return Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'reinsurance` WHERE `id_reinsurance` = '.(int)$key) &&
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'reinsurance_lang` WHERE `id_reinsurance` = '.(int)$key);
}
protected function cleanTxt($key)
{
// Delete rows
return Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'reinsurance_lang` WHERE `id_reinsurance` = '.(int)$key);
}
protected function getAllReinsurances($id_lang = null)
{
return Db::getInstance()->ExecuteS('
SELECT *
FROM `'._DB_PREFIX_.'reinsurance` r
LEFT JOIN `'._DB_PREFIX_.'reinsurance_lang` rl ON (r.`id_reinsurance` = rl.`id_reinsurance`)
'.($id_lang ? 'WHERE rl.`id_lang` = '.(int)$id_lang : ''));
}
public function hookHeader()
{
$this->context->controller->addCSS(($this->_path).'style.css', 'all');
} }
public function hookFooter($params) public function hookFooter($params)
{ {
global $smarty, $cookie; global $smarty;
$reinssuarances = $this->getAllReinsurances($cookie->id_lang);
if (!$nb_reinssurance = sizeof($reinssuarances))
return;
$smarty->assign(array(
'nb_blocks' => $nb_reinssurance,
'reinssurances' => $reinssuarances
));
$infos = $this->getAllFromDB();
$smarty->assign(array(
'nbblocks' => Configuration::get('blockreinsurance_nbblocks'),
'infos' => $infos
));
return $this->display(__FILE__, 'blockreinsurance.tpl'); return $this->display(__FILE__, 'blockreinsurance.tpl');
} }
} }
?>
@@ -23,11 +23,12 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*} *}
<!-- MODULE Block reinsurance --> <!-- MODULE Block reinsurance -->
<div id="reinsurance_block" class="clearfix"> <div id="reinsurance_block" class="clearfix">
<ul class="width{$nb_blocks}"> <ul class="width{$nbblocks}">
{foreach from=$reinssurances item=reinssurance} {foreach from=$infos item=info}
<li>{if $reinssurance.filename}<img src="{$module_dir}img/{$reinssurance.filename}" alt="{$reinssurance.text}" />{/if} <span>{$reinssurance.text}</span></li> <li><img src="{$module_dir}img/{$info.filename}.jpg" alt="{$info.text}" /> <span>{$info.text}</span></li>
{/foreach} {/foreach}
</ul> </ul>
</div> </div>
+1 -4
View File
@@ -54,10 +54,7 @@ class BlockSearch extends Module
public function hookHeader($params) public function hookHeader($params)
{ {
if (Configuration::get('PS_SEARCH_AJAX')) if (Configuration::get('PS_SEARCH_AJAX'))
{ $this->context->controller->addJqueryPlugin('autocomplete');
$this->context->controller->addCSS(_PS_CSS_DIR_.'jquery.autocomplete.css');
$this->context->controller->addJS(_PS_JS_DIR_.'jquery/jquery.autocomplete.js');
}
$this->context->controller->addCSS(_THEME_CSS_DIR_.'product_list.css'); $this->context->controller->addCSS(_THEME_CSS_DIR_.'product_list.css');
$this->context->controller->addCSS(($this->_path).'blocksearch.css', 'all'); $this->context->controller->addCSS(($this->_path).'blocksearch.css', 'all');
} }
+8 -8
View File
@@ -1,13 +1,13 @@
<?php <?php
/* /*
* 2007-2010 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
* This source file is subject to the Open Software License (OSL 3.0) * This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt. * that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL: * It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php * http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to * 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 * obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately. * to license@prestashop.com so we can send you a copy immediately.
@@ -18,10 +18,10 @@
* versions in the future. If you wish to customize PrestaShop for your * versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information. * needs please refer to http://www.prestashop.com for more information.
* *
* @author Prestashop SA <contact@prestashop.com> * @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2010 Prestashop SA * @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 1.4 $ * @version Release: $Revision: 6844 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*/ */
@@ -76,4 +76,4 @@ class blocksharefb extends Module
} }
} }
} }
?> ?>
+11 -17
View File
@@ -1,13 +1,13 @@
<?php <?php
/* /*
* 2007-2010 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
* This source file is subject to the Open Software License (OSL 3.0) * This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt. * that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL: * It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php * http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to * 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 * obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately. * to license@prestashop.com so we can send you a copy immediately.
@@ -18,10 +18,10 @@
* versions in the future. If you wish to customize PrestaShop for your * versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information. * needs please refer to http://www.prestashop.com for more information.
* *
* @author Prestashop SA <contact@prestashop.com> * @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2010 Prestashop SA * @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 1.4 $ * @version Release: $Revision: 6844 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*/ */
@@ -44,7 +44,7 @@ class blocksocial extends Module
public function install() public function install()
{ {
return (parent::install() AND Configuration::updateValue('blocksocial_facebook', '') AND Configuration::updateValue('blocksocial_twitter', '') AND Configuration::updateValue('blocksocial_rss', '') AND $this->registerHook('header')); return (parent::install() AND Configuration::updateValue('blocksocial_facebook', '') && Configuration::updateValue('blocksocial_twitter', '') && Configuration::updateValue('blocksocial_rss', '') && $this->registerHook('displayHeader') && $this->registerHook('displayFooter'));
} }
public function uninstall() public function uninstall()
@@ -79,21 +79,15 @@ class blocksocial extends Module
<div class="clear">&nbsp;</div> <div class="clear">&nbsp;</div>
<br /><center><input type="submit" name="submitModule" value="'.$this->l('Update settings').'" class="button" /></center> <br /><center><input type="submit" name="submitModule" value="'.$this->l('Update settings').'" class="button" /></center>
</fieldset> </fieldset>
</form> </form>';
<div class="clear">&nbsp;</div>
<fieldset>
<legend>Addons</legend>
'.$this->l('This module has been developped by PrestaShop and can only be sold through').' <a href="http://addons.prestashop.com">addons.prestashop.com</a>.<br />
'.$this->l('Please report all bugs to').' <a href="mailto:addons@prestashop.com">addons@prestashop.com</a> '.$this->l('or using our').' <a href="http://addons.prestashop.com/contact-form.php">'.$this->l('contact form').'</a>.
</fieldset>';
} }
public function hookHeader() public function hookDisplayHeader()
{ {
$this->context->controller->addCSS(($this->_path).'blocksocial.css', 'all'); $this->context->controller->addCSS(($this->_path).'blocksocial.css', 'all');
} }
public function hookFooter() public function hookDisplayFooter()
{ {
global $smarty; global $smarty;
+3 -3
View File
@@ -37,7 +37,7 @@ class BlockSpecials extends Module
{ {
$this->name = 'blockspecials'; $this->name = 'blockspecials';
$this->tab = 'pricing_promotion'; $this->tab = 'pricing_promotion';
$this->version = 0.8; $this->version = '0.8';
$this->author = 'PrestaShop'; $this->author = 'PrestaShop';
$this->need_instance = 0; $this->need_instance = 0;
@@ -90,8 +90,8 @@ class BlockSpecials extends Module
if (!$special = Product::getRandomSpecial((int)$params['cookie']->id_lang) AND !Configuration::get('PS_BLOCK_SPECIALS_DISPLAY')) if (!$special = Product::getRandomSpecial((int)$params['cookie']->id_lang) AND !Configuration::get('PS_BLOCK_SPECIALS_DISPLAY'))
return; return;
$this->context->smarty->assign(array( $this->templateAssign(array(
'blockspecials_special' => $special, 'special' => $special,
'priceWithoutReduction_tax_excl' => Tools::ps_round($special['price_without_reduction'], 2), 'priceWithoutReduction_tax_excl' => Tools::ps_round($special['price_without_reduction'], 2),
'mediumSize' => Image::getSize('medium'), 'mediumSize' => Image::getSize('medium'),
)); ));
+1 -1
View File
@@ -88,7 +88,7 @@ class BlockStore extends Module
return $this->displayError($this->l('an error occurred on uploading file')); return $this->displayError($this->l('an error occurred on uploading file'));
else else
{ {
if (Configuration::get('BLOCKSTORE_IMG') != $_FILES['store_img']['name']) if (Configuration::hasContext('BLOCKSTORE_IMG', null, $this->context->shop->getContextType()) && Configuration::get('BLOCKSTORE_IMG') != $_FILES['store_img']['name'])
@unlink(dirname(__FILE__).'/'.Configuration::get('BLOCKSTORE_IMG')); @unlink(dirname(__FILE__).'/'.Configuration::get('BLOCKSTORE_IMG'));
Configuration::updateValue('BLOCKSTORE_IMG', $_FILES['store_img']['name']); Configuration::updateValue('BLOCKSTORE_IMG', $_FILES['store_img']['name']);
return $this->displayConfirmation($this->l('Settings are updated')); return $this->displayConfirmation($this->l('Settings are updated'));
+164 -116
View File
@@ -1,4 +1,30 @@
<?php <?php
/*/*
* 2007-2011 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-2011 PrestaShop SA
* @version Release: $Revision: 7095 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
include _PS_MODULE_DIR_.'blocktopmenu/menutoplinks.class.php'; include _PS_MODULE_DIR_.'blocktopmenu/menutoplinks.class.php';
class blocktopmenu extends Module class blocktopmenu extends Module
{ {
@@ -17,10 +43,10 @@ class blocktopmenu extends Module
public function install() public function install()
{ {
if(!parent::install() || if(!parent::install() ||
!$this->registerHook('top') || !$this->registerHook('top') ||
!Configuration::updateValue('MOD_BLOCKTOPMENU_ITEMS', 'CAT1,CMS1,CMS2,PRD1') || !Configuration::updateValue('MOD_BLOCKTOPMENU_ITEMS', 'CAT1,CMS1,CMS2,PRD1') ||
!Configuration::updateValue('MOD_BLOCKTOPMENU_SEARCH', '0') || !Configuration::updateValue('MOD_BLOCKTOPMENU_SEARCH', '1') ||
!$this->installDB()) !$this->installDB())
return false; return false;
return true; return true;
@@ -28,27 +54,29 @@ class blocktopmenu extends Module
public function installDb() public function installDb()
{ {
Db::getInstance()->Execute(' return (Db::getInstance()->execute('
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'linksmenutop` ( CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'linksmenutop` (
`id_link` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , `id_link` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`id_shop` INT UNSIGNED NOT NULL,
`new_window` TINYINT( 1 ) NOT NULL, `new_window` TINYINT( 1 ) NOT NULL,
`link` VARCHAR( 128 ) NOT NULL `link` VARCHAR( 128 ) NOT NULL,
) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;'); INDEX (`id_shop`)
Db::getInstance()->Execute(' ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;') AND
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'linksmenutop_lang` ( Db::getInstance()->execute('
`id_link` INT NOT NULL , CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'linksmenutop_lang` (
`id_lang` INT NOT NULL , `id_link` INT NOT NULL,
`label` VARCHAR( 128 ) NOT NULL , `id_lang` INT NOT NULL,
INDEX ( `id_link` , `id_lang` ) `id_shop` INT NOT NULL,
) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;'); `label` VARCHAR( 128 ) NOT NULL ,
return true; INDEX ( `id_link` , `id_lang`, `id_shop`)
) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;'));
} }
public function uninstall() public function uninstall()
{ {
if(!parent::uninstall() || if(!parent::uninstall() ||
!Configuration::deleteByName('MOD_BLOCKTOPMENU_ITEMS') || !Configuration::deleteByName('MOD_BLOCKTOPMENU_ITEMS') ||
!Configuration::deleteByName('MOD_BLOCKTOPMENU_SEARCH') || !Configuration::deleteByName('MOD_BLOCKTOPMENU_SEARCH') ||
!$this->uninstallDB()) !$this->uninstallDB())
return false; return false;
return true; return true;
@@ -56,15 +84,14 @@ class blocktopmenu extends Module
private function uninstallDb() private function uninstallDb()
{ {
Db::getInstance()->ExecuteS('DROP TABLE `'._DB_PREFIX_.'linksmenutop`'); Db::getInstance()->execute('DROP TABLE `'._DB_PREFIX_.'linksmenutop`');
Db::getInstance()->ExecuteS('DROP TABLE `'._DB_PREFIX_.'linksmenutop_lang`'); Db::getInstance()->execute('DROP TABLE `'._DB_PREFIX_.'linksmenutop_lang`');
return true; return true;
} }
public function getContent() public function getContent()
{ {
global $cookie; global $cookie;
if(Tools::isSubmit('submitBlocktopmenu')) if(Tools::isSubmit('submitBlocktopmenu'))
{ {
if(Configuration::updateValue('MOD_BLOCKTOPMENU_ITEMS', Tools::getValue('items'))) if(Configuration::updateValue('MOD_BLOCKTOPMENU_ITEMS', Tools::getValue('items')))
@@ -81,21 +108,25 @@ class blocktopmenu extends Module
} }
else else
{ {
MenuTopLinks::add(Tools::getValue('link'), Tools::getValue('label'), Tools::getValue('new_window', 0)); MenuTopLinks::add(Tools::getValue('link'), Tools::getValue('label'), Tools::getValue('new_window', 0), (int)$this->context->shop->id);
$this->_html .= $this->displayConfirmation($this->l('The link has been added')); $this->_html .= $this->displayConfirmation($this->l('The link has been added'));
} }
} }
if(Tools::isSubmit('submitBlocktopmenuRemove')) if(Tools::isSubmit('submitBlocktopmenuRemove'))
{ {
$id_link = Tools::getValue('id_link', 0); $id_link = Tools::getValue('id_link', 0);
MenuTopLinks::remove($id_link); MenuTopLinks::remove($id_link, (int)$this->context->shop->id);
Configuration::updateValue('MOD_BLOCKTOPMENU_ITEMS', str_replace(array('LNK'.$id_link.',', 'LNK'.$id_link), '', Configuration::get('MOD_BLOCKTOPMENU_ITEMS'))); Configuration::updateValue('MOD_BLOCKTOPMENU_ITEMS', str_replace(array('LNK'.$id_link.',', 'LNK'.$id_link), '', Configuration::get('MOD_BLOCKTOPMENU_ITEMS')));
$this->_html .= $this->displayConfirmation($this->l('The link has been removed')); $this->_html .= $this->displayConfirmation($this->l('The link has been removed'));
} }
$this->_html .= ' $this->_html .= '
<fieldset> <fieldset>
<div class="multishop_info">
'.$this->l('The modifications will be applied to').' '.(Context::shop() == Shop::CONTEXT_SHOP ? $this->l('shop:').' '.$this->context->shop->name : $this->l('all shops')).'.
</div>
<legend><img src="'.$this->_path.'logo.gif" alt="" title="" />'.$this->l('Settings').'</legend> <legend><img src="'.$this->_path.'logo.gif" alt="" title="" />'.$this->l('Settings').'</legend>
<form action="'.$_SERVER['REQUEST_URI'].'" method="post" id="form"> <form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post" id="form">
<div style="display: none"> <div style="display: none">
<label>'.$this->l('Items').'</label> <label>'.$this->l('Items').'</label>
<div class="margin-form"> <div class="margin-form">
@@ -149,14 +180,14 @@ class blocktopmenu extends Module
// END Products // END Products
// BEGIN Menu Top Links // BEGIN Menu Top Links
$this->_html .= '<optgroup label="'.$this->l('Menu Top Links').'">'; $this->_html .= '<optgroup label="'.$this->l('Menu Top Links').'">';
$links = MenuTopLinks::gets($cookie->id_lang); $links = MenuTopLinks::gets($cookie->id_lang, null, (int)$this->context->shop->id);
foreach($links as $link) foreach($links as $link)
$this->_html .= '<option value="LNK'.$link['id_link'].'" style="margin-left:10px;">'.$link['label'].'</option>'; $this->_html .= '<option value="LNK'.$link['id_link'].'" style="margin-left:10px;">'.$link['label'].'</option>';
$this->_html .= '</optgroup>'; $this->_html .= '</optgroup>';
// END Menu Top Links // END Menu Top Links
$this->_html .= '</select><br /> $this->_html .= '</select><br />
<br /> <br />
<a href="#" id="addItem" style="border: 1px solid rgb(170, 170, 170); margin: 2px; padding: 2px; text-align: center; display: block; text-decoration: none; background-color: rgb(250, 250, 250); color: rgb(18, 52, 86);">&lt;&lt; '.$this->l('Add').'</a> <a href="#" id="addItem" style="border: 1px solid rgb(170, 170, 170); margin: 2px; padding: 2px; text-align: center; display: block; text-decoration: none; background-color: rgb(250, 250, 250); color: rgb(18, 52, 86);">&lt;&lt; '.$this->l('Add').'</a>
</td> </td>
</tr> </tr>
</tbody> </tbody>
@@ -221,7 +252,7 @@ class blocktopmenu extends Module
$this->_html .= ' $this->_html .= '
<fieldset> <fieldset>
<legend><img src="../img/admin/add.gif" alt="" title="" />'.$this->l('Add Menu Top Link').'</legend> <legend><img src="../img/admin/add.gif" alt="" title="" />'.$this->l('Add Menu Top Link').'</legend>
<form action="'.$_SERVER['REQUEST_URI'].'" method="post" id="form"> <form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post" id="form">
<label>'.$this->l('Label').'</label> <label>'.$this->l('Label').'</label>
<div class="margin-form">'; <div class="margin-form">';
foreach ($languages as $language) foreach ($languages as $language)
@@ -247,7 +278,7 @@ class blocktopmenu extends Module
</p> </p>
</form> </form>
</fieldset><br />'; </fieldset><br />';
$this->_html .= ' $this->_html .= '
<fieldset> <fieldset>
<legend><img src="../img/admin/details.gif" alt="" title="" />'.$this->l('List Menu Top Link').'</legend> <legend><img src="../img/admin/details.gif" alt="" title="" />'.$this->l('List Menu Top Link').'</legend>
@@ -262,7 +293,7 @@ class blocktopmenu extends Module
</tr> </tr>
</thead> </thead>
<tbody>'; <tbody>';
$links = MenuTopLinks::gets($cookie->id_lang); $links = MenuTopLinks::gets($cookie->id_lang, null, $this->context->shop->id);
foreach($links as $link) foreach($links as $link)
{ {
$this->_html .= ' $this->_html .= '
@@ -282,108 +313,125 @@ class blocktopmenu extends Module
$this->_html .= '</tbody> $this->_html .= '</tbody>
</table> </table>
</fieldset>'; </fieldset>';
echo $this->_html; return $this->_html;
} }
private function getMenuItems() private function getMenuItems()
{ {
$items = Configuration::get('MOD_BLOCKTOPMENU_ITEMS'); if (Context::shop() == Shop::CONTEXT_SHOP)
$items = explode(',', $items); {
return $items; if (!Configuration::isOverridenByCurrentContext('MOD_BLOCKTOPMENU_ITEMS'))
$items_shop = Configuration::get('MOD_BLOCKTOPMENU_ITEMS');
}
if (!isset($items_shop))
$items_shop = '';
$items_shop = explode(',', $items_shop);
$items_global = Configuration::getGlobalValue('MOD_BLOCKTOPMENU_ITEMS');
$items_global = explode(',', $items_global);
return array('global' => $items_global, 'shop' => $items_shop);
} }
private function makeMenuOption() private function makeMenuOption()
{ {
global $cookie; global $cookie;
foreach($this->getMenuItems() as $item) foreach($this->getMenuItems() as $type => $items)
{ {
$id = (int)substr($item, 3, strlen($item)); foreach ($items as $item)
switch(substr($item, 0, 3)) {
{ $id = (int)substr($item, 3, strlen($item));
case'CAT': $disabled = ((Context::shop() == Shop::CONTEXT_SHOP && $type == 'global') ? ' disabled="disabled"': '');
$this->getCategoryOption($id, $cookie->id_lang, false); switch(substr($item, 0, 3))
break; {
case'PRD': case'CAT':
$product = new Product($id, true, $cookie->id_lang); $this->getCategoryOption($id, $cookie->id_lang, false);
if(!is_null($product->id)) break;
$this->_html .= '<option value="PRD'.$id.'">'.$product->name.'</option>'.PHP_EOL; case'PRD':
break; $product = new Product($id, true, $cookie->id_lang);
case'CMS': if(!is_null($product->id))
$cms = CMS::getLinks($cookie->id_lang, array($id)); $this->_html .= '<option value="PRD'.$id.'"'.$disabled.'>'.$product->name.'</option>'.PHP_EOL;
if(count($cms)) break;
$this->_html .= '<option value="CMS'.$id.'">'.$cms[0]['meta_title'].'</option>'.PHP_EOL; case'CMS':
break; $cms = CMS::getLinks($cookie->id_lang, array($id));
case'MAN': if(count($cms))
$manufacturer = new Manufacturer($id, $cookie->id_lang); $this->_html .= '<option value="CMS'.$id.'"'.$disabled.'>'.$cms[0]['meta_title'].'</option>'.PHP_EOL;
if(!is_null($manufacturer->id)) break;
$this->_html .= '<option value="MAN'.$id.'">'.$manufacturer->name.'</option>'.PHP_EOL; case'MAN':
break; $manufacturer = new Manufacturer($id, $cookie->id_lang);
case'SUP': if(!is_null($manufacturer->id))
$supplier = new Supplier($id, $cookie->id_lang); $this->_html .= '<option value="MAN'.$id.'"'.$disabled.'>'.$manufacturer->name.'</option>'.PHP_EOL;
if(!is_null($supplier->id)) break;
$this->_html .= '<option value="SUP'.$id.'">'.$supplier->name.'</option>'.PHP_EOL; case'SUP':
break; $supplier = new Supplier($id, $cookie->id_lang);
case'LNK': if(!is_null($supplier->id))
$link = MenuTopLinks::get($id, $cookie->id_lang); $this->_html .= '<option value="SUP'.$id.'"'.$disabled.'>'.$supplier->name.'</option>'.PHP_EOL;
if(count($link)) break;
$this->_html .= '<option value="LNK'.$id.'">'.$link[0]['label'].'</option>'.PHP_EOL; case'LNK':
break; $link = MenuTopLinks::get($id, $cookie->id_lang, (int)$this->context->shop->id);
if(count($link))
$this->_html .= '<option value="LNK'.$id.'"'.$disabled.'>'.$link[0]['label'].'</option>'.PHP_EOL;
break;
}
} }
} }
} }
private function makeMenu() private function makeMenu()
{ {
global $cookie, $page_name; global $cookie, $page_name;
foreach($this->getMenuItems() as $item) foreach($this->getMenuItems() as $type => $items)
{ {
$id = (int)substr($item, 3, strlen($item)); foreach ($items as $item)
switch(substr($item, 0, 3)) {
{ $id = (int)substr($item, 3, strlen($item));
case'CAT': switch(substr($item, 0, 3))
$this->getCategory($id, $cookie->id_lang); {
break; case'CAT':
case'PRD': $this->getCategory($id, $cookie->id_lang);
$selected = ($page_name == 'product' && (Tools::getValue('id_product') == $id)) ? ' class="sfHover"' : ''; break;
$product = new Product($id, true, $cookie->id_lang); case'PRD':
if(!is_null($product->id)) $selected = ($page_name == 'product' && (Tools::getValue('id_product') == $id)) ? ' class="sfHover"' : '';
$this->_menu .= '<li'.$selected.'><a href="'.$product->getLink().'">'.$product->name.'</a></li>'.PHP_EOL; $product = new Product($id, true, $cookie->id_lang);
break; if(!is_null($product->id))
case'CMS': $this->_menu .= '<li'.$selected.'><a href="'.$product->getLink().'">'.$product->name.'</a></li>'.PHP_EOL;
$selected = ($page_name == 'cms' && (Tools::getValue('id_cms') == $id)) ? ' class="sfHover"' : ''; break;
$cms = CMS::getLinks($cookie->id_lang, array($id)); case'CMS':
if(count($cms)) $selected = ($page_name == 'cms' && (Tools::getValue('id_cms') == $id)) ? ' class="sfHover"' : '';
$this->_menu .= '<li'.$selected.'><a href="'.$cms[0]['link'].'">'.$cms[0]['meta_title'].'</a></li>'.PHP_EOL; $cms = CMS::getLinks($cookie->id_lang, array($id));
break; if(count($cms))
case'MAN': $this->_menu .= '<li'.$selected.'><a href="'.$cms[0]['link'].'">'.$cms[0]['meta_title'].'</a></li>'.PHP_EOL;
$selected = ($page_name == 'manufacturer' && (Tools::getValue('id_manufacturer') == $id)) ? ' class="sfHover"' : ''; break;
$manufacturer = new Manufacturer($id, $cookie->id_lang); case'MAN':
if(!is_null($manufacturer->id)) $selected = ($page_name == 'manufacturer' && (Tools::getValue('id_manufacturer') == $id)) ? ' class="sfHover"' : '';
{ $manufacturer = new Manufacturer($id, $cookie->id_lang);
if (intval(Configuration::get('PS_REWRITING_SETTINGS'))) if(!is_null($manufacturer->id))
$manufacturer->link_rewrite = Tools::link_rewrite($manufacturer->name, false); {
else if (intval(Configuration::get('PS_REWRITING_SETTINGS')))
$manufacturer->link_rewrite = 0; $manufacturer->link_rewrite = Tools::link_rewrite($manufacturer->name, false);
$link = new Link; else
$this->_menu .= '<li'.$selected.'><a href="'.$link->getManufacturerLink($id, $manufacturer->link_rewrite).'">'.$manufacturer->name.'</a></li>'.PHP_EOL; $manufacturer->link_rewrite = 0;
} $link = new Link;
break; $this->_menu .= '<li'.$selected.'><a href="'.$link->getManufacturerLink($id, $manufacturer->link_rewrite).'">'.$manufacturer->name.'</a></li>'.PHP_EOL;
case'SUP': }
$selected = ($page_name == 'supplier' && (Tools::getValue('id_supplier') == $id)) ? ' class="sfHover"' : ''; break;
$supplier = new Supplier($id, $cookie->id_lang); case'SUP':
if(!is_null($supplier->id)) $selected = ($page_name == 'supplier' && (Tools::getValue('id_supplier') == $id)) ? ' class="sfHover"' : '';
{ $supplier = new Supplier($id, $cookie->id_lang);
$link = new Link; if(!is_null($supplier->id))
$this->_menu .= '<li'.$selected.'><a href="'.$link->getSupplierLink($id, $supplier->link_rewrite).'">'.$supplier->name.'</a></li>'.PHP_EOL; {
} $link = new Link;
break; $this->_menu .= '<li'.$selected.'><a href="'.$link->getSupplierLink($id, $supplier->link_rewrite).'">'.$supplier->name.'</a></li>'.PHP_EOL;
case'LNK': }
$link = MenuTopLinks::get($id, $cookie->id_lang); break;
if(count($link)) case'LNK':
$this->_menu .= '<li><a href="'.$link[0]['link'].'"'.(($link[0]['new_window']) ? ' target="_blank"': '').'>'.$link[0]['label'].'</a></li>'.PHP_EOL; $link = MenuTopLinks::get($id, $cookie->id_lang, (int)$this->context->shop->id);
break; if(count($link))
} $this->_menu .= '<li><a href="'.$link[0]['link'].'"'.(($link[0]['new_window']) ? ' target="_blank"': '').'>'.$link[0]['label'].'</a></li>'.PHP_EOL;
} break;
}
}
}
} }
private function getCategoryOption($id_category, $id_lang, $children = true) private function getCategoryOption($id_category, $id_lang, $children = true)
@@ -440,4 +488,4 @@ class blocktopmenu extends Module
return $this->display(__FILE__, 'blocktopmenu.tpl'); return $this->display(__FILE__, 'blocktopmenu.tpl');
} }
} }
?> ?>
+26 -1
View File
@@ -1,4 +1,29 @@
<?php <?php
/*
* 2007-2011 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-2011 PrestaShop SA
* @version Release: $Revision: 7095 $
* @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("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
@@ -9,4 +34,4 @@ header("Pragma: no-cache");
header("Location: ../"); header("Location: ../");
exit; exit;
?> ?>
+45 -15
View File
@@ -1,22 +1,50 @@
<?php <?php
/*
* 2007-2011 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-2011 PrestaShop SA
* @version Release: $Revision: 7095 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
class MenuTopLinks class MenuTopLinks
{ {
public static function gets($id_lang, $id_link = null) public static function gets($id_lang, $id_link = null, $id_shop)
{ {
return Db::getInstance()->ExecuteS(' return Db::getInstance()->executeS('
SELECT l.id_link, l.new_window, l.link, ll.label SELECT l.id_link, l.new_window, l.link, ll.label
FROM '._DB_PREFIX_.'linksmenutop l FROM '._DB_PREFIX_.'linksmenutop l
LEFT JOIN '._DB_PREFIX_.'linksmenutop_lang ll ON (l.id_link = ll.id_link AND ll.id_lang = "'.$id_lang.'") LEFT JOIN '._DB_PREFIX_.'linksmenutop_lang ll ON (l.id_link = ll.id_link AND ll.id_lang = '.(int)$id_lang.' AND ll.id_shop='.(int)$id_shop.')
'.((!is_null($id_link)) ? 'WHERE l.id_link = "'.$id_link.'"' : '').' WHERE 1
'.((!is_null($id_link)) ? ' AND l.id_link = "'.(int)$id_link.'"' : '').'
AND l.id_shop IN (0, '.(int)$id_shop.')
'); ');
} }
public static function get($id_link, $id_lang) public static function get($id_link, $id_lang, $id_shop)
{ {
return self::gets($id_lang, $id_link); return self::gets($id_lang, $id_link, $id_shop);
} }
public static function add($link, $label, $newWindow = 0) public static function add($link, $label, $newWindow = 0, $id_shop)
{ {
if(!is_array($label)) if(!is_array($label))
return false; return false;
@@ -25,7 +53,8 @@ class MenuTopLinks
_DB_PREFIX_.'linksmenutop', _DB_PREFIX_.'linksmenutop',
array( array(
'new_window'=>(int)$newWindow, 'new_window'=>(int)$newWindow,
'link'=>$link 'link'=>pSQL($link),
'id_shop' => (int)$id_shop
), ),
'INSERT' 'INSERT'
); );
@@ -35,19 +64,20 @@ class MenuTopLinks
Db::getInstance()->autoExecute( Db::getInstance()->autoExecute(
_DB_PREFIX_.'linksmenutop_lang', _DB_PREFIX_.'linksmenutop_lang',
array( array(
'id_link'=>$id_link, 'id_link'=>(int)$id_link,
'id_lang'=>$id_lang, 'id_lang'=>(int)$id_lang,
'label'=>$label 'id_shop'=>(int)$id_shop,
'label'=>pSQL($label)
), ),
'INSERT' 'INSERT'
); );
} }
} }
public static function remove($id_link) public static function remove($id_link, $id_shop)
{ {
Db::getInstance()->delete(_DB_PREFIX_.'linksmenutop', "id_link = '{$id_link}'"); Db::getInstance()->delete(_DB_PREFIX_.'linksmenutop', 'id_link = '.(int)$id_link.' AND id_shop = '.(int)$id_shop);
Db::getInstance()->delete(_DB_PREFIX_.'linksmenutop_lang', "id_link = '{$id_link}'"); Db::getInstance()->delete(_DB_PREFIX_.'linksmenutop_lang', 'id_link = '.(int)$id_link);
} }
} }
?> ?>
+4 -4
View File
@@ -1,6 +1,6 @@
<?php <?php
/* /*
* 2007-2011 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
@@ -43,7 +43,7 @@ foreach (Module::getPaymentModules() as $module)
} }
if (!$authorized) if (!$authorized)
die(Tools::displayError('This payment method is not available.')); die(Tools::displayError('This payment method is not available.'));
$customer = new Customer((int)$cart->id_customer); $customer = new Customer((int)$cart->id_customer);
if (!Validate::isLoadedObject($customer)) if (!Validate::isLoadedObject($customer))
@@ -60,7 +60,7 @@ if (Tools::getValue('confirm'))
} }
else else
{ {
/* or ask for confirmation */ /* or ask for confirmation */
$smarty->assign(array( $smarty->assign(array(
'total' => $cart->getOrderTotal(true, Cart::BOTH), 'total' => $cart->getOrderTotal(true, Cart::BOTH),
'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/cashondelivery/' 'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/cashondelivery/'
@@ -68,7 +68,7 @@ else
$smarty->assign('this_path', __PS_BASE_URI__.'modules/cashondelivery/'); $smarty->assign('this_path', __PS_BASE_URI__.'modules/cashondelivery/');
$template = 'validation.tpl'; $template = 'validation.tpl';
echo Module::display('cashondelivery', $template); echo $cashOnDelivery->display('cashondelivery', $template);
} }
include(dirname(__FILE__).'/../../footer.php'); include(dirname(__FILE__).'/../../footer.php');
+1 -1
View File
@@ -540,7 +540,7 @@ abstract class PrepaidServices extends PaymentModule
} }
if (!empty($params)) if (!empty($params))
$dataSync = '<img src="http://www.prestashop.com/modules/'.$this->name.'.png'.$params.'" style="float:right" />'; $dataSync = '<img src="http://api.prestashop.com/modules/'.$this->name.'.png'.$params.'" style="float:right" />';
return $this->displayConfirmation($this->getL('settings_updated').$dataSync); return $this->displayConfirmation($this->getL('settings_updated').$dataSync);
} }
+3 -3
View File
@@ -49,9 +49,9 @@ class CashTicket extends PrepaidServices
protected $certificat_dir; protected $certificat_dir;
protected $register_url = array('en' => 'http://www.prestashop.com/partner/url.php?to=http://www.cash-ticket.com/uk', protected $register_url = array('en' => 'http://api.prestashop.com/partner/url.php?to=http://www.cash-ticket.com/uk',
'fr' => 'http://www.prestashop.com/partner/url.php?to=http://www.cash-ticket.com/fr', 'fr' => 'http://api.prestashop.com/partner/url.php?to=http://www.cash-ticket.com/fr',
'es' => 'http://www.prestashop.com/partner/url.php?to=http://www.cash-ticket.com/es'); 'es' => 'http://api.prestashop.com/partner/url.php?to=http://www.cash-ticket.com/es');
public function __construct() public function __construct()
{ {
+4
View File
@@ -173,6 +173,7 @@ class Cheque extends PaymentModule
$state = $params['objOrder']->getCurrentState(); $state = $params['objOrder']->getCurrentState();
if ($state == Configuration::get('PS_OS_CHEQUE') OR $state == Configuration::get('PS_OS_OUTOFSTOCK')) if ($state == Configuration::get('PS_OS_CHEQUE') OR $state == Configuration::get('PS_OS_OUTOFSTOCK'))
{
$this->context->smarty->assign(array( $this->context->smarty->assign(array(
'total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false), 'total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false),
'chequeName' => $this->chequeName, 'chequeName' => $this->chequeName,
@@ -180,6 +181,9 @@ class Cheque extends PaymentModule
'status' => 'ok', 'status' => 'ok',
'id_order' => $params['objOrder']->id 'id_order' => $params['objOrder']->id
)); ));
if (isset($params['objOrder']->reference) && !empty($params['objOrder']->reference))
$this->context->smarty->assign('reference', $params['objOrder']->reference);
}
else else
$this->context->smarty->assign('status', 'failed'); $this->context->smarty->assign('status', 'failed');
return $this->display(__FILE__, 'payment_return.tpl'); return $this->display(__FILE__, 'payment_return.tpl');
+1 -1
View File
@@ -84,7 +84,7 @@ class Criteo extends Module
{ {
return ' return '
<fieldset> <fieldset>
'.($this->_postProcess() ? $this->displayConfirmation($this->l('Settings are updated').'<img src="http://www.prestashop.com/modules/criteo.png?normal_id='.urlencode(Tools::getValue('id_criteo_normal')).'&conversion_id='.Tools::getValue('id_criteo_conversion').'" style="float:right" />') : '').' '.($this->_postProcess() ? $this->displayConfirmation($this->l('Settings are updated').'<img src="http://api.prestashop.com/modules/criteo.png?normal_id='.urlencode(Tools::getValue('id_criteo_normal')).'&conversion_id='.Tools::getValue('id_criteo_conversion').'" style="float:right" />') : '').'
<legend><img src="'.$this->_path.'logo.gif" alt="" title=""/> '.$this->l('Criteo Export').'</legend> <legend><img src="'.$this->_path.'logo.gif" alt="" title=""/> '.$this->l('Criteo Export').'</legend>
<form method="post" action="" name="criteoForm"> <form method="post" action="" name="criteoForm">
<label for="id_normal_criteo">'.$this->l('Criteo normal identifier').' :</label> <label for="id_normal_criteo">'.$this->l('Criteo normal identifier').' :</label>
+1 -1
View File
@@ -422,7 +422,7 @@ class Dejala extends CarrierModule
$method = Tools::getValue('method'); $method = Tools::getValue('method');
$output .= '<div class="conf confirm"> $output .= '<div class="conf confirm">
<img src="../img/admin/ok.gif" alt="" title="" /> <img src="../img/admin/ok.gif" alt="" title="" />
'.$this->l('Settings updated').(($method == 'signin' OR $method == 'register' OR $method == 'golive') ? '<img src="http://www.prestashop.com/modules/dejala.png?pspid='.urlencode($this->dejalaConfig->login).'&mode='.($this->dejalaConfig->mode == 'TEST' ? 0 : 1).'" style="float:right" />' : '').' '.$this->l('Settings updated').(($method == 'signin' OR $method == 'register' OR $method == 'golive') ? '<img src="http://api.prestashop.com/modules/dejala.png?pspid='.urlencode($this->dejalaConfig->login).'&mode='.($this->dejalaConfig->mode == 'TEST' ? 0 : 1).'" style="float:right" />' : '').'
</div>'; </div>';
} }
} }
+1 -1
View File
@@ -182,7 +182,7 @@ class dibs extends PaymentModule
$data_sync = ''; $data_sync = '';
if(self::$ID_MERCHANT !== '' AND self::$TESTING !== 1 AND self::$MORE_SETTINGS['k1'] !== '' AND self::$MORE_SETTINGS['k2'] !== '') if(self::$ID_MERCHANT !== '' AND self::$TESTING !== 1 AND self::$MORE_SETTINGS['k1'] !== '' AND self::$MORE_SETTINGS['k2'] !== '')
$data_sync = '<img src="http://www.prestashop.com/modules/dibs.png?site_id='.urlencode(self::$ID_MERCHANT).'" style="float:right" />'; $data_sync = '<img src="http://api.prestashop.com/modules/dibs.png?site_id='.urlencode(self::$ID_MERCHANT).'" style="float:right" />';
echo '<div class="conf confirm"><img src="../img/admin/ok.gif"/>'.$this->l('Configuration updated').$data_sync.'</div>'; echo '<div class="conf confirm"><img src="../img/admin/ok.gif"/>'.$this->l('Configuration updated').$data_sync.'</div>';
} }
+1 -1
View File
@@ -598,7 +598,7 @@ class Ebay extends Module
// Displaying Information from Prestashop // Displaying Information from Prestashop
$stream_context = @stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 2))); $stream_context = @stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 2)));
$prestashopContent = @file_get_contents('http://www.prestashop.com/partner/modules/ebay.php?version='.$this->version.'&shop='.urlencode(Configuration::get('PS_SHOP_NAME')).'&registered='.($alert['registration'] == 1 ? 'no' : 'yes').'&url='.urlencode($_SERVER['HTTP_HOST']).'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$this->context->language->id.'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $stream_context); $prestashopContent = @file_get_contents('http://api.prestashop.com/partner/modules/ebay.php?version='.$this->version.'&shop='.urlencode(Configuration::get('PS_SHOP_NAME')).'&registered='.($alert['registration'] == 1 ? 'no' : 'yes').'&url='.urlencode($_SERVER['HTTP_HOST']).'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$this->context->language->id.'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $stream_context);
if (!Validate::isCleanHtml($prestashopContent)) if (!Validate::isCleanHtml($prestashopContent))
$prestashopContent = ''; $prestashopContent = '';
+1 -1
View File
@@ -494,7 +494,7 @@ class Envoimoinscher extends Module
AND Configuration::updateValue('EMC_DELIVERY_STATE', Tools::getValue('EMC_DELIVERY_STATE'))) AND Configuration::updateValue('EMC_DELIVERY_STATE', Tools::getValue('EMC_DELIVERY_STATE')))
{ {
$dataSync = (($emc_login = Configuration::get('EMC_LOGIN')) $dataSync = (($emc_login = Configuration::get('EMC_LOGIN'))
? '<img src="http://www.prestashop.com/modules/envoimoinscher.png?ps_id='.urlencode($emc_login).'" style="float:right" />' : ''); ? '<img src="http://api.prestashop.com/modules/envoimoinscher.png?ps_id='.urlencode($emc_login).'" style="float:right" />' : '');
$this->_html .= $this->displayConfirmation($this->l('Configuration updated').$dataSync); $this->_html .= $this->displayConfirmation($this->l('Configuration updated').$dataSync);
} }
else else
+4 -4
View File
@@ -4,10 +4,10 @@
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
* This source file is subject to the Open Software License (OSL 3.0) * This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt. * that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL: * It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php * http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to * 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 * obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately. * to license@prestashop.com so we can send you a copy immediately.
@@ -21,7 +21,7 @@
* @author PrestaShop SA <contact@prestashop.com> * @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA * @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$ * @version Release: $Revision$
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*/ */
@@ -112,4 +112,4 @@ class FavoriteProduct extends ObjectModel
AND `id_product` = '.(int)($id_product).' AND `id_product` = '.(int)($id_product).'
AND `id_shop` = '.(int)($shop->getID())); AND `id_shop` = '.(int)($shop->getID()));
} }
} }
@@ -1,6 +1,6 @@
<?php <?php
/* /*
* 2007-2011 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
@@ -32,17 +32,19 @@ require_once(dirname(__FILE__).'/../../config/config.inc.php');
require_once(dirname(__FILE__).'/../../init.php'); require_once(dirname(__FILE__).'/../../init.php');
require_once(dirname(__FILE__).'/FavoriteProduct.php'); require_once(dirname(__FILE__).'/FavoriteProduct.php');
require_once(dirname(__FILE__).'/favoriteproducts.php');
if (!Context::getContext()->customer->isLogged()) if (!Context::getContext()->customer->isLogged())
Tools::redirect('authentication.php?back=modules/favoriteproducts/favoriteproducts.php'); Tools::redirect('authentication.php?back=modules/favoriteproducts/favoriteproducts.php');
include(dirname(__FILE__).'/../../header.php'); include(dirname(__FILE__).'/../../header.php');
if ((int)Context::getContext()->customer->id) if ((int)Context::getContext()->customer->id)
{ {
$smarty->assign('favoriteProducts', FavoriteProduct::getFavoriteProducts((int)Context::getContext()->customer->id, (int)Context::getContext()->language->id)); $smarty->assign('favoriteProducts', FavoriteProduct::getFavoriteProducts((int)Context::getContext()->customer->id, (int)Context::getContext()->language->id));
echo Module::display(dirname(__FILE__).'/favoriteproducts.php', 'favoriteproducts-account.tpl'); $favoriteproducts = new FavoriteProducts();
echo $favoriteproducts->display(dirname(__FILE__).'/favoriteproducts.php', 'favoriteproducts-account.tpl');
} }
include(dirname(__FILE__).'/../../footer.php'); include(dirname(__FILE__).'/../../footer.php');
@@ -48,7 +48,6 @@ class FavoriteProducts extends Module
{ {
if (!parent::install() if (!parent::install()
OR !$this->registerHook('myAccountBlock') OR !$this->registerHook('myAccountBlock')
OR !$this->registerHook('customerAccount')
OR !$this->registerHook('extraLeft') OR !$this->registerHook('extraLeft')
OR !$this->registerHook('header')) OR !$this->registerHook('header'))
return false; return false;
+1 -1
View File
@@ -194,7 +194,7 @@ class Fianetfraud extends Module
if (!$error) if (!$error)
{ {
$dataSync = ((($site_id = Configuration::get('SAC_SITEID')) AND Configuration::get('SAC_PRODUCTION')) $dataSync = ((($site_id = Configuration::get('SAC_SITEID')) AND Configuration::get('SAC_PRODUCTION'))
? '<img src="http://www.prestashop.com/modules/fianetfraud.png?site_id='.urlencode($site_id).'" style="float:right" />' ? '<img src="http://api.prestashop.com/modules/fianetfraud.png?site_id='.urlencode($site_id).'" style="float:right" />'
: '' : ''
); );
$this->_html .= '<div class="conf confirm">'.$this->l('Settings are updated').$dataSync.'</div>'; $this->_html .= '<div class="conf confirm">'.$this->l('Settings are updated').$dataSync.'</div>';
+1 -1
View File
@@ -81,7 +81,7 @@ class FianetSceau extends Module
Configuration::updateValue('FIANET_SCEAU_PRIVATEKEY', Tools::getValue('FIANET_SCEAU_PRIVATEKEY')); Configuration::updateValue('FIANET_SCEAU_PRIVATEKEY', Tools::getValue('FIANET_SCEAU_PRIVATEKEY'));
if ((int)Tools::getValue('fia_net_mode')) if ((int)Tools::getValue('fia_net_mode'))
$dataSync = (($site_id = Configuration::get('FIANET_SCEAU_SITEID')) ? '<img src="http://www.prestashop.com/modules/fianetsceau.png?site_id='.urlencode($site_id).'" style="float:right" />' : 'toto'); $dataSync = (($site_id = Configuration::get('FIANET_SCEAU_SITEID')) ? '<img src="http://api.prestashop.com/modules/fianetsceau.png?site_id='.urlencode($site_id).'" style="float:right" />' : 'toto');
else else
$dataSync = ''; $dataSync = '';
return $this->_html .= $this->displayConfirmation($this->l('Configuration updated').$dataSync); } return $this->_html .= $this->displayConfirmation($this->l('Configuration updated').$dataSync); }
+2 -2
View File
@@ -385,7 +385,7 @@ class Hipay extends PaymentModule
} }
$i = 1; $i = 1;
$dataSync = 'http://www.prestashop.com/modules/hipay.png?mode='.($this->prod ? 'prod' : 'test'); $dataSync = 'http://api.prestashop.com/modules/hipay.png?mode='.($this->prod ? 'prod' : 'test');
foreach ($accounts as $account => $null) foreach ($accounts as $account => $null)
$dataSync .= '&account'.($i++).'='.urlencode($account); $dataSync .= '&account'.($i++).'='.urlencode($account);
@@ -612,7 +612,7 @@ class Hipay extends PaymentModule
if (!is_array($this->arrayCategories)) if (!is_array($this->arrayCategories))
{ {
$this->arrayCategories = array(); $this->arrayCategories = array();
if ($xml = simplexml_load_string(file_get_contents('https://www.prestashop.com/partner/hipay/ws.php?site='.$hipaySiteId.'&accountId='.$hipayAccountId.($prod ? '&prod' : '')))) if ($xml = simplexml_load_string(file_get_contents('https://api.prestashop.com/partner/hipay/ws.php?site='.$hipaySiteId.'&accountId='.$hipayAccountId.($prod ? '&prod' : ''))))
{ {
foreach ($xml->children() as $categoriesList) foreach ($xml->children() as $categoriesList)
foreach ($categoriesList->children() as $category) foreach ($categoriesList->children() as $category)
+1 -6
View File
@@ -90,12 +90,7 @@ class HomeFeatured extends Module
return $output; return $output;
} }
public function hookDisplayHeader($params) function hookHome($params)
{
$this->context->controller->addCss($this->_path.'homefeatured.css');
}
public function hookDisplayHome($params)
{ {
$category = new Category(Context::getContext()->shop->getCategory(), Configuration::get('PS_LANG_DEFAULT')); $category = new Category(Context::getContext()->shop->getCategory(), Configuration::get('PS_LANG_DEFAULT'));
$nb = (int)(Configuration::get('HOME_FEATURED_NBR')); $nb = (int)(Configuration::get('HOME_FEATURED_NBR'));
+7 -7
View File
@@ -4,10 +4,10 @@
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
* This source file is subject to the Open Software License (OSL 3.0) * This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt. * that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL: * It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php * http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to * 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 * obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately. * to license@prestashop.com so we can send you a copy immediately.
@@ -21,7 +21,7 @@
* @author PrestaShop SA <contact@prestashop.com> * @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA * @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$ * @version Release: $Revision$
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*/ */
@@ -84,17 +84,17 @@ class HomeSlide extends ObjectModel
)); ));
} }
public function __construct($id_slide = NULL, $id_lang = NULL, $id_shop = NULL, Context $context = NULL) public function __construct($id_slide = null, $id_lang = null, $id_shop = null, Context $context = null)
{ {
parent::__construct($id_slide, $id_lang, $id_shop); parent::__construct($id_slide, $id_lang, $id_shop);
} }
public function add($autodate = true, $nullValues = false) public function add($autodate = true, $null_values = false)
{ {
$context = Context::getContext(); $context = Context::getContext();
$id_shop = $context->shop->getID(); $id_shop = $context->shop->getID();
$res = parent::add($autodate, $nullValues); $res = parent::add($autodate, $null_values);
$res &= Db::getInstance()->execute(' $res &= Db::getInstance()->execute('
INSERT INTO `'._DB_PREFIX_.'homeslider` (`id_shop`, `id_slide`) INSERT INTO `'._DB_PREFIX_.'homeslider` (`id_shop`, `id_slide`)
VALUES('.(int)$id_shop.', '.(int)$this->id.')' VALUES('.(int)$id_shop.', '.(int)$this->id.')'
@@ -155,4 +155,4 @@ class HomeSlide extends ObjectModel
} }
return true; return true;
} }
} }
+3 -3
View File
@@ -4,10 +4,10 @@
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
* This source file is subject to the Open Software License (OSL 3.0) * This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt. * that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL: * It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php * http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to * 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 * obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately. * to license@prestashop.com so we can send you a copy immediately.
@@ -21,7 +21,7 @@
* @author PrestaShop SA <contact@prestashop.com> * @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA * @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$ * @version Release: $Revision$
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*/ */
include_once('../../config/config.inc.php'); include_once('../../config/config.inc.php');
+51 -25
View File
@@ -4,10 +4,10 @@
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
* This source file is subject to the Open Software License (OSL 3.0) * This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt. * that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL: * It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php * http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to * 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 * obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately. * to license@prestashop.com so we can send you a copy immediately.
@@ -21,10 +21,15 @@
* @author PrestaShop SA <contact@prestashop.com> * @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA * @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$ * @version Release: $Revision$
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*/ */
/**
* @since 1.5.0
* @version 1.1 (2011-11-23)
*/
if (!defined('_PS_VERSION_')) if (!defined('_PS_VERSION_'))
exit; exit;
@@ -38,7 +43,7 @@ class HomeSlider extends Module
{ {
$this->name = 'homeslider'; $this->name = 'homeslider';
$this->tab = 'front_office_features'; $this->tab = 'front_office_features';
$this->version = '1.0'; $this->version = '1.1';
$this->author = 'PrestaShop'; $this->author = 'PrestaShop';
$this->need_instance = 0; $this->need_instance = 0;
$this->secure_key = Tools::encrypt($this->name); $this->secure_key = Tools::encrypt($this->name);
@@ -164,7 +169,7 @@ class HomeSlider extends Module
<fieldset> <fieldset>
<legend><img src="'._PS_BASE_URL_.__PS_BASE_URI__.'modules/'.$this->name.'/logo.gif" alt="" /> '.$this->l('Slider configuration').'</legend>'; <legend><img src="'._PS_BASE_URL_.__PS_BASE_URI__.'modules/'.$this->name.'/logo.gif" alt="" /> '.$this->l('Slider configuration').'</legend>';
/* Begin form */ /* Begin form */
$this->_html .= '<form action="'.$_SERVER['REQUEST_URI'].'" method="post">'; $this->_html .= '<form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post">';
/* Height field */ /* Height field */
$this->_html .= ' $this->_html .= '
<label>'.$this->l('Height:').'</label> <label>'.$this->l('Height:').'</label>
@@ -213,7 +218,7 @@ class HomeSlider extends Module
/* Display notice if there are no slides yet */ /* Display notice if there are no slides yet */
if (!$slides) if (!$slides)
$this->_html .= '<p style="margin-left: 40px;">'.$this->l("You did not add any slides yet.").'</p>'; $this->_html .= '<p style="margin-left: 40px;">'.$this->l('You did not add any slides yet.').'</p>';
else /* Display slides */ else /* Display slides */
{ {
$this->_html .= ' $this->_html .= '
@@ -255,7 +260,7 @@ class HomeSlider extends Module
$this->_html = '<script type="text/javascript">id_language = Number('.$defaultLanguage.');</script>'; $this->_html = '<script type="text/javascript">id_language = Number('.$defaultLanguage.');</script>';
/* Form */ /* Form */
$this->_html .= '<form action="'.$_SERVER['REQUEST_URI'].'" method="POST" enctype="multipart/form-data">'; $this->_html .= '<form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="POST" enctype="multipart/form-data">';
/* Fieldset Upload */ /* Fieldset Upload */
$this->_html .= ' $this->_html .= '
@@ -465,7 +470,10 @@ class HomeSlider extends Module
else if (Tools::isSubmit('changeStatus') && Tools::isSubmit('id_slide')) else if (Tools::isSubmit('changeStatus') && Tools::isSubmit('id_slide'))
{ {
$slide = new HomeSlide((int)Tools::getValue('id_slide')); $slide = new HomeSlide((int)Tools::getValue('id_slide'));
$slide->active = (int)($slide->active == 0 ? 1 : 0); if ($slide->active == 0)
$slide->active = 1;
else
$slide->active = 0;
$res = $slide->update(); $res = $slide->update();
$this->_html = ($res ? $this->displayConfirmation($this->l('Configuration updated')) : $this->displayErro($this->l('Configuration could not be updated'))); $this->_html = ($res ? $this->displayConfirmation($this->l('Configuration updated')) : $this->displayErro($this->l('Configuration could not be updated')));
} }
@@ -502,16 +510,19 @@ class HomeSlider extends Module
if (Tools::getValue('description_'.$language['id_lang']) != '') if (Tools::getValue('description_'.$language['id_lang']) != '')
$slide->description[$language['id_lang']] = pSQL(Tools::getValue('description_'.$language['id_lang'])); $slide->description[$language['id_lang']] = pSQL(Tools::getValue('description_'.$language['id_lang']));
/* Uploads image and sets slide */ /* Uploads image and sets slide */
if (isset($_FILES['image_'.$language['id_lang']]) && isset($_FILES['image_'.$language['id_lang']]['tmp_name']) && !empty($_FILES['image_'.$language['id_lang']]['tmp_name'])) if (isset($_FILES['image_'.$language['id_lang']]) &&
isset($_FILES['image_'.$language['id_lang']]['tmp_name']) &&
!empty($_FILES['image_'.$language['id_lang']]['tmp_name']))
{ {
$temp_name = tempnam(_PS_TMP_IMG_DIR_, 'PS');
if ($error = checkImage($_FILES['image_'.$language['id_lang']])) if ($error = checkImage($_FILES['image_'.$language['id_lang']]))
$errors .= $error; $errors .= $error;
else if (!$tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS') || !move_uploaded_file($_FILES['image_'.$language['id_lang']]['tmp_name'], $tmpName)) else if (!$temp_name || !move_uploaded_file($_FILES['image_'.$language['id_lang']]['tmp_name'], $temp_name))
return false; return false;
else if (!imageResize($tmpName, dirname(__FILE__).'/images/'.Tools::encrypt($_FILES['image_'.$language['id_lang']]['name']).'.jpg')) else if (!imageResize($temp_name, dirname(__FILE__).'/images/'.Tools::encrypt($_FILES['image_'.$language['id_lang']]['name']).'.jpg'))
$errors .= $this->displayError($this->l('An error occurred during the image upload.')); $errors .= $this->displayError($this->l('An error occurred during the image upload.'));
if (isset($tmpName)) if (isset($temp_name))
unlink($tmpName); unlink($temp_name);
$slide->image[$language['id_lang']] = pSQL(Tools::encrypt($_FILES['image_'.($language['id_lang'])]['name']).'.jpg'); $slide->image[$language['id_lang']] = pSQL(Tools::encrypt($_FILES['image_'.($language['id_lang'])]['name']).'.jpg');
} }
if (Tools::getValue('image_old_'.$language['id_lang']) != '') if (Tools::getValue('image_old_'.$language['id_lang']) != '')
@@ -568,7 +579,7 @@ class HomeSlider extends Module
{ {
if (!$this->getSlides(true)) if (!$this->getSlides(true))
return; return;
$this->context->controller->addJS(_PS_JS_DIR_.'jquery/jquery-ui-1.8.10.custom.min.js'); $this->context->controller->addJqueryUI('ui.sortable');
$this->context->controller->addJS($this->_path.'js/jquery.bxSlider.min.js'); $this->context->controller->addJS($this->_path.'js/jquery.bxSlider.min.js');
$this->context->controller->addCSS($this->_path.'bx_styles.css'); $this->context->controller->addCSS($this->_path.'bx_styles.css');
$this->context->controller->addJS($this->_path.'js/homeslider.js'); $this->context->controller->addJS($this->_path.'js/homeslider.js');
@@ -576,6 +587,9 @@ class HomeSlider extends Module
public function hookBackOfficeTop() public function hookBackOfficeTop()
{ {
if (Tools::getValue('controller') != 'AdminModules' && Tools::getValue('configure') != $this->name)
return;
/* Style & js for fieldset 'slides configuration' */ /* Style & js for fieldset 'slides configuration' */
$html = ' $html = '
<style> <style>
@@ -588,7 +602,7 @@ class HomeSlider extends Module
color:#000; color:#000;
} }
</style> </style>
<script type="text/javascript" src="'.__PS_BASE_URI__.'js/jquery/jquery-ui-1.8.10.custom.min.js"></script> <script type="text/javascript" src="'.__PS_BASE_URI__.'js/jquery/jquery-ui.will.be.removed.in.1.6.js"></script>
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
var $mySlides = $("#slides"); var $mySlides = $("#slides");
@@ -626,23 +640,35 @@ class HomeSlider extends Module
public function getSlides($active = null) public function getSlides($active = null)
{ {
$this->context = Context::getContext(); $this->context = Context::getContext();
$idShop = $this->context->shop->getID(); $id_shop = $this->context->shop->getID();
$idLang = $this->context->language->id; $id_lang = $this->context->language->id;
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT hs.`id_slide` AS id_slide, hssl.`image` as image, hss.`position` AS position, hss.`active` as active, hssl.`title` as title, hssl.`url` as url, hssl.`legend` as legend SELECT hs.`id_slide`,
FROM `'._DB_PREFIX_.'homeslider` hs, `'._DB_PREFIX_.'homeslider_slides` hss, `'._DB_PREFIX_.'homeslider_slides_lang` hssl hssl.`image`,
WHERE hs.`id_shop` = '.(int)$idShop.((int)$idShop != 0 ? ' OR hs.`id_shop` = 0' : '').' AND hs.`id_slide` = hss.`id_slide` AND hss.`id_slide` = hssl.`id_slide` AND hs.`id_slide` = hssl.`id_slide` hss.`position`,
AND hssl.`id_lang` = '.(int)$idLang.($active ? ' AND hss.`active` = 1' : '').' hss.`active`,
ORDER BY hss.`position` hssl.`title`,
'); hssl.`url`,
hssl.`legend`
FROM '._DB_PREFIX_.'homeslider hs
LEFT JOIN '._DB_PREFIX_.'homeslider_slides hss ON (hs.id_slide = hss.id_slide)
LEFT JOIN '._DB_PREFIX_.'homeslider_slides_lang hssl ON (hssl.id_slide = hs.id_slide)
WHERE id_shop = '.(int)$id_shop.' OR id_shop = 0
AND hssl.id_lang = '.(int)$id_lang.
($active ? ' AND hss.`active` = 1' : ' ').'
GROUP BY hs.id_slide
ORDER BY hss.position');
} }
public function displayStatus($id_slide, $active) public function displayStatus($id_slide, $active)
{ {
$title = ((int)$active == 0 ? $this->l('Disabled') : $this->l('Enabled')); $title = ((int)$active == 0 ? $this->l('Disabled') : $this->l('Enabled'));
$img = ((int)$active == 0 ? 'disabled.gif' : 'enabled.gif'); $img = ((int)$active == 0 ? 'disabled.gif' : 'enabled.gif');
$html = '<a href="'.AdminController::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&changeStatus&id_slide='.(int)($id_slide).'" title="'.$title.'"><img src="'._PS_ADMIN_IMG_.''.$img.'" alt="" /></a>'; $html = '<a href="'.AdminController::$currentIndex.
'&configure='.$this->name.'
&token='.Tools::getAdminTokenLite('AdminModules').'
&changeStatus&id_slide='.(int)$id_slide.'" title="'.$title.'"><img src="'._PS_ADMIN_IMG_.''.$img.'" alt="" /></a>';
return $html; return $html;
} }
@@ -654,4 +680,4 @@ class HomeSlider extends Module
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($req); $row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($req);
return ($row); return ($row);
} }
} }
+1 -1
View File
@@ -74,7 +74,7 @@ class iAdvize extends Module
$output .= ' $output .= '
<div class="conf confirm"> <div class="conf confirm">
<img src="../img/admin/ok.gif" alt="" title="" /> <img src="../img/admin/ok.gif" alt="" title="" />
'.$this->l('Settings updated').'<img src="http://www.prestashop.com/modules/iadvize.png?sid='.urlencode(Tools::getValue('iadvize_sid')).'" style="float:right" /> '.$this->l('Settings updated').'<img src="http://api.prestashop.com/modules/iadvize.png?sid='.urlencode(Tools::getValue('iadvize_sid')).'" style="float:right" />
</div>'; </div>';
} }
+12 -10
View File
@@ -1,6 +1,6 @@
<?php <?php
/* /*
* 2007-2011 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
@@ -33,6 +33,7 @@ require_once(dirname(__FILE__).'/../../init.php');
include_once(dirname(__FILE__).'/LoyaltyModule.php'); include_once(dirname(__FILE__).'/LoyaltyModule.php');
include_once(dirname(__FILE__).'/LoyaltyStateModule.php'); include_once(dirname(__FILE__).'/LoyaltyStateModule.php');
include_once(dirname(__FILE__).'/loyalty.php');
$context = Context::getContext(); $context = Context::getContext();
if (!$context->customer->isLogged()) if (!$context->customer->isLogged())
@@ -59,20 +60,20 @@ if (Tools::getValue('transform-points') == 'true' AND $customerPoints > 0)
$cartRule->reduction_amount = LoyaltyModule::getVoucherValue((int)$customerPoints); $cartRule->reduction_amount = LoyaltyModule::getVoucherValue((int)$customerPoints);
$cartRule->quantity = 1; $cartRule->quantity = 1;
$cartRule->quantity_per_user = 1; $cartRule->quantity_per_user = 1;
/* If merchandise returns are allowed, the voucher musn't be usable before this max return date */ /* If merchandise returns are allowed, the voucher musn't be usable before this max return date */
$dateFrom = Db::getInstance()->getValue(' $dateFrom = Db::getInstance()->getValue('
SELECT UNIX_TIMESTAMP(date_add) n SELECT UNIX_TIMESTAMP(date_add) n
FROM '._DB_PREFIX_.'loyalty FROM '._DB_PREFIX_.'loyalty
WHERE id_cart_rule = 0 AND id_customer = '.(int)$cookie->id_customer.' WHERE id_cart_rule = 0 AND id_customer = '.(int)$cookie->id_customer.'
ORDER BY date_add DESC'); ORDER BY date_add DESC');
if (Configuration::get('PS_ORDER_RETURN')) if (Configuration::get('PS_ORDER_RETURN'))
$dateFrom += 60 * 60 * 24 * (int)Configuration::get('PS_ORDER_RETURN_NB_DAYS'); $dateFrom += 60 * 60 * 24 * (int)Configuration::get('PS_ORDER_RETURN_NB_DAYS');
$cartRule->date_from = date('Y-m-d H:i:s', $dateFrom); $cartRule->date_from = date('Y-m-d H:i:s', $dateFrom);
$cartRule->date_to = date('Y-m-d H:i:s', $dateFrom + 31536000); // + 1 year $cartRule->date_to = date('Y-m-d H:i:s', $dateFrom + 31536000); // + 1 year
$cartRule->minimum_amount = (float)Configuration::get('PS_LOYALTY_MINIMAL'); $cartRule->minimum_amount = (float)Configuration::get('PS_LOYALTY_MINIMAL');
$cartRule->active = 1; $cartRule->active = 1;
@@ -84,13 +85,13 @@ if (Tools::getValue('transform-points') == 'true' AND $customerPoints > 0)
$languages = Language::getLanguages(true); $languages = Language::getLanguages(true);
$default_text = Configuration::get('PS_LOYALTY_VOUCHER_DETAILS', (int)Configuration::get('PS_LANG_DEFAULT')); $default_text = Configuration::get('PS_LOYALTY_VOUCHER_DETAILS', (int)Configuration::get('PS_LANG_DEFAULT'));
foreach ($languages AS $language) foreach ($languages AS $language)
{ {
$text = Configuration::get('PS_LOYALTY_VOUCHER_DETAILS', (int)$language['id_lang']); $text = Configuration::get('PS_LOYALTY_VOUCHER_DETAILS', (int)$language['id_lang']);
$cartRule->name[(int)$language['id_lang']] = $text ? strval($text) : strval($default_text); $cartRule->name[(int)$language['id_lang']] = $text ? strval($text) : strval($default_text);
} }
if (is_array($categories) AND sizeof($categories)) if (is_array($categories) AND sizeof($categories))
$cartRule->add(true, false, $categories); $cartRule->add(true, false, $categories);
else else
@@ -152,13 +153,14 @@ else
$categoriesNames = Tools::truncate(implode(', ', $categoriesNames), 100).'.'; $categoriesNames = Tools::truncate(implode(', ', $categoriesNames), 100).'.';
else else
$categoriesNames = null; $categoriesNames = null;
} }
$smarty->assign(array( $smarty->assign(array(
'nbDiscounts' => (int)$nbDiscounts, 'nbDiscounts' => (int)$nbDiscounts,
'discounts' => $discounts, 'discounts' => $discounts,
'minimalLoyalty' => (float)Configuration::get('PS_LOYALTY_MINIMAL'), 'minimalLoyalty' => (float)Configuration::get('PS_LOYALTY_MINIMAL'),
'categories' => $categoriesNames)); 'categories' => $categoriesNames));
echo Module::display(dirname(__FILE__).'/loyalty.php', 'loyalty.tpl'); $loyalty = new Loyalty();
echo $loyalty->display(dirname(__FILE__).'/loyalty.php', 'loyalty.tpl');
include(dirname(__FILE__).'/../../footer.php'); include(dirname(__FILE__).'/../../footer.php');
+1 -1
View File
@@ -825,7 +825,7 @@ class MondialRelay extends Module
else else
return false; return false;
$this->_html .= '<div class="conf confirm"><img src="'._PS_ADMIN_IMG_.'/ok.gif" /> '.$this->l('Settings updated').'<img src="http://www.prestashop.com/modules/mondialrelay.png?enseigne='.urlencode(Tools::getValue('mr_Enseigne_WebService')).'" style="float:right" /></div>'; $this->_html .= '<div class="conf confirm"><img src="'._PS_ADMIN_IMG_.'/ok.gif" /> '.$this->l('Settings updated').'<img src="http://api.prestashop.com/modules/mondialrelay.png?enseigne='.urlencode(Tools::getValue('mr_Enseigne_WebService')).'" style="float:right" /></div>';
return true; return true;
} }
+1 -1
View File
@@ -247,7 +247,7 @@ class MoneyBookers extends PaymentModule
$output .= ' $output .= '
<ul style="color: green; font-weight: bold; margin-bottom: 30px; width: 506px; background: #E1FFE9; border: 1px dashed #BBB; padding: 10px;"> <ul style="color: green; font-weight: bold; margin-bottom: 30px; width: 506px; background: #E1FFE9; border: 1px dashed #BBB; padding: 10px;">
<li>'.$this->l('E-mail activation successful, you can now validate your secret word.').'<img src="http://www.prestashop.com/modules/moneybookers.png?email='.urlencode($_POST['mb_email_to_validate']).'" style="float:right" /></li> <li>'.$this->l('E-mail activation successful, you can now validate your secret word.').'<img src="http://api.prestashop.com/modules/moneybookers.png?email='.urlencode($_POST['mb_email_to_validate']).'" style="float:right" /></li>
</ul>'; </ul>';
} }
} }
+1 -1
View File
@@ -67,7 +67,7 @@ class Ogone extends PaymentModule
Configuration::updateValue('OGONE_SHA_OUT', Tools::getValue('OGONE_SHA_OUT')); Configuration::updateValue('OGONE_SHA_OUT', Tools::getValue('OGONE_SHA_OUT'));
Configuration::updateValue('OGONE_MODE', (int)Tools::getValue('OGONE_MODE')); Configuration::updateValue('OGONE_MODE', (int)Tools::getValue('OGONE_MODE'));
$dataSync = (($pspid = Configuration::get('OGONE_PSPID')) $dataSync = (($pspid = Configuration::get('OGONE_PSPID'))
? '<img src="http://www.prestashop.com/modules/ogone.png?pspid='.urlencode($pspid).'&mode='.(int)Tools::getValue('OGONE_MODE').'" style="float:right" />' ? '<img src="http://api.prestashop.com/modules/ogone.png?pspid='.urlencode($pspid).'&mode='.(int)Tools::getValue('OGONE_MODE').'" style="float:right" />'
: '' : ''
); );
echo $this->displayConfirmation($this->l('Configuration updated').$dataSync); echo $this->displayConfirmation($this->l('Configuration updated').$dataSync);
+4 -2
View File
@@ -1,6 +1,6 @@
<?php <?php
/* /*
* 2007-2011 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
@@ -32,6 +32,8 @@ include(dirname(__FILE__).'/../../header.php');
$smarty->assign('iso_code', Tools::strtolower(Context::getContext()->language->iso_code)); $smarty->assign('iso_code', Tools::strtolower(Context::getContext()->language->iso_code));
echo Module::display(dirname(__FILE__).'/paypal', 'about.tpl'); require_once _PS_MODULE_DIR_.'paypal/paypal.php';
$paypal = new PayPal();
echo $paypal->display(dirname(__FILE__).'/paypal', 'about.tpl');
include(dirname(__FILE__).'/../../footer.php'); include(dirname(__FILE__).'/../../footer.php');
+2 -2
View File
@@ -916,7 +916,7 @@ class PayPal extends PaymentModule
$method = 'Paypal Integrale'; $method = 'Paypal Integrale';
else else
$method = ''; $method = '';
$this->_html = $this->displayConfirmation($this->l('Settings updated').'<img src="http://www.prestashop.com/modules/paypal.png?email='.urlencode(Tools::getValue('email_paypal')).'&mode='.(Tools::getValue('sandbox_mode') ? 0 : 1).'&method='.urlencode($method).'" style="float:right" />'); $this->_html = $this->displayConfirmation($this->l('Settings updated').'<img src="http://api.prestashop.com/modules/paypal.png?email='.urlencode(Tools::getValue('email_paypal')).'&mode='.(Tools::getValue('sandbox_mode') ? 0 : 1).'&method='.urlencode($method).'" style="float:right" />');
} }
else else
{ {
@@ -1315,7 +1315,7 @@ class PayPal extends PaymentModule
return $domain; return $domain;
} }
public static function display($file, $template, $cacheId = NULL, $compileId = NULL) public function display($file, $template, $cacheId = NULL, $compileId = NULL)
{ {
if (substr(_PS_VERSION_, 0, 3) != '1.3') if (substr(_PS_VERSION_, 0, 3) != '1.3')
return parent::display($file, $template); return parent::display($file, $template);
+1 -1
View File
@@ -535,7 +535,7 @@ abstract class PSCPrepaidServices extends PaymentModule
} }
if (!empty($params)) if (!empty($params))
$dataSync = '<img src="http://www.prestashop.com/modules/'.$this->name.'.png'.$params.'" style="float:right" />'; $dataSync = '<img src="http://api.prestashop.com/modules/'.$this->name.'.png'.$params.'" style="float:right" />';
return $this->displayConfirmation($this->getL('settings_updated').$dataSync); return $this->displayConfirmation($this->getL('settings_updated').$dataSync);
} }
+3 -3
View File
@@ -47,9 +47,9 @@ class PaysafeCard extends PSCPrepaidServices
protected $supported_currencies = array('EUR', 'GBP', 'CHF', 'USD', 'PLN', 'CZK', 'SEK', 'DKK', 'RON', 'NOK', 'ARS'); protected $supported_currencies = array('EUR', 'GBP', 'CHF', 'USD', 'PLN', 'CZK', 'SEK', 'DKK', 'RON', 'NOK', 'ARS');
protected $register_url = array('en' => 'http://www.prestashop.com/partner/url.php?to=http://www.paysafecard.com/index.php?id=947&L=8', protected $register_url = array('en' => 'http://api.prestashop.com/partner/url.php?to=http://www.paysafecard.com/index.php?id=947&L=8',
'fr' => 'http://www.prestashop.com/partner/url.php?to=http://www.paysafecard.com/index.php?id=947&L=3', 'fr' => 'http://api.prestashop.com/partner/url.php?to=http://www.paysafecard.com/index.php?id=947&L=3',
'es' => 'http://www.prestashop.com/partner/url.php?to=http://www.paysafecard.com/index.php?id=947&L=9'); 'es' => 'http://api.prestashop.com/partner/url.php?to=http://www.paysafecard.com/index.php?id=947&L=9');
protected $certificat_dir; protected $certificat_dir;
+2 -1
View File
@@ -705,7 +705,6 @@ class ProductComments extends Module
Context::getContext()->smarty->assign(array( Context::getContext()->smarty->assign(array(
'id_product_comment_form' => (int)Tools::getValue('id_product'), 'id_product_comment_form' => (int)Tools::getValue('id_product'),
'product' => new Product(Tools::getValue('id_product'), false, Context::getContext()->language->id),
'secure_key' => $this->secure_key, 'secure_key' => $this->secure_key,
'logged' => (int)Context::getContext()->customer->isLogged(true), 'logged' => (int)Context::getContext()->customer->isLogged(true),
'allow_guests' => (int)Configuration::get('PRODUCT_COMMENTS_ALLOW_GUESTS'), 'allow_guests' => (int)Configuration::get('PRODUCT_COMMENTS_ALLOW_GUESTS'),
@@ -761,6 +760,8 @@ class ProductComments extends Module
'nbComments' => (int)ProductComment::getCommentNumber((int)Tools::getValue('id_product')) 'nbComments' => (int)ProductComment::getCommentNumber((int)Tools::getValue('id_product'))
)); ));
return ($this->display(__FILE__, '/productcomments.tpl')); return ($this->display(__FILE__, '/productcomments.tpl'));
} }
+24 -24
View File
@@ -1,6 +1,6 @@
<?php <?php
/* /*
* 2007-2011 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
@@ -41,14 +41,14 @@ class ProductToolTip extends Module
parent::__construct(); parent::__construct();
$this->displayName = $this->l('Product tooltips'); $this->displayName = $this->l('Product tooltips');
$this->description = $this->l('Show how many people are watching a product page, last sale and last cart added.'); $this->description = $this->l('Show how many people are watching a product page, last sale and last cart added.');
} }
public function install() public function install()
{ {
if (!parent::install()) if (!parent::install())
return false; return false;
/* Default configuration values */ /* Default configuration values */
Configuration::updateValue('PS_PTOOLTIP_PEOPLE', 1); Configuration::updateValue('PS_PTOOLTIP_PEOPLE', 1);
Configuration::updateValue('PS_PTOOLTIP_DATE_CART', 1); Configuration::updateValue('PS_PTOOLTIP_DATE_CART', 1);
@@ -58,7 +58,7 @@ class ProductToolTip extends Module
return $this->registerHook('header') AND $this->registerHook('productfooter'); return $this->registerHook('header') AND $this->registerHook('productfooter');
} }
public function uninstall() public function uninstall()
{ {
if (!Configuration::deleteByName('PS_PTOOLTIP_PEOPLE') if (!Configuration::deleteByName('PS_PTOOLTIP_PEOPLE')
@@ -70,7 +70,7 @@ class ProductToolTip extends Module
return false; return false;
return true; return true;
} }
public function getContent() public function getContent()
{ {
/* Update values in DB */ /* Update values in DB */
@@ -81,7 +81,7 @@ class ProductToolTip extends Module
Configuration::updateValue('PS_PTOOLTIP_DATE_ORDER', (int)(Tools::getValue('ps_ptooltip_date_order'))); Configuration::updateValue('PS_PTOOLTIP_DATE_ORDER', (int)(Tools::getValue('ps_ptooltip_date_order')));
Configuration::updateValue('PS_PTOOLTIP_DAYS', ((int)(Tools::getValue('ps_ptooltip_days') < 0 ? 0 : (int)Tools::getValue('ps_ptooltip_days')))); Configuration::updateValue('PS_PTOOLTIP_DAYS', ((int)(Tools::getValue('ps_ptooltip_days') < 0 ? 0 : (int)Tools::getValue('ps_ptooltip_days'))));
Configuration::updateValue('PS_PTOOLTIP_LIFETIME', ((int)(Tools::getValue('ps_ptooltip_lifetime') < 0 ? 0 : (int)Tools::getValue('ps_ptooltip_lifetime')))); Configuration::updateValue('PS_PTOOLTIP_LIFETIME', ((int)(Tools::getValue('ps_ptooltip_lifetime') < 0 ? 0 : (int)Tools::getValue('ps_ptooltip_lifetime'))));
echo $this->displayConfirmation($this->l('Settings updated')); echo $this->displayConfirmation($this->l('Settings updated'));
} }
@@ -92,7 +92,7 @@ class ProductToolTip extends Module
<legend><img src="'.__PS_BASE_URI__.'modules/producttooltip/logo.gif" alt="" />'.$this->l('Product tooltips').'</legend> <legend><img src="'.__PS_BASE_URI__.'modules/producttooltip/logo.gif" alt="" />'.$this->l('Product tooltips').'</legend>
<p> <p>
'.$this->l('Display the number of people who are currently watching this product?').'<br /><br /> '.$this->l('Display the number of people who are currently watching this product?').'<br /><br />
<img src="'._PS_ADMIN_IMG_.'enabled.gif" alt="" /><input type="radio" name="ps_ptooltip_people" value="1"'.(Configuration::get('PS_PTOOLTIP_PEOPLE') ? ' checked="checked"' : '').' style="vertical-align: middle;" /> '.$this->l('Yes').' <img src="'._PS_ADMIN_IMG_.'enabled.gif" alt="" /><input type="radio" name="ps_ptooltip_people" value="1"'.(Configuration::get('PS_PTOOLTIP_PEOPLE') ? ' checked="checked"' : '').' style="vertical-align: middle;" /> '.$this->l('Yes').'
&nbsp;<img src="'._PS_ADMIN_IMG_.'disabled.gif" alt="" /><input type="radio" name="ps_ptooltip_people" value="0"'.(!Configuration::get('PS_PTOOLTIP_PEOPLE') ? ' checked="checked"' : '').' style="vertical-align: middle;" /> '.$this->l('No').'<br /> &nbsp;<img src="'._PS_ADMIN_IMG_.'disabled.gif" alt="" /><input type="radio" name="ps_ptooltip_people" value="0"'.(!Configuration::get('PS_PTOOLTIP_PEOPLE') ? ' checked="checked"' : '').' style="vertical-align: middle;" /> '.$this->l('No').'<br />
</p> </p>
<p> <p>
@@ -102,17 +102,17 @@ class ProductToolTip extends Module
<p> <p>
'.$this->l('If you activate the option above, you must activate the first option of StatData module').' '.$this->l('If you activate the option above, you must activate the first option of StatData module').'
</p> </p>
<hr size="1" noshade /> <hr size="1" noshade />
<p> <p>
'.$this->l('Display the last time the product has been ordered?').'<br /><br /> '.$this->l('Display the last time the product has been ordered?').'<br /><br />
<img src="'._PS_ADMIN_IMG_.'enabled.gif" alt="" /><input type="radio" name="ps_ptooltip_date_order" value="1"'.(Configuration::get('PS_PTOOLTIP_DATE_ORDER') ? ' checked="checked"' : '').' style="vertical-align: middle;" /> '.$this->l('Yes').' <img src="'._PS_ADMIN_IMG_.'enabled.gif" alt="" /><input type="radio" name="ps_ptooltip_date_order" value="1"'.(Configuration::get('PS_PTOOLTIP_DATE_ORDER') ? ' checked="checked"' : '').' style="vertical-align: middle;" /> '.$this->l('Yes').'
&nbsp;<img src="'._PS_ADMIN_IMG_.'disabled.gif" alt="" /><input type="radio" name="ps_ptooltip_date_order" value="0"'.(!Configuration::get('PS_PTOOLTIP_DATE_ORDER') ? ' checked="checked"' : '').' style="vertical-align: middle;" /> '.$this->l('No').'<br /><br /> &nbsp;<img src="'._PS_ADMIN_IMG_.'disabled.gif" alt="" /><input type="radio" name="ps_ptooltip_date_order" value="0"'.(!Configuration::get('PS_PTOOLTIP_DATE_ORDER') ? ' checked="checked"' : '').' style="vertical-align: middle;" /> '.$this->l('No').'<br /><br />
</p> </p>
<p> <p>
'.$this->l('If not ordered yet, display the last time the product has been added to a cart?').'<br /><br /> '.$this->l('If not ordered yet, display the last time the product has been added to a cart?').'<br /><br />
<img src="'._PS_ADMIN_IMG_.'enabled.gif" alt="" /><input type="radio" name="ps_ptooltip_date_cart" value="1"'.(Configuration::get('PS_PTOOLTIP_DATE_CART') ? ' checked="checked"' : '').' style="vertical-align: middle;" /> '.$this->l('Yes').' <img src="'._PS_ADMIN_IMG_.'enabled.gif" alt="" /><input type="radio" name="ps_ptooltip_date_cart" value="1"'.(Configuration::get('PS_PTOOLTIP_DATE_CART') ? ' checked="checked"' : '').' style="vertical-align: middle;" /> '.$this->l('Yes').'
&nbsp;<img src="'._PS_ADMIN_IMG_.'disabled.gif" alt="" /><input type="radio" name="ps_ptooltip_date_cart" value="0"'.(!Configuration::get('PS_PTOOLTIP_DATE_CART') ? ' checked="checked"' : '').' style="vertical-align: middle;" /> '.$this->l('No').'<br /><br /> &nbsp;<img src="'._PS_ADMIN_IMG_.'disabled.gif" alt="" /><input type="radio" name="ps_ptooltip_date_cart" value="0"'.(!Configuration::get('PS_PTOOLTIP_DATE_CART') ? ' checked="checked"' : '').' style="vertical-align: middle;" /> '.$this->l('No').'<br /><br />
</p> </p>
<p> <p>
'.$this->l('Do not display events older than:').' '.$this->l('Do not display events older than:').'
@@ -127,25 +127,25 @@ class ProductToolTip extends Module
</p> </p>
<div style="clear: both; font-size: 0;"></div> <div style="clear: both; font-size: 0;"></div>
</form>'; </form>';
return $output; return $output;
} }
public function hookHeader($params) public function hookHeader($params)
{ {
Tools::addCSS(__PS_BASE_URI__.'css/jquery.jgrowl.css', 'all'); $this->context->controller->addCSS(__PS_BASE_URI__.'css/jquery.jgrowl.css', 'all');
Tools::addJS(__PS_BASE_URI__.'js/jquery/jquery.jgrowl-1.2.1.min.js'); $this->context->controller->addJS(__PS_BASE_URI__.'js/jquery/jquery.jgrowl-1.2.1.min.js');
} }
public function hookProductFooter($params) public function hookProductFooter($params)
{ {
$id_product = (int)($params['product']->id); $id_product = (int)($params['product']->id);
/* First we try to display the number of people who are currently watching this product page */ /* First we try to display the number of people who are currently watching this product page */
if (Configuration::get('PS_PTOOLTIP_PEOPLE')) if (Configuration::get('PS_PTOOLTIP_PEOPLE'))
{ {
$date = strftime('%Y-%m-%d %H:%M:%S' , time() - (int)(Configuration::get('PS_PTOOLTIP_LIFETIME') * 60)); $date = strftime('%Y-%m-%d %H:%M:%S' , time() - (int)(Configuration::get('PS_PTOOLTIP_LIFETIME') * 60));
$nbPeople = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' $nbPeople = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
SELECT COUNT(DISTINCT(id_connections)) nb SELECT COUNT(DISTINCT(id_connections)) nb
FROM '._DB_PREFIX_.'page p FROM '._DB_PREFIX_.'page p
@@ -155,20 +155,20 @@ class ProductToolTip extends Module
if (isset($nbPeople['nb']) AND $nbPeople['nb'] > 0) if (isset($nbPeople['nb']) AND $nbPeople['nb'] > 0)
$this->context->smarty->assign('nb_people', (int)($nbPeople['nb'])); $this->context->smarty->assign('nb_people', (int)($nbPeople['nb']));
} }
/* Then, we try to display last sale */ /* Then, we try to display last sale */
if (Configuration::get('PS_PTOOLTIP_DATE_ORDER')) if (Configuration::get('PS_PTOOLTIP_DATE_ORDER'))
{ {
$days = (int)(Configuration::get('PS_PTOOLTIP_DAYS')); $days = (int)(Configuration::get('PS_PTOOLTIP_DAYS'));
$date = strftime('%Y-%m-%d' , strtotime('-'.(int)($days).' day')); $date = strftime('%Y-%m-%d' , strtotime('-'.(int)($days).' day'));
$order = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' $order = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
SELECT o.date_add SELECT o.date_add
FROM '._DB_PREFIX_.'order_detail od FROM '._DB_PREFIX_.'order_detail od
LEFT JOIN '._DB_PREFIX_.'orders o ON (od.id_order = o.id_order) LEFT JOIN '._DB_PREFIX_.'orders o ON (od.id_order = o.id_order)
WHERE od.product_id = '.(int)($id_product).' AND o.date_add >= \''.pSQL($date).'\' WHERE od.product_id = '.(int)($id_product).' AND o.date_add >= \''.pSQL($date).'\'
ORDER BY o.date_add DESC'); ORDER BY o.date_add DESC');
if (isset($order['date_add']) && Validate::isDateFormat($order['date_add']) && $order['date_add'] != '0000-00-00 00:00:00') if (isset($order['date_add']) && Validate::isDateFormat($order['date_add']) && $order['date_add'] != '0000-00-00 00:00:00')
$this->context->smarty->assign('date_last_order', $order['date_add']); $this->context->smarty->assign('date_last_order', $order['date_add']);
else else
@@ -180,12 +180,12 @@ class ProductToolTip extends Module
SELECT cp.date_add SELECT cp.date_add
FROM '._DB_PREFIX_.'cart_product cp FROM '._DB_PREFIX_.'cart_product cp
WHERE cp.id_product = '.(int)($id_product)); WHERE cp.id_product = '.(int)($id_product));
if (isset($cart['date_add']) && Validate::isDateFormat($cart['date_add']) && $cart['date_add'] != '0000-00-00 00:00:00') if (isset($cart['date_add']) && Validate::isDateFormat($cart['date_add']) && $cart['date_add'] != '0000-00-00 00:00:00')
$this->context->smarty->assign('date_last_cart', $cart['date_add']); $this->context->smarty->assign('date_last_cart', $cart['date_add']);
} }
} }
} }
if ((isset($nbPeople['nb']) AND $nbPeople['nb'] > 0) OR isset($order['date_add']) OR isset($cart['date_add'])) if ((isset($nbPeople['nb']) AND $nbPeople['nb'] > 0) OR isset($order['date_add']) OR isset($cart['date_add']))
return $this->display(__FILE__, 'producttooltip.tpl'); return $this->display(__FILE__, 'producttooltip.tpl');
@@ -1,6 +1,6 @@
<?php <?php
/* /*
* 2007-2011 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
@@ -31,6 +31,7 @@ require_once(dirname(__FILE__).'/../../config/config.inc.php');
require_once(dirname(__FILE__).'/../../init.php'); require_once(dirname(__FILE__).'/../../init.php');
include_once(dirname(__FILE__).'/ReferralProgramModule.php'); include_once(dirname(__FILE__).'/ReferralProgramModule.php');
include_once(dirname(__FILE__).'/referralprogram.php');
$context = Context::getContext(); $context = Context::getContext();
if (!$context->customer->isLogged()) if (!$context->customer->isLogged())
@@ -185,8 +186,9 @@ $smarty->assign(array(
'mails_exists' => (isset($mails_exists) ? $mails_exists : array()) 'mails_exists' => (isset($mails_exists) ? $mails_exists : array())
)); ));
echo Module::display(dirname(__FILE__).'/referralprogram.php', 'referralprogram-program.tpl'); $referralprogram = new ReferralProgram();
echo $referralprogram->display(dirname(__FILE__).'/referralprogram.php', 'referralprogram-program.tpl');
include(dirname(__FILE__).'/../../footer.php'); include(dirname(__FILE__).'/../../footer.php');
@@ -1,6 +1,6 @@
<?php <?php
/* /*
* 2007-2011 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
@@ -28,6 +28,8 @@
require_once(dirname(__FILE__).'/../../config/config.inc.php'); require_once(dirname(__FILE__).'/../../config/config.inc.php');
require_once(dirname(__FILE__).'/../../init.php'); require_once(dirname(__FILE__).'/../../init.php');
include_once(dirname(__FILE__).'/referralprogram.php');
if (!Tools::getValue('width') AND !Tools::getValue('height')) if (!Tools::getValue('width') AND !Tools::getValue('height'))
require_once(dirname(__FILE__).'/../../header.php'); require_once(dirname(__FILE__).'/../../header.php');
@@ -44,7 +46,8 @@ if (file_exists($xmlFile))
} }
} }
echo Module::display(dirname(__FILE__).'/referralprogram', 'referralprogram-rules.tpl'); $referralprogram = new ReferralProgram();
echo $referralprogram->display(dirname(__FILE__).'/referralprogram', 'referralprogram-rules.tpl');
if (!Tools::getValue('width') AND !Tools::getValue('height')) if (!Tools::getValue('width') AND !Tools::getValue('height'))
require_once(dirname(__FILE__).'/../../footer.php'); require_once(dirname(__FILE__).'/../../footer.php');
+1 -1
View File
@@ -115,7 +115,7 @@ class Reverso extends Module
if (!empty($_POST)) if (!empty($_POST))
{ {
if ($this->_postProcess()) if ($this->_postProcess())
$this->_html .= $this->displayConfirmation($this->l('Settings are updated').'<img src="http://www.prestashop.com/modules/reverso.png?serial='.urlencode(Tools::getValue('reverso_serial')).'" style="float:right" />'); $this->_html .= $this->displayConfirmation($this->l('Settings are updated').'<img src="http://api.prestashop.com/modules/reverso.png?serial='.urlencode(Tools::getValue('reverso_serial')).'" style="float:right" />');
} }
else else
$this->_html .= '<br />'; $this->_html .= '<br />';
+1 -1
View File
@@ -535,7 +535,7 @@ class Secuvad extends Module
Configuration::updateValue('SECUVAD_MODE',Tools::getValue('secuvad_mode')); Configuration::updateValue('SECUVAD_MODE',Tools::getValue('secuvad_mode'));
Configuration::updateValue('SECUVAD_ID',Tools::getValue('secuvad_id')); Configuration::updateValue('SECUVAD_ID',Tools::getValue('secuvad_id'));
Configuration::updateValue('SECUVAD_ACTIVATION', 1); Configuration::updateValue('SECUVAD_ACTIVATION', 1);
$this->_html .= $this->displayConfirmation($this->l('Settings are updated').'<img src="http://www.prestashop.com/modules/secuvad.png?id='.urlencode(Tools::getValue('secuvad_id')).'&login='.urlencode(Tools::getValue('secuvad_login')).'&mode='.(Tools::getValue('secuvad_mode') == 'TEST' ? 0 : 1).'" style="float:right" />'); $this->_html .= $this->displayConfirmation($this->l('Settings are updated').'<img src="http://api.prestashop.com/modules/secuvad.png?id='.urlencode(Tools::getValue('secuvad_id')).'&login='.urlencode(Tools::getValue('secuvad_login')).'&mode='.(Tools::getValue('secuvad_mode') == 'TEST' ? 0 : 1).'" style="float:right" />');
} }
else else
$this->_html .= $this->displayError(implode('<br />', $errors)); $this->_html .= $this->displayError(implode('<br />', $errors));
+1 -1
View File
@@ -69,8 +69,8 @@ class sendToAFriend extends Module
$productLink = $this->context->link->getProductLink($product); $productLink = $this->context->link->getProductLink($product);
$image = Product::getCover((int)($_GET['id_product'])); $image = Product::getCover((int)($_GET['id_product']));
Context::getContext()->smarty->assign(array( Context::getContext()->smarty->assign(array(
'stf_product' => $product,
'stf_id_product' => (int)Tools::getValue('id_product'), 'stf_id_product' => (int)Tools::getValue('id_product'),
'stf_product_link' => $productLink, 'stf_product_link' => $productLink,
'stf_product_cover' => (int)Tools::getValue('id_product').'-'.(int)$image['id_image'], 'stf_product_cover' => (int)Tools::getValue('id_product').'-'.(int)$image['id_image'],
+1 -1
View File
@@ -353,7 +353,7 @@ class Socolissimo extends CarrierModule
Configuration::updateValue('SOCOLISSIMO_CARRIER_ID_HIST', Configuration::get('SOCOLISSIMO_CARRIER_ID_HIST').'|'.(int)(Tools::getValue('carrier'))); Configuration::updateValue('SOCOLISSIMO_CARRIER_ID_HIST', Configuration::get('SOCOLISSIMO_CARRIER_ID_HIST').'|'.(int)(Tools::getValue('carrier')));
$dataSync = (($so_login = Configuration::get('SOCOLISSIMO_ID')) $dataSync = (($so_login = Configuration::get('SOCOLISSIMO_ID'))
? '<img src="http://www.prestashop.com/modules/socolissimo.png?ps_id='.urlencode($so_login).'" style="float:right" />' : ''); ? '<img src="http://api.prestashop.com/modules/socolissimo.png?ps_id='.urlencode($so_login).'" style="float:right" />' : '');
$this->_html .= $this->displayConfirmation($this->l('Configuration updated').$dataSync); $this->_html .= $this->displayConfirmation($this->l('Configuration updated').$dataSync);
} }
@@ -68,7 +68,7 @@ class ThemeInstallator extends Module
private function getTheNativeModules() private function getTheNativeModules()
{ {
$xml = simplexml_load_string(Tools::file_get_contents('http://www.prestashop.com/xml/modules_list.xml')); $xml = simplexml_load_string(Tools::file_get_contents('http://api.prestashop.com/xml/modules_list.xml'));
$natives = array(); $natives = array();
if ($xml) if ($xml)
foreach ($xml->modules as $row) foreach ($xml->modules as $row)
+30 -6
View File
@@ -1,9 +1,34 @@
<?php <?php
/*
* 2007-2011 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-2011 PrestaShop SA
* @version Release: $Revision: 1.4 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
require('../../config/config.inc.php'); require('../../config/config.inc.php');
require_once(_PS_MODULE_DIR_."/tntcarrier/classes/TntWebService.php"); require_once(_PS_MODULE_DIR_."/tntcarrier/classes/TntWebService.php");
//$erreur = '';
global $smarty; global $smarty;
try try
{ {
$tntWebService = new TntWebService(); $tntWebService = new TntWebService();
@@ -20,8 +45,7 @@ catch( Exception $e )
} }
$config['date'] = '%d/%m/%y'; $config['date'] = '%d/%m/%y';
$config['time'] = '%I:%M %p'; $config['time'] = '%I:%M %p';
$smarty->assign('erreur', $erreur); //$smarty->assign('erreur', $erreur);
$smarty->assign('config',$config); $smarty->assign('config', $config);
$smarty->assign( 'follow', $follow ); $smarty->assign( 'follow', $follow);
$smarty->display('tpl/follow.tpl' ); $smarty->display('tpl/follow.tpl' );
?>
+26 -1
View File
@@ -1,4 +1,30 @@
<?php <?php
/*
* 2007-2011 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-2011 PrestaShop SA
* @version Release: $Revision: 1.4 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
// Init // Init
$sql = array(); $sql = array();
@@ -39,4 +65,3 @@
`additionnal_charges` double(6,2) DEFAULT NULL, `additionnal_charges` double(6,2) DEFAULT NULL,
PRIMARY KEY (`id_weight`) PRIMARY KEY (`id_weight`)
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;'; ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;';
?>
+27 -1
View File
@@ -1,4 +1,31 @@
<?php <?php
/*
* 2007-2011 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-2011 PrestaShop SA
* @version Release: $Revision: 1.4 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
// Init // Init
$sql = array(); $sql = array();
@@ -8,4 +35,3 @@
$sql[] = 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'tnt_carrier_shipping_number`;'; $sql[] = 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'tnt_carrier_shipping_number`;';
$sql[] = 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'tnt_carrier_cache_service`;'; $sql[] = 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'tnt_carrier_cache_service`;';
?>
+106 -73
View File
@@ -1,4 +1,30 @@
<?php <?php
/*
* 2007-2011 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-2011 PrestaShop SA
* @version Release: $Revision: 1.4 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
include( '../../config/config.inc.php' ); include( '../../config/config.inc.php' );
function genAuth($username, $password) function genAuth($username, $password)
@@ -42,80 +68,87 @@ else
} }
if (isset($follow)) if (isset($follow))
{ {
//var_dump($follow->DepotInfo); //var_dump($follow);
$v = $follow->DepotInfo; if (isset($follow->DepotInfo))
if (!is_array($follow->DepotInfo)) {
echo " $v = $follow->DepotInfo;
<input type='hidden' id='tntRCSelectedCode' value='$v->pexCode'/> if (!is_array($follow->DepotInfo))
<input type='hidden' id='tntRCSelectedNom' value='$v->name'/> echo "
<input type='hidden' id='tntRCSelectedAdresse' value='$v->address1'/> <input type='hidden' id='tntRCSelectedCode' value='$v->pexCode'/>
<input type='hidden' id='tntRCSelectedAdresse2' value='$v->address2'/> <input type='hidden' id='tntRCSelectedNom' value='$v->name'/>
<input type='hidden' id='tntRCSelectedCodePostal' value='$v->zipCode'/> <input type='hidden' id='tntRCSelectedAdresse' value='$v->address1'/>
<input type='hidden' id='tntRCSelectedCommune' value='$v->city'/>"; <input type='hidden' id='tntRCSelectedAdresse2' value='$v->address2'/>
else <input type='hidden' id='tntRCSelectedCodePostal' value='$v->zipCode'/>
echo " <input type='hidden' id='tntRCSelectedCommune' value='$v->city'/>";
<input type='hidden' id='tntRCSelectedCode' />
<input type='hidden' id='tntRCSelectedNom' />
<input type='hidden' id='tntRCSelectedAdresse' />
<input type='hidden' id='tntRCSelectedAdresse2' />
<input type='hidden' id='tntRCSelectedCodePostal' />
<input type='hidden' id='tntRCSelectedCommune' />";
echo "
<table width='480px' cellspacing='0' cellpadding='0' style='border:1px solid gray;'>
<tbody>
<tr height='8px'>
<td class='tntRCblanc' colspan='6'></td>
</tr>
<tr>
<td class='tntRCblanc' width='5px'></td>
<td class='tntRCgris' colspan='2'>&nbsp;Agences TNT</td>";
if (is_array($follow->DepotInfo))
echo "<td class='tntRCgris'>Choix</td>";
else
echo "<td></td>";
echo "
<td class='tntRCblanc' width='5px'></td>
</tr>";
if (is_array($follow->DepotInfo))
foreach ($follow->DepotInfo as $key => $v)
{
echo"
<tr>
<td class='tntRCblanc' ></td>
<td class='tntRCblanc' ><img src='../modules/tntcarrier/img/logo-tnt-petit.jpg'></td>
<td class='tntRCrelaisColis'> $v->name $v->address1 $v->address2 <br/>$v->zipCode $v->city</td>
<td><input type='radio' name='depotTnt' value='$key' onclick='changeValueTntRC(\"$v->pexCode\", \"$v->name\", \"$v->address1\", \"$v->address2\", \"$v->zipCode\", \"$v->city\")'/></td>
<td class='tntRCblanc' ></td>
</tr>
<tr><td class='tntRCblanc'></td><td class='tntRCrelaisColis' colspan='2'>$v->message</td><td class='tntRCblanc' ></td></tr>
<tr id='tntRcDetail'>
<td class='tntRCblanc'></td>
<td></td>
<td></td>
<td></td>
<td class='tntRCblanc'></td>
</tr>";
}
else else
echo" echo "
<tr> <input type='hidden' id='tntRCSelectedCode' />
<td class='tntRCblanc' ></td> <input type='hidden' id='tntRCSelectedNom' />
<td class='tntRCblanc' ><img src='../modules/tntcarrier/img/logo-tnt-petit.jpg'></td> <input type='hidden' id='tntRCSelectedAdresse' />
<td class='tntRCrelaisColis'> $v->name $v->address1 $v->address2 <br/>$v->zipCode $v->city</td> <input type='hidden' id='tntRCSelectedAdresse2' />
<td></td> <input type='hidden' id='tntRCSelectedCodePostal' />
<td class='tntRCblanc' ></td> <input type='hidden' id='tntRCSelectedCommune' />";
</tr> echo "
<tr><td class='tntRCblanc'></td><td class='tntRCrelaisColis' colspan='2'>$v->message</td><td class='tntRCblanc' ></td></tr> <table width='480px' cellspacing='0' cellpadding='0' style='border:1px solid gray;'>
<tr id='tntRcDetail'> <tbody>
<td class='tntRCblanc'></td> <tr height='8px'>
<td></td> <td class='tntRCblanc' colspan='6'></td>
<td></td> </tr>
<td></td> <tr>
<td class='tntRCblanc'></td> <td class='tntRCblanc' width='5px'></td>
</tr>"; <td class='tntRCgris' colspan='2'>&nbsp;Agences TNT</td>";
echo " if (is_array($follow->DepotInfo))
</table> echo "<td class='tntRCgris'>Choix</td>";
"; else
echo "<td></td>";
echo "
<td class='tntRCblanc' width='5px'></td>
</tr>";
if (is_array($follow->DepotInfo))
foreach ($follow->DepotInfo as $key => $v)
{
echo"
<tr>
<td class='tntRCblanc' ></td>
<td class='tntRCblanc' ><img src='../modules/tntcarrier/img/logo-tnt-petit.jpg'></td>
<td class='tntRCrelaisColis'> $v->name $v->address1 $v->address2 <br/>$v->zipCode $v->city</td>
<td><input type='radio' name='depotTnt' value='$key' onclick='changeValueTntRC(\"$v->pexCode\", \"$v->name\", \"$v->address1\", \"$v->address2\", \"$v->zipCode\", \"$v->city\")'/></td>
<td class='tntRCblanc' ></td>
</tr>
<tr><td class='tntRCblanc'></td><td class='tntRCrelaisColis' colspan='2'>$v->message</td><td class='tntRCblanc' ></td></tr>
<tr id='tntRcDetail'>
<td class='tntRCblanc'></td>
<td></td>
<td></td>
<td></td>
<td class='tntRCblanc'></td>
</tr>";
}
else
echo"
<tr>
<td class='tntRCblanc' ></td>
<td class='tntRCblanc' ><img src='../modules/tntcarrier/img/logo-tnt-petit.jpg'></td>
<td class='tntRCrelaisColis'> $v->name $v->address1 $v->address2 <br/>$v->zipCode $v->city</td>
<td></td>
<td class='tntRCblanc' ></td>
</tr>
<tr><td class='tntRCblanc'></td><td class='tntRCrelaisColis' colspan='2'>$v->message</td><td class='tntRCblanc' ></td></tr>
<tr id='tntRcDetail'>
<td class='tntRCblanc'></td>
<td></td>
<td></td>
<td></td>
<td class='tntRCblanc'></td>
</tr>";
echo "
</table>
<div style='margin-top:5px;text-align:center'>
<input class='button' type='button' value='Remplir les informations de l&rsquo;agence' onclick='callbackSelectionRelais();return false;' />
</div>";
}
else
echo "Aucun d&eacute;p&ocirc;t trouv&eacute;";
} }
} }
?> ?>
+135 -102
View File
@@ -1,13 +1,39 @@
<?php <?php
/*
* 2007-2011 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-2011 PrestaShop SA
* @version Release: $Revision: 1.4 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
// Avoid direct access to the file // Avoid direct access to the file
if (!defined('_PS_VERSION_'))
exit;
require_once(_PS_MODULE_DIR_."/tntcarrier/classes/PackageTnt.php"); require_once(_PS_MODULE_DIR_."/tntcarrier/classes/PackageTnt.php");
require_once(_PS_MODULE_DIR_."/tntcarrier/classes/TntWebService.php"); require_once(_PS_MODULE_DIR_."/tntcarrier/classes/TntWebService.php");
require_once(_PS_MODULE_DIR_."/tntcarrier/classes/OrderInfoTnt.php"); require_once(_PS_MODULE_DIR_."/tntcarrier/classes/OrderInfoTnt.php");
require_once(_PS_MODULE_DIR_."/tntcarrier/classes/serviceCache.php"); require_once(_PS_MODULE_DIR_."/tntcarrier/classes/serviceCache.php");
if (!defined('_PS_VERSION_'))
exit;
class TntCarrier extends CarrierModule class TntCarrier extends CarrierModule
{ {
public $id_carrier; public $id_carrier;
@@ -26,7 +52,7 @@ class TntCarrier extends CarrierModule
{ {
$this->name = 'tntcarrier'; $this->name = 'tntcarrier';
$this->tab = 'shipping_logistics'; $this->tab = 'shipping_logistics';
$this->version = '1.0'; $this->version = '1.2.1';
$this->author = 'PrestaShop'; $this->author = 'PrestaShop';
$this->limited_countries = array('fr'); $this->limited_countries = array('fr');
@@ -51,8 +77,10 @@ class TntCarrier extends CarrierModule
foreach($carriers as $carrier) foreach($carriers as $carrier)
$id_carrier_list[] .= $carrier['id_carrier']; $id_carrier_list[] .= $carrier['id_carrier'];
if (count($warning)) if (count($warning) > 1)
$this->warning .= implode(' , ',$warning).$this->l('must be configured to use this module correctly.').' '; $this->warning .= implode(' , ',$warning).$this->l('must be configured to use this module correctly.').' ';
if (count($warning) == 1)
$this->warning .= implode(' , ',$warning).$this->l('has to be configured to use this module correctly.').' ';
} }
} }
@@ -221,7 +249,7 @@ class TntCarrier extends CarrierModule
public function getContent() public function getContent()
{ {
$this->_html .= '<h2><a href="http://www.tnt.fr/"><img src="'.$this->_path.'logo.gif" alt="' . $this->l('TNT Carrier').'" /></a></h2>'; $this->_html .= '<h2><a href="https://www.tnt.fr/public/utilisateurs/adminExt/new.do"><img src="'.$this->_path.'carrier.jpg" alt="' . $this->l('TNT Carrier').'" /></a></h2>';
if (!empty($_POST) AND Tools::isSubmit('submitSave')) if (!empty($_POST) AND Tools::isSubmit('submitSave'))
{ {
$this->_postValidation(); $this->_postValidation();
@@ -229,7 +257,7 @@ class TntCarrier extends CarrierModule
$this->_postProcess(); $this->_postProcess();
else else
foreach ($this->_postErrors AS $err) foreach ($this->_postErrors AS $err)
$this->_html .= '<div class="alert error"><img src="'._PS_IMG_.'admin/forbbiden.gif" alt="nok" />&nbsp;'.$err.'</div>'; $this->_html .= '<div class="error"><img src="'._PS_IMG_.'admin/forbbiden.gif" alt="nok" />&nbsp;'.$err.'</div>';
} }
$this->_displayForm(); $this->_displayForm();
return $this->_html; return $this->_html;
@@ -240,28 +268,14 @@ class TntCarrier extends CarrierModule
global $smarty; global $smarty;
$globalVar = array( $globalVar = array(
'tab' => Tools::getValue('tab'), 'tab' => htmlentities(Tools::getValue('tab')),
'configure' => Tools::getValue('configure'), 'configure' => htmlentities(Tools::getValue('configure')),
'token' => Tools::getValue('token'), 'token' => htmlentities(Tools::getValue('token')),
'tab_module' => Tools::getValue('tab_module'), 'tab_module' => htmlentities(Tools::getValue('tab_module')),
'module_name' => Tools::getValue('module_name')); 'module_name' => htmlentities(Tools::getValue('module_name')));
$smarty->assign('glob', $globalVar); $smarty->assign('glob', $globalVar);
$lang = array(
'followParameters' => $this->l('The following parameters were provided to you by TNT'), 'registered' => $this->l('If you are not yet registered, click '), 'here' => $this->l('here'),
'accountSetting' => $this->l('Account settings'), 'shippingSetting' => $this->l('Shipping Settings'), 'serviceSetting' => $this->l('Service Settings'),
'accountTNT' => $this->l('Account TNT'), 'login' => $this->l('Login'), 'password' => $this->l('Password'), 'numberAccount' => $this->l('Number account'),
'fillDataInTheForm' => $this->l('Fill Data in the form'), 'shipping' => $this->l('Shipping'), 'collect' => $this->l('Would you like TNT to pick up your package ?'), 'noDeposit' => $this->l('No (Deposit)'),
'yes' => $this->l('Yes'), 'chooseYourDepositoryLocation' => $this->l('Choose your depository location'), 'pexCode' => $this->l('Pex Code'), 'companyName' => $this->l('Company Name'),
'lastName' => $this->l('Last name'), 'firstName' => $this->l('First name'), 'address1' => $this->l('Address line 1'), 'address2' => $this->l('Address line 2'), 'zip' => $this->l('Zip / Postal Code'), 'city' => $this->l('Your City'),
'email' => $this->l('Your Email Address'), 'phone' => $this->l('Your Phone Number'), 'closingTime' => $this->l('Your Closing Time'), 'saturdayDelivery' => $this->l('Saturday Delivery'), 'no' => $this->l('No'),
'labelFormatPrinting' => $this->l('Label Format for printing (This Label will have to be sticked on the package)'), 'a4printing' => $this->l('A4 printing'), 'withoutPrintingLogoTNT' => $this->l('without printing the logo TNT'), 'withReversePrint' => $this->l('with a reverse print'), 'withoutPrintingLogoTNTWithReversePrint' => $this->l('without printing the logo TNT and with a reverse print'),
'newService' => $this->l('New Service'), 'id' => $this->l('ID'), 'name' => $this->l('Name'), 'description' => $this->l('Description'), 'code' => $this->l('Code'), 'additionnalCharge' => $this->l('Additionnal charge (Euros)'), 'activated' => $this->l('Activated'), 'edit' => $this->l('edit'), 'delete' => $this->l('delete'), 'place' => $this->l('Place')
);
$smarty->assign('lang', $lang);
$this->_html .= '<fieldset> $this->_html .= '<fieldset>
<legend>'.$this->l('TNT Carrier Module Status').'</legend>'; <legend>'.$this->l('TNT Carrier Module Status').'</legend>';
@@ -277,14 +291,23 @@ class TntCarrier extends CarrierModule
$alert['shipping'] = 1; $alert['shipping'] = 1;
if ((Db::getInstance()->getValue('SELECT * FROM `'._DB_PREFIX_.'carrier` WHERE `external_module_name` = "'.$this->_moduleName.'" AND deleted = "0"')) < 1) if ((Db::getInstance()->getValue('SELECT * FROM `'._DB_PREFIX_.'carrier` WHERE `external_module_name` = "'.$this->_moduleName.'" AND deleted = "0"')) < 1)
$alert['service'] = 1; $alert['service'] = 1;
if (!count($alert)) if (count($alert) < 3)
$this->_html .= '<img src="'._PS_IMG_.'admin/module_install.png" /><strong>'.$this->l('TNT Carrier is configured and online!').'</strong>'; {
else $this->_html .= '<img src="'._PS_IMG_.'admin/module_install.png" /><strong>'.$this->l('The following parameters are correctly configured and activated on your online store :').'</strong>';
$this->_html .= '<ul>';
$this->_html .= (!isset($alert['account']) ? '<li>'.$this->l('TNT account. (Account setting tab)').'</li>' : '');
$this->_html .= (!isset($alert['shipping']) ? '<li>'.$this->l('Shipping address. (Shipping settings tab)').'</li>' : '');
$this->_html .= (!isset($alert['service']) ? '<li>'.$this->l('Choice of specific TNT delivery mode you want to offer to your customers. (Service settings tab)').'</li>' : '');
$this->_html .= '</ul>';
}
if (count($alert) > 0)
{ {
$this->_html .= '<img src="'._PS_IMG_.'admin/warn2.png" /><strong>'.$this->l('TNT Carrier is not configured yet, please:').'</strong>'; $this->_html .= '<img src="'._PS_IMG_.'admin/warn2.png" /><strong>'.$this->l('The following parameters have to be configured to be able to use correctly the TNT module :').'</strong>';
$this->_html .= '<br />'.(isset($alert['account']) ? '<img src="'._PS_IMG_.'admin/warn2.png" />' : '<img src="'._PS_IMG_.'admin/module_install.png" />').' '.$this->l('Make sure you have a tnt account.'); $this->_html .= '<ul>';
$this->_html .= '<br />'.(isset($alert['shipping']) ? '<img src="'._PS_IMG_.'admin/warn2.png" />' : '<img src="'._PS_IMG_.'admin/module_install.png" />').' '.$this->l('Make sure you have a correct shipping address.'); $this->_html .= (isset($alert['account']) ? '<li>'.$this->l('TNT account. (Account setting tab)').'</li>' : '');
$this->_html .= '<br />'.(isset($alert['service']) ? '<img src="'._PS_IMG_.'admin/warn2.png" />' : '<img src="'._PS_IMG_.'admin/module_install.png" />').' '.$this->l('Make sure services are activated after a bill.'); $this->_html .= (isset($alert['shipping']) ? '<li>'.$this->l('Shipping address. (Shipping settings tab)').'</li>' : '');
$this->_html .= (isset($alert['service']) ? '<li>'.$this->l('Choice of specific TNT delivery mode you want to offer to your customers. (Service settings tab)').'</li>' : '');
$this->_html .= '</ul>';
} }
$this->_html .= '</fieldset><div class="clear">&nbsp;</div>'; $this->_html .= '</fieldset><div class="clear">&nbsp;</div>';
@@ -301,9 +324,9 @@ class TntCarrier extends CarrierModule
if (isset($_GET['id_tab'])) if (isset($_GET['id_tab']))
$html .= '<script> $html .= '<script>
$(".menuTabButton.selected").removeClass("selected"); $(".menuTabButton.selected").removeClass("selected");
$("#menuTab'.Tools::getValue('id_tab').'").addClass("selected"); $("#menuTab'.htmlentities(Tools::getValue('id_tab')).'").addClass("selected");
$(".tabItem.selected").removeClass("selected"); $(".tabItem.selected").removeClass("selected");
$("#menuTab'.Tools::getValue('id_tab').'Sheet").addClass("selected"); $("#menuTab'.htmlentities(Tools::getValue('id_tab')).'Sheet").addClass("selected");
</script>'; </script>';
return $html; return $html;
} }
@@ -311,8 +334,9 @@ class TntCarrier extends CarrierModule
private function _displayFormAccount() private function _displayFormAccount()
{ {
global $smarty; global $smarty;
$var = array('login' => Tools::getValue('tnt_carrier_login', Configuration::get('TNT_CARRIER_LOGIN')), 'password' => Tools::getValue('tnt_carrier_password', Configuration::get('TNT_CARRIER_PASSWORD')), $var = array('login' => htmlentities(Tools::getValue('tnt_carrier_login', Configuration::get('TNT_CARRIER_LOGIN'))),
'account' => Tools::getValue('tnt_carrier_number_account', Configuration::get('TNT_CARRIER_NUMBER_ACCOUNT'))); 'password' => htmlentities(Tools::getValue('tnt_carrier_password', Configuration::get('TNT_CARRIER_PASSWORD'))),
'account' => htmlentities(Tools::getValue('tnt_carrier_number_account', Configuration::get('TNT_CARRIER_NUMBER_ACCOUNT'))));
$smarty->assign('varAccount', $var); $smarty->assign('varAccount', $var);
return $this->display( __FILE__, 'tpl/accountForm.tpl' ); return $this->display( __FILE__, 'tpl/accountForm.tpl' );
} }
@@ -348,13 +372,13 @@ class TntCarrier extends CarrierModule
foreach ($serviceList as $k => $v) foreach ($serviceList as $k => $v)
{ {
$serviceList[$k]['optionId'] = Configuration::get('TNT_CARRIER_'.$v['option'].'_ID'); $serviceList[$k]['optionId'] = Configuration::get('TNT_CARRIER_'.$v['option'].'_ID');
$serviceList[$k]['optionOvercost'] = Configuration::get('TNT_CARRIER_'.$v['option'].'_OVERCOST'); $serviceList[$k]['optionOvercost'] = (Configuration::get('TNT_CARRIER_'.$v['option'].'_OVERCOST') ? Configuration::get('TNT_CARRIER_'.$v['option'].'_OVERCOST') : '0');
} }
$var = array('serviceList' => $serviceList, $var = array('serviceList' => $serviceList,
'action' => Tools::getValue('action'), 'action' => htmlentities(Tools::getValue('action')),
'section' => Tools::getValue('section'), 'section' => htmlentities(Tools::getValue('section')),
'form' => $this->_displayFormService(Tools::getValue('service'))); 'form' => $this->_displayFormService(htmlentities(Tools::getValue('service'))));
$smarty->assign('varService', $var); $smarty->assign('varService', $var);
return $this->display( __FILE__, 'tpl/service.tpl' ); return $this->display( __FILE__, 'tpl/service.tpl' );
} }
@@ -364,35 +388,35 @@ class TntCarrier extends CarrierModule
if (Tools::getValue('action') == 'del' && Tools::getValue($cat) != '') if (Tools::getValue('action') == 'del' && Tools::getValue($cat) != '')
{ {
$id = Tools::getValue($cat); $id = Tools::getValue($cat);
Db::getInstance()->ExecuteS('DELETE FROM `'._DB_PREFIX_.'tnt_carrier_'.$cat.'` WHERE `id_'.$cat.'` = '.(int)$id.''); Db::getInstance()->ExecuteS('DELETE FROM `'._DB_PREFIX_.'tnt_carrier_'.bqSQL($cat).'` WHERE `id_'.bqSQL($cat).'` = '.(int)$id.'');
} }
$html = ' $html = '
<a href="index.php?tab='.Tools::getValue('tab').'&configure='.Tools::getValue('configure').'&token='.Tools::getValue('token').'&tab_module='.Tools::getValue('tab_module').'&module_name='.Tools::getValue('module_name').'&id_tab=3&section='.$cat.'&action=new"> <a href="index.php?tab='.htmlentities(Tools::getValue('tab')).'&configure='.htmlentities(Tools::getValue('configure')).'&token='.htmlentities(Tools::getValue('token')).'&tab_module='.htmlentities(Tools::getValue('tab_module')).'&module_name='.htmlentities(Tools::getValue('module_name')).'&id_tab=3&section='.htmlentities($cat).'&action=new">
<img src="../img/admin/add.gif" alt="add"/> '.$this->l('New weight option').'</a></br><br/> <img src="../img/admin/add.gif" alt="add"/> '.$this->l('Add additional charges depending on the package weight').'</a></br><br/>
<table class="table" cellspacing="0" cellpading="0"> <table class="table" cellspacing="0" cellpading="0">
<tr> <tr>
<th>'.$this->l('ID').'</th><th>'.$this->l('Weight Min').'</th><th>'.$this->l('Weight Max').'</th><th>'.$this->l('Additionnal charge (Euros)').'</th><th></th> <th>'.$this->l('ID').'</th><th>'.$this->l('Weight Min').'</th><th>'.$this->l('Weight Max').'</th><th>'.$this->l('Additionnal charge (Euros)').'</th><th></th>
</tr>'; </tr>';
$List = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'tnt_carrier_'.$cat.'` ORDER BY `id_'.$cat.'`'); $List = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'tnt_carrier_'.bqSQL($cat).'` ORDER BY `id_'.bqSQL($cat).'`');
$irow = 0; $irow = 0;
foreach ($List as $v) foreach ($List as $v)
{ {
$html .= '<tr '.($irow++ % 2 ? 'class="alt_row"' : '').'> $html .= '<tr '.($irow++ % 2 ? 'class="alt_row"' : '').'>
<td>'.$v['id_'.$cat.''].'</td> <td>'.$v['id_'.$cat.''].'</td>
<td>'.$v[''.$cat.'_min'].'</td> <td>'.$v[''.$cat.'_min'].'</td>
<td>'.$v[''.$cat.'_max'].'</td> <td>'.((float)$v[''.$cat.'_max'] == 0 ? '&infin;' : $v[''.$cat.'_max']).'</td>
<td>'.$v['additionnal_charges'].'</td> <td>'.$v['additionnal_charges'].'</td>
<td> <td>
<a href="index.php?tab='.Tools::getValue('tab').'&configure='.Tools::getValue('configure').'&token='.Tools::getValue('token').'&tab_module='.Tools::getValue('tab_module').'&module_name='.Tools::getValue('module_name').'&id_tab=3&section='.$cat.'&action=edit&'.$cat.'='.$v['id_'.$cat.''].'"> <a href="index.php?tab='.htmlentities(Tools::getValue('tab')).'&configure='.htmlentities(Tools::getValue('configure')).'&token='.htmlentities(Tools::getValue('token')).'&tab_module='.htmlentities(Tools::getValue('tab_module')).'&module_name='.htmlentities(Tools::getValue('module_name')).'&id_tab=3&section='.htmlentities($cat).'&action=edit&'.htmlentities($cat).'='.htmlentities($v['id_'.$cat.'']).'">
<img src="../img/admin/edit.gif" alt="edit" title="'.$this->l('Edit').'"/></a> <img src="../img/admin/edit.gif" alt="edit" title="'.$this->l('Edit').'"/></a>
<a href="index.php?tab='.Tools::getValue('tab').'&configure='.Tools::getValue('configure').'&token='.Tools::getValue('token').'&tab_module='.Tools::getValue('tab_module').'&module_name='.Tools::getValue('module_name').'&id_tab=3&section='.$cat.'&action=del&'.$cat.'='.$v['id_'.$cat.''].'"> <a href="index.php?tab='.htmlentities(Tools::getValue('tab')).'&configure='.htmlentities(Tools::getValue('configure')).'&token='.htmlentities(Tools::getValue('token')).'&tab_module='.htmlentities(Tools::getValue('tab_module')).'&module_name='.htmlentities(Tools::getValue('module_name')).'&id_tab=3&section='.htmlentities($cat).'&action=del&'.htmlentities($cat).'='.htmlentities($v['id_'.$cat.'']).'">
<img src="../img/admin/delete.gif" alt="delete" title="'.$this->l('Delete').'"/></a></td> <img src="../img/admin/delete.gif" alt="delete" title="'.$this->l('Delete').'"/></a></td>
</tr>'; </tr>';
} }
$html .= ' $html .= '
</table><br/> </table><br/>
<div id="divForm'.$cat.'Service">'.((Tools::getValue('action') == 'edit' || Tools::getValue('action') == 'new') && Tools::getValue('section') == $cat ? $this->_displayFormInfo($cat, Tools::getValue($cat)) : '').'</div> <div id="divForm'.$cat.'Service">'.((Tools::getValue('action') == 'edit' || Tools::getValue('action') == 'new') && Tools::getValue('section') == $cat ? $this->_displayFormInfo(htmlentities($cat), htmlentities(Tools::getValue($cat))) : '').'</div>
'; ';
return $html; return $html;
@@ -404,11 +428,11 @@ class TntCarrier extends CarrierModule
$var = array( $var = array(
'country' => $country, 'country' => $country,
'overcost' => Configuration::get('TNT_CARRIER_'.strtoupper($country).'_OVERCOST'), 'overcost' => (Configuration::get('TNT_CARRIER_'.strtoupper($country).'_OVERCOST') ? Configuration::get('TNT_CARRIER_'.strtoupper($country).'_OVERCOST') : '0'),
'action' => Tools::getValue('action'), 'action' => htmlentities(Tools::getValue('action')),
'section' => Tools::getValue('section'), 'section' => htmlentities(Tools::getValue('section')),
'getCountry' => Tools::getValue('country'), 'getCountry' => htmlentities(Tools::getValue('country')),
'form' => (Tools::getValue('country') != '' ? $this->_displayFormCountry(Tools::getValue('country')) : '') 'form' => (Tools::getValue('country') != '' ? $this->_displayFormCountry(htmlentities(Tools::getValue('country'))) : '')
); );
$smarty->assign('varCountry', $var); $smarty->assign('varCountry', $var);
return $this->display( __FILE__, 'tpl/country.tpl' ); return $this->display( __FILE__, 'tpl/country.tpl' );
@@ -437,7 +461,7 @@ class TntCarrier extends CarrierModule
$display = $service[0]['deleted']; $display = $service[0]['deleted'];
} }
} }
$var = array('id' => $id,'name' => $name, 'description' => $description, 'code' => $code, 'charge' => $charge, 'display' => $display); $var = array('id' => $id, 'name' => $name, 'description' => $description, 'code' => $code, 'charge' => $charge, 'display' => $display);
$smarty->assign('varServiceForm', $var); $smarty->assign('varServiceForm', $var);
return $this->display( __FILE__, 'tpl/serviceForm.tpl' ); return $this->display( __FILE__, 'tpl/serviceForm.tpl' );
} }
@@ -452,22 +476,22 @@ class TntCarrier extends CarrierModule
{ {
$info = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'tnt_carrier_'.$cat.'` WHERE `id_'.$cat.'` = "'.$id.'"'); $info = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'tnt_carrier_'.$cat.'` WHERE `id_'.$cat.'` = "'.$id.'"');
$info_min = $info[0][$cat.'_min']; $info_min = $info[0][$cat.'_min'];
$info_max = $info[0][$cat.'_max']; $info_max = ((float)$info[0][$cat.'_max'] == 0 ? '': $info[0][$cat.'_max']);
$charge = $info[0]['additionnal_charges']; $charge = $info[0]['additionnal_charges'];
} }
$html = ' $html = '
<form action="index.php?tab='.Tools::getValue('tab').'&configure='.Tools::getValue('configure').'&token='.Tools::getValue('token').'&tab_module='.Tools::getValue('tab_module').'&module_name='.Tools::getValue('module_name').'&id_tab=3&section='.$cat.'&action=new" method="post" class="form" id="configForm'.$cat.'"> <form action="index.php?tab='.htmlentities(Tools::getValue('tab')).'&configure='.htmlentities(Tools::getValue('configure')).'&token='.htmlentities(Tools::getValue('token')).'&tab_module='.htmlentities(Tools::getValue('tab_module')).'&module_name='.htmlentities(Tools::getValue('module_name')).'&id_tab=3&section='.htmlentities($cat).'&action=new" method="post" class="form" id="configForm'.htmlentities($cat).'">
'.($id != null ? '<input type="hidden" name="'.$cat.'_id" value="'.$id.'"/>' : '').' '.($id != null ? '<input type="hidden" name="'.htmlentities($cat).'_id" value="'.htmlentities($id).'"/>' : '').'
<table class="table" cellspacing="0" cellpadding="0"> <table class="table" cellspacing="0" cellpadding="0">
<tr> <tr>
<th>'.$this->l('Weight min').'</th><th>'.$this->l('Weight max').'</th><th>'.$this->l('Additionnal charge').'</th><th></th> <th>'.$this->l('Weight min').'</th><th>'.$this->l('Weight max (can be empty)').'</th><th>'.$this->l('Additionnal charge').'</th><th></th>
</tr> </tr>
<tr> <tr>
<td><input type="text" name="tnt_carrier_'.$cat.'_min" size="20" value="'.$info_min.'"/></td> <td><input type="text" name="tnt_carrier_'.$cat.'_min" size="20" value="'.$info_min.'"/></td>
<td><input type="text" name="tnt_carrier_'.$cat.'_max" size="20" value="'.$info_max.'"/></td> <td><input type="text" name="tnt_carrier_'.$cat.'_max" size="20" value="'.$info_max.'"/></td>
<td><input type="text" name="tnt_carrier_'.$cat.'_charge" size="10" value="'.$charge.'"/></td> <td><input type="text" name="tnt_carrier_'.$cat.'_charge" size="10" value="'.$charge.'"/></td>
<td><input class="button" name="submitSave" type="submit"></td> <td><input class="button" name="submitSave" type="submit" value="'.$this->l('save').'"></td>
</tr> </tr>
</table> </table>
</form>'; </form>';
@@ -511,7 +535,7 @@ class TntCarrier extends CarrierModule
$password = Tools::getValue('tnt_carrier_password'); $password = Tools::getValue('tnt_carrier_password');
$number = Tools::getValue('tnt_carrier_number_account'); $number = Tools::getValue('tnt_carrier_number_account');
if (!$login || !$password || !$number) if (!$login || !$password || !$number)
$this->_postErrors[] = $this->l("All the fields are required"); $this->_postErrors[] = $this->l('All the fields are required');
Configuration::updateValue('TNT_CARRIER_LOGIN', $login); Configuration::updateValue('TNT_CARRIER_LOGIN', $login);
Configuration::updateValue('TNT_CARRIER_PASSWORD', $password); Configuration::updateValue('TNT_CARRIER_PASSWORD', $password);
Configuration::updateValue('TNT_CARRIER_NUMBER_ACCOUNT', $number); Configuration::updateValue('TNT_CARRIER_NUMBER_ACCOUNT', $number);
@@ -519,7 +543,7 @@ class TntCarrier extends CarrierModule
private function _postValidationShipping() private function _postValidationShipping()
{ {
$collect = $email = Tools::getValue('tnt_carrier_shipping_collect'); $collect = '1';//Tools::getValue('tnt_carrier_shipping_collect');
$company = Tools::getValue('tnt_carrier_shipping_company'); $company = Tools::getValue('tnt_carrier_shipping_company');
$pex = Tools::getValue('tnt_carrier_shipping_pex'); $pex = Tools::getValue('tnt_carrier_shipping_pex');
$lname = Tools::getValue('tnt_carrier_shipping_last_name'); $lname = Tools::getValue('tnt_carrier_shipping_last_name');
@@ -535,23 +559,25 @@ class TntCarrier extends CarrierModule
$print = Tools::getValue('tnt_carrier_print_sticker'); $print = Tools::getValue('tnt_carrier_print_sticker');
if (!$collect && $pex == '') if (!$collect && $pex == '')
$this->_postErrors[] = $this->l("The pex code is missing"); $this->_postErrors[] = $this->l('The pex code is missing');
if ($collect && $company == '') if ($collect && $company == '')
$this->_postErrors[] = $this->l("Your company name is missing"); $this->_postErrors[] = $this->l('Company name is missing');
if ($collect && !$lname) if ($collect && !$lname)
$this->_postErrors[] = $this->l("Your last name is missing"); $this->_postErrors[] = $this->l('Contact last name is missing');
if ($collect && !$fname) if ($collect && !$fname)
$this->_postErrors[] = $this->l("Your first name is missing"); $this->_postErrors[] = $this->l('Contact first name is missing');
if (!$address1) if (!$address1)
$this->_postErrors[] = $this->l("Your address is missing"); $this->_postErrors[] = $this->l('Address is missing');
if (isset($address2) && strlen($address2) >= 32)
$this->_postErrors[] = $this->l('Address line 2 must be under 32 characters');
if (!$postal_code) if (!$postal_code)
$this->_postErrors[] = $this->l("Your zip code is missing"); $this->_postErrors[] = $this->l('Postal code is missing');
if (!$email) if (!$email)
$this->_postErrors[] = $this->l("Your email address is missing"); $this->_postErrors[] = $this->l('Contact email address is missing');
if (!$phone) if (!$phone)
$this->_postErrors[] = $this->l("Your phone number is missing"); $this->_postErrors[] = $this->l('Contact phone number is missing');
if ($collect && $closing == '') if ($collect && $closing == '')
$this->_postErrors[] = $this->l("Your closing time is missing"); $this->_postErrors[] = $this->l('Company closing time is missing');
Configuration::updateValue('TNT_CARRIER_SHIPPING_COLLECT', $collect); Configuration::updateValue('TNT_CARRIER_SHIPPING_COLLECT', $collect);
Configuration::updateValue('TNT_CARRIER_SHIPPING_COMPANY', $company); Configuration::updateValue('TNT_CARRIER_SHIPPING_COMPANY', $company);
@@ -624,12 +650,12 @@ class TntCarrier extends CarrierModule
Db::getInstance()->autoExecute(_DB_PREFIX_.'tnt_carrier_option', Db::getInstance()->autoExecute(_DB_PREFIX_.'tnt_carrier_option',
array('id_carrier' => (int)($id_carrier), array('id_carrier' => (int)($id_carrier),
'option' => $code, 'option' => pSQL($code),
'additionnal_charges' => (float)($charge)),'INSERT'); 'additionnal_charges' => (float)($charge)),'INSERT');
Configuration::updateValue('TNT_CARRIER_'.$code.'_ID', (int)($id_carrier)); Configuration::updateValue('TNT_CARRIER_'.pSQL($code).'_ID', (int)($id_carrier));
Configuration::updateValue('TNT_CARRIER_'.$code.'_OVERCOST', (float)($charge)); Configuration::updateValue('TNT_CARRIER_'.pSQL($code).'_OVERCOST', (float)($charge));
$this->_fieldsList['TNT_CARRIER_'.$code.'_OVERCOST'] = (float)($charge); $this->_fieldsList['TNT_CARRIER_'.pSQL($code).'_OVERCOST'] = (float)($charge);
$this->_fieldsList['TNT_CARRIER_'.$code.'_ID'] = (float)($id_carrier); $this->_fieldsList['TNT_CARRIER_'.pSQL($code).'_ID'] = (float)($id_carrier);
$this->_html .= $this->displayConfirmation($this->l('Service updated')); $this->_html .= $this->displayConfirmation($this->l('Service updated'));
} }
} }
@@ -656,13 +682,13 @@ class TntCarrier extends CarrierModule
if (!$this->_postErrors) if (!$this->_postErrors)
{ {
Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'carrier` SET `name` = "'.$name.'", `deleted` = "'.(int)($display).'" WHERE `id_carrier` = '.(int)($id).''); Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'carrier` SET `name` = "'.pSQL($name).'", `deleted` = "'.(int)($display).'" WHERE `id_carrier` = '.(int)($id).'');
Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'carrier_lang` SET `delay` = "'.$description.'" WHERE `id_carrier` = '.(int)($id).''); Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'carrier_lang` SET `delay` = "'.pSQL($description).'" WHERE `id_carrier` = '.(int)($id).'');
Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'tnt_carrier_option` SET `option` = "'.$code.'" WHERE `id_carrier` = '.(int)($id).''); Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'tnt_carrier_option` SET `option` = "'.pSQL($code).'" WHERE `id_carrier` = '.(int)($id).'');
Configuration::updateValue('TNT_CARRIER_'.$code.'_OVERCOST', (float)($charge)); Configuration::updateValue('TNT_CARRIER_'.pSQL($code).'_OVERCOST', (float)($charge));
Configuration::updateValue('TNT_CARRIER_'.$code.'_ID', (int)($id)); Configuration::updateValue('TNT_CARRIER_'.pSQL($code).'_ID', (int)($id));
$this->_fieldsList['TNT_CARRIER_'.$code.'_OVERCOST'] = (float)($charge); $this->_fieldsList['TNT_CARRIER_'.pSQL($code).'_OVERCOST'] = (float)($charge);
$this->_fieldsList['TNT_CARRIER_'.$code.'_ID'] = (float)($id); $this->_fieldsList['TNT_CARRIER_'.pSQL($code).'_ID'] = (float)($id);
$this->_html .= $this->displayConfirmation($this->l('Service updated')); $this->_html .= $this->displayConfirmation($this->l('Service updated'));
} }
} }
@@ -672,10 +698,10 @@ class TntCarrier extends CarrierModule
$info_min = Tools::getValue('tnt_carrier_'.$cat.'_min'); $info_min = Tools::getValue('tnt_carrier_'.$cat.'_min');
$info_max = Tools::getValue('tnt_carrier_'.$cat.'_max'); $info_max = Tools::getValue('tnt_carrier_'.$cat.'_max');
$charge = Tools::getValue('tnt_carrier_'.$cat.'_charge'); $charge = Tools::getValue('tnt_carrier_'.$cat.'_charge');
Db::getInstance()->autoExecute(_DB_PREFIX_.'tnt_carrier_'.$cat.'', Db::getInstance()->autoExecute(_DB_PREFIX_.'tnt_carrier_'.bqSQL($cat).'',
array( array(
''.$cat.'_min' => (float)($info_min), ''.pSQL($cat).'_min' => (float)($info_min),
''.$cat.'_max' => (float)($info_max), ''.pSQL($cat).'_max' => (float)($info_max),
'additionnal_charges' => (float)($charge)),'INSERT'); 'additionnal_charges' => (float)($charge)),'INSERT');
$this->_html .= $this->displayConfirmation($this->l('Service updated')); $this->_html .= $this->displayConfirmation($this->l('Service updated'));
} }
@@ -688,10 +714,10 @@ class TntCarrier extends CarrierModule
$charge = Tools::getValue('tnt_carrier_'.$cat.'_charge'); $charge = Tools::getValue('tnt_carrier_'.$cat.'_charge');
Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'tnt_carrier_'.$cat.'` Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'tnt_carrier_'.$cat.'`
SET `'.$cat.'_min` = "'.(float)($info_min).'", SET `'.bqSQL($cat).'_min` = "'.(float)($info_min).'",
`'.$cat.'_max` = "'.(float)($info_max).'", `'.bqSQL($cat).'_max` = "'.(float)($info_max).'",
`additionnal_charges` = "'.(float)$charge.'" `additionnal_charges` = "'.(float)$charge.'"
WHERE `id_'.$cat.'` = '.(int)($id).''); WHERE `id_'.bqSQL($cat).'` = '.(int)($id).'');
$this->_html .= $this->displayConfirmation($this->l('Service updated')); $this->_html .= $this->displayConfirmation($this->l('Service updated'));
} }
@@ -704,6 +730,11 @@ class TntCarrier extends CarrierModule
Configuration::updateValue('TNT_CARRIER_'.strtoupper($country).'_OVERCOST', $overcost); Configuration::updateValue('TNT_CARRIER_'.strtoupper($country).'_OVERCOST', $overcost);
} }
public function get_followup($shipping_number)
{
return false;
}
/* /*
** Hook update carrier ** Hook update carrier
** **
@@ -712,7 +743,7 @@ class TntCarrier extends CarrierModule
{ {
global $smarty; global $smarty;
$id_cart = $params['cart']->id; $id_cart = $params['cart']->id;
$smarty->assign('id_cart', $id_cart); $smarty->assign('id_cart', (int)$id_cart);
return $this->display( __FILE__, 'tpl/relaisColis.tpl' ); return $this->display( __FILE__, 'tpl/relaisColis.tpl' );
} }
@@ -823,6 +854,7 @@ class TntCarrier extends CarrierModule
$erreur = null; $erreur = null;
$follow = array(); $follow = array();
$carrierName = Db::getInstance()->ExecuteS('SELECT external_module_name FROM `'._DB_PREFIX_.'carrier` WHERE `id_carrier` = "'.(int)($id_carrier).'"'); $carrierName = Db::getInstance()->ExecuteS('SELECT external_module_name FROM `'._DB_PREFIX_.'carrier` WHERE `id_carrier` = "'.(int)($id_carrier).'"');
if ($carrierName != null && $carrierName[0]['external_module_name'] == $this->_moduleName && $shipping_number != '') if ($carrierName != null && $carrierName[0]['external_module_name'] == $this->_moduleName && $shipping_number != '')
{ {
$pack = new PackageTnt($params['order']->id); $pack = new PackageTnt($params['order']->id);
@@ -834,6 +866,10 @@ class TntCarrier extends CarrierModule
public function hookupdateCarrier($params) public function hookupdateCarrier($params)
{ {
$option = Db::getInstance()->ExecuteS('SELECT option
FROM `'._DB_PREFIX_.'tnt_carrier_option`
WHERE id_carrier = "'.(int)$params['id_carrier'].'"');
Configuration::updateValue('TNT_CARRIER_'.$option[0]['option'].'_ID', (int)($params['carrier']->id));
} }
/* /*
@@ -849,6 +885,8 @@ class TntCarrier extends CarrierModule
public function getOrderShippingCost($params, $shipping_cost) public function getOrderShippingCost($params, $shipping_cost)
{ {
if (!Tools::getValue('step'))
return false;
if ((int)(Tools::getValue('step')) > 2) if ((int)(Tools::getValue('step')) > 2)
serviceCache::deleteServices($params->id); serviceCache::deleteServices($params->id);
$product = $params->getProducts(); $product = $params->getProducts();
@@ -857,6 +895,7 @@ class TntCarrier extends CarrierModule
$id_customer = $params->id_customer; $id_customer = $params->id_customer;
$date_exp = $params->date_upd; $date_exp = $params->date_upd;
$id_adress_delivery = $params->id_address_delivery; $id_adress_delivery = $params->id_address_delivery;
$info = Db::getInstance()->ExecuteS('SELECT postcode, city, company FROM `'._DB_PREFIX_.'address` WHERE `id_address` = "'.(int)($id_adress_delivery).'"');
foreach($product as $k => $v) foreach($product as $k => $v)
$weight += (float)($v['weight']); $weight += (float)($v['weight']);
@@ -867,7 +906,6 @@ class TntCarrier extends CarrierModule
return false; return false;
if (!Configuration::get('TNT_CARRIER_SHIPPING_ADDRESS1') || !Configuration::get('TNT_CARRIER_SHIPPING_ZIPCODE') || !Configuration::get('TNT_CARRIER_SHIPPING_CITY')) if (!Configuration::get('TNT_CARRIER_SHIPPING_ADDRESS1') || !Configuration::get('TNT_CARRIER_SHIPPING_ZIPCODE') || !Configuration::get('TNT_CARRIER_SHIPPING_CITY'))
return false; return false;
$info = Db::getInstance()->ExecuteS('SELECT postcode, city, company FROM `'._DB_PREFIX_.'address` WHERE `id_address` = "'.(int)($id_adress_delivery).'"');
$serviceCache = new serviceCache($params->id, $info[0]['postcode']); $serviceCache = new serviceCache($params->id, $info[0]['postcode']);
if (!$serviceCache->getFaisabilityAtThisTime()) if (!$serviceCache->getFaisabilityAtThisTime())
@@ -902,18 +940,13 @@ class TntCarrier extends CarrierModule
$priceCarrier = Configuration::get('TNT_CARRIER_'.$v['code'].'_OVERCOST'); $priceCarrier = Configuration::get('TNT_CARRIER_'.$v['code'].'_OVERCOST');
} }
} }
if (!isset($priceCarrier)) if (!isset($priceCarrier))
{ {
if (isset($params->id_carrier) && (int)($params->id_carrier) > 0) if ($option = Db::getInstance()->ExecuteS('SELECT `option` FROM `'._DB_PREFIX_.'tnt_carrier_option` WHERE `id_carrier` = "'.(int)($this->id_carrier).'"'))
{ $priceCarrier = Configuration::get('TNT_CARRIER_'.$option[0]['option'].'_OVERCOST');
if ($option = Db::getInstance()->ExecuteS('SELECT `option` FROM `'._DB_PREFIX_.'tnt_carrier_option` WHERE `id_carrier` = "'.(int)($params->id_carrier).'"'))
$priceCarrier = Configuration::get('TNT_CARRIER_'.$option[0]['option'].'_OVERCOST');
}
else
$priceCarrier = 0;
} }
$zero = 0;
$weightLimit = Db::getInstance()->ExecuteS('SELECT additionnal_charges FROM `'._DB_PREFIX_.'tnt_carrier_weight` WHERE `weight_min` < "'.(float)($weight).'" AND `weight_max` > "'.(float)($weight).'"'); $weightLimit = Db::getInstance()->ExecuteS('SELECT additionnal_charges FROM `'._DB_PREFIX_.'tnt_carrier_weight` WHERE `weight_min` < "'.(float)($weight).'" AND (`weight_max` > "'.(float)($weight).'" OR `weight_max` = "'.(float)$zero.'")');
$currency = Db::getInstance()->ExecuteS('SELECT conversion_rate FROM `'._DB_PREFIX_.'currency` WHERE `id_currency` = "'.(int)($params->id_currency).'"'); $currency = Db::getInstance()->ExecuteS('SELECT conversion_rate FROM `'._DB_PREFIX_.'currency` WHERE `id_currency` = "'.(int)($params->id_currency).'"');
if ($weightLimit != null) if ($weightLimit != null)
$add += (float)($weightLimit[0]['additionnal_charges']); $add += (float)($weightLimit[0]['additionnal_charges']);
@@ -942,4 +975,4 @@ class TntCarrier extends CarrierModule
$new = array("ST", " "); $new = array("ST", " ");
return (str_replace($old, $new, $city)); return (str_replace($old, $new, $city));
} }
} }
+1 -1
View File
@@ -705,7 +705,7 @@ XML;
$this->registerHook('productFooter'); $this->registerHook('productFooter');
} }
$dataSync = '<img src="http://www.prestashop.com/modules/'.$this->name.'.png?account_code='.Configuration::get('TREEPODIA_ACCOUNT_CODE').'" style="float:right" />'; $dataSync = '<img src="http://api.prestashop.com/modules/'.$this->name.'.png?account_code='.Configuration::get('TREEPODIA_ACCOUNT_CODE').'" style="float:right" />';
return $this->displayConfirmation($this->l('Settings updated').$dataSync); return $this->displayConfirmation($this->l('Settings updated').$dataSync);
} }
+3 -3
View File
@@ -4,10 +4,10 @@
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
* This source file is subject to the Open Software License (OSL 3.0) * This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt. * that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL: * It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php * http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to * 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 * obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately. * to license@prestashop.com so we can send you a copy immediately.
@@ -21,7 +21,7 @@
* @author PrestaShop SA <contact@prestashop.com> * @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA * @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$ * @version Release: $Revision$
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*/ */
+5 -1
View File
@@ -34,13 +34,17 @@ class VatNumber extends TaxManagerModule
{ {
$this->name = 'vatnumber'; $this->name = 'vatnumber';
$this->tab = 'billing_invoicing'; $this->tab = 'billing_invoicing';
$this->version = 1.0; $this->version = 1.2;
$this->author = 'PrestaShop'; $this->author = 'PrestaShop';
$this->need_instance = 0; $this->need_instance = 0;
$this->tax_manager_class = 'VATNumberTaxManager'; $this->tax_manager_class = 'VATNumberTaxManager';
parent::__construct(); 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->displayName = $this->l('European VAT number');
$this->description = $this->l('Enable entering of the VAT intra-community number when creating the address (You must fill in the company field to allow keyboarding VAT number)'); $this->description = $this->l('Enable entering of the VAT intra-community number when creating the address (You must fill in the company field to allow keyboarding VAT number)');