Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development
This commit is contained in:
@@ -58,7 +58,7 @@
|
||||
</li>
|
||||
{foreach from=$list_modules_categories item=module_category key=module_category_key}
|
||||
<li {if isset($categoryFiltered[$module_category_key])}style="background-color:#EBEDF4"{/if} class="categoryModuleFilterLink">
|
||||
<div class="categorieWidth"><a href="{$currentIndex}&token={$token}&{if isset($categoryFiltered[$module_category_key])}un{/if}filterCategory={$module_category_key}"><span>{$module_category.name}</span></a></div>
|
||||
<div class="categorieWidth"><a href="{$currentIndex}&token={$token}&filterCategory={$module_category_key}"><span>{$module_category.name}</span></a></div>
|
||||
<div class="count">{$module_category.nb}</div>
|
||||
</li>
|
||||
{/foreach}
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
{if !isset($document->is_delivery)}
|
||||
<tr id="invoiceNote{$document->id}" style="display:none" class="current-edit">
|
||||
<td colspan="5">
|
||||
<form action="{$current_index}&viewOrder&id_order={$order->id}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}" method="post">
|
||||
<form action="{$current_index}&viewOrder&id_order={$order->id}{if isset($smarty.get.token)}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}{/if}" method="post">
|
||||
<p>
|
||||
<label for="editNote{$document->id}" class="t">{l s='Note'}</label>
|
||||
<input type="hidden" name="id_order_invoice" value="{$document->id}" />
|
||||
@@ -130,7 +130,7 @@
|
||||
<td colspan="5" class="center">
|
||||
<h3>{l s='No documents are available'}</h3>
|
||||
{if isset($invoice_management_active) && $invoice_management_active}
|
||||
<p><a class="button" href="{$current_index}&viewOrder&submitGenerateInvoice&id_order={$order->id}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}">{l s='Generate invoice'}</a></p>
|
||||
<p><a class="button" href="{$current_index}&viewOrder&submitGenerateInvoice&id_order={$order->id}{if isset($smarty.get.token)}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}{/if}">{l s='Generate invoice'}</a></p>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
$('#show_old_carts').click();
|
||||
$('#payment_module_name').change();
|
||||
$.ajaxSetup({ type:"post" });
|
||||
$("#voucher").autocomplete('{$link->getAdminLink('AdminCartRules')|escape:'html'}', {
|
||||
$("#voucher").autocomplete('{$link->getAdminLink('AdminCartRules')|addslashes}', {
|
||||
minChars: 3,
|
||||
max: 15,
|
||||
width: 250,
|
||||
@@ -468,7 +468,7 @@
|
||||
$('#new_address').attr('href', address_link.replace(/id_customer=[0-9]+/, 'id_customer='+id_customer));
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url : "{$link->getAdminLink('AdminCarts')|escape:'html'}",
|
||||
url : "{$link->getAdminLink('AdminCarts')|addslashes}",
|
||||
async: false,
|
||||
dataType: "json",
|
||||
data : {
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
{block name="override_tpl"}
|
||||
<script type="text/javascript">
|
||||
var admin_order_tab_link = "{$link->getAdminLink('AdminOrders')|escape:'html'}";
|
||||
var admin_order_tab_link = "{$link->getAdminLink('AdminOrders')|addslashes}";
|
||||
var id_order = {$order->id};
|
||||
var id_lang = {$current_id_lang};
|
||||
var id_currency = {$order->id_currency};
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
$('document').ready( function() {
|
||||
$(".check_product_name")
|
||||
.autocomplete(
|
||||
'{$link->getAdminLink('AdminProducts', true)|escape:'html'}', {
|
||||
'{$link->getAdminLink('AdminProducts', true)|addslashes}', {
|
||||
minChars: 3,
|
||||
max: 10,
|
||||
width: $(".check_product_name").width(),
|
||||
|
||||
@@ -546,7 +546,7 @@ abstract class ObjectModelCore
|
||||
|
||||
$object_id = Db::getInstance()->Insert_ID();
|
||||
|
||||
if ($definition['multilang'])
|
||||
if (isset($definition['multilang']) && $definition['multilang'])
|
||||
{
|
||||
$res = Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
|
||||
@@ -1026,47 +1026,66 @@ class ToolsCore
|
||||
*/
|
||||
public static function replaceAccentedChars($str)
|
||||
{
|
||||
/* One source among others:
|
||||
http://www.tachyonsoft.com/uc0000.htm
|
||||
http://www.tachyonsoft.com/uc0001.htm
|
||||
*/
|
||||
$patterns = array(
|
||||
|
||||
/* Lowercase */
|
||||
'/[\x{0105}\x{00E0}\x{00E1}\x{00E2}\x{00E3}\x{00E4}\x{00E5}]/u',
|
||||
'/[\x{00E7}\x{010D}\x{0107}]/u',
|
||||
'/[\x{010F}]/u',
|
||||
'/[\x{00E8}\x{00E9}\x{00EA}\x{00EB}\x{011B}\x{0119}]/u',
|
||||
'/[\x{00EC}\x{00ED}\x{00EE}\x{00EF}]/u',
|
||||
'/[\x{011F}]/u',
|
||||
'/[\x{0142}\x{013E}\x{013A}]/u',
|
||||
'/[\x{00F1}\x{0148}]/u',
|
||||
'/[\x{00F2}\x{00F3}\x{00F4}\x{00F5}\x{00F6}\x{00F8}]/u',
|
||||
'/[\x{0159}\x{0155}]/u',
|
||||
'/[\x{015B}\x{0161}\x{015F}]/u',
|
||||
'/[\x{00DF}]/u',
|
||||
'/[\x{0165}]/u',
|
||||
'/[\x{00F9}\x{00FA}\x{00FB}\x{00FC}\x{016F}]/u',
|
||||
'/[\x{00FD}\x{00FF}]/u',
|
||||
'/[\x{017C}\x{017A}\x{017E}]/u',
|
||||
'/[\x{00E6}]/u',
|
||||
'/[\x{0153}]/u',
|
||||
/* a */ '/[\x{00E0}\x{00E1}\x{00E2}\x{00E3}\x{00E4}\x{00E5}\x{0101}\x{0103}\x{0105}]/u',
|
||||
/* c */ '/[\x{00E7}\x{0107}\x{0109}\x{010D}]/u',
|
||||
/* d */ '/[\x{010F}\x{0111}]/u',
|
||||
/* e */ '/[\x{00E8}\x{00E9}\x{00EA}\x{00EB}\x{0113}\x{0115}\x{0117}\x{0119}\x{011B}]/u',
|
||||
/* g */ '/[\x{011F}\x{0121}\x{0123}]/u',
|
||||
/* h */ '/[\x{0125}\x{0127}]/u',
|
||||
/* i */ '/[\x{00EC}\x{00ED}\x{00EE}\x{00EF}\x{0129}\x{012B}\x{012D}\x{012F}\x{0131}]/u',
|
||||
/* j */ '/[\x{0135}]/u',
|
||||
/* k */ '/[\x{0137}\x{0138}]/u',
|
||||
/* l */ '/[\x{013A}\x{013C}\x{013E}\x{0140}\x{0142}]/u',
|
||||
/* n */ '/[\x{00F1}\x{0144}\x{0146}\x{0148}\x{0149}\x{014B}]/u',
|
||||
/* o */ '/[\x{00F2}\x{00F3}\x{00F4}\x{00F5}\x{00F6}\x{00F8}\x{014D}\x{014F}\x{0151}]/u',
|
||||
/* r */ '/[\x{0155}\x{0157}\x{0159}]/u',
|
||||
/* s */ '/[\x{015B}\x{015D}\x{015F}\x{0161}]/u',
|
||||
/* ss*/ '/[\x{00DF}]/u',
|
||||
/* t */ '/[\x{0163}\x{0165}\x{0167}]/u',
|
||||
/* u */ '/[\x{00F9}\x{00FA}\x{00FB}\x{00FC}\x{0169}\x{016B}\x{016D}\x{016F}\x{0171}\x{0173}]/u',
|
||||
/* w */ '/[\x{0175}]/u',
|
||||
/* y */ '/[\x{00FF}\x{0177}\x{00FD}]/u',
|
||||
/* z */ '/[\x{017A}\x{017C}\x{017E}]/u',
|
||||
/* ae*/ '/[\x{00E6}]/u',
|
||||
/* oe*/ '/[\x{0153}]/u',
|
||||
|
||||
/* Uppercase */
|
||||
'/[\x{0104}\x{00C0}\x{00C1}\x{00C2}\x{00C3}\x{00C4}\x{00C5}]/u',
|
||||
'/[\x{00C7}\x{010C}\x{0106}]/u',
|
||||
'/[\x{010E}]/u',
|
||||
'/[\x{00C8}\x{00C9}\x{00CA}\x{00CB}\x{011A}\x{0118}]/u',
|
||||
'/[\x{011E}]/u',
|
||||
'/[\x{0141}\x{013D}\x{0139}]/u',
|
||||
'/[\x{00D1}\x{0147}]/u',
|
||||
'/[\x{00D3}]/u',
|
||||
'/[\x{0158}\x{0154}]/u',
|
||||
'/[\x{015A}\x{0160}\x{015E}]/u',
|
||||
'/[\x{0164}]/u',
|
||||
'/[\x{00D9}\x{00DA}\x{00DB}\x{00DC}\x{016E}]/u',
|
||||
'/[\x{017B}\x{0179}\x{017D}]/u',
|
||||
'/[\x{00C6}]/u',
|
||||
'/[\x{0152}]/u');
|
||||
/* A */ '/[\x{0100}\x{0102}\x{0104}\x{00C0}\x{00C1}\x{00C2}\x{00C3}\x{00C4}\x{00C5}]/u',
|
||||
/* C */ '/[\x{00C7}\x{0106}\x{0108}\x{010A}\x{010C}]/u',
|
||||
/* D */ '/[\x{010E}\x{0110}]/u',
|
||||
/* E */ '/[\x{00C8}\x{00C9}\x{00CA}\x{00CB}\x{0112}\x{0114}\x{0116}\x{0118}\x{011A}]/u',
|
||||
/* G */ '/[\x{011C}\x{011E}\x{0120}\x{0122}]/u',
|
||||
/* H */ '/[\x{0124}\x{0126}]/u',
|
||||
/* I */ '/[\x{0128}\x{012A}\x{012C}\x{012E}\x{0130}]/u',
|
||||
/* J */ '/[\x{0134}]/u',
|
||||
/* K */ '/[\x{0136}]/u',
|
||||
/* L */ '/[\x{0139}\x{013B}\x{013D}\x{0139}\x{0141}]/u',
|
||||
/* N */ '/[\x{00D1}\x{0143}\x{0145}\x{0147}\x{014A}]/u',
|
||||
/* O */ '/[\x{00D3}\x{014C}\x{014E}\x{0150}]/u',
|
||||
/* R */ '/[\x{0154}\x{0156}\x{0158}]/u',
|
||||
/* S */ '/[\x{015A}\x{015C}\x{015E}\x{0160}]/u',
|
||||
/* T */ '/[\x{0162}\x{0164}\x{0166}]/u',
|
||||
/* U */ '/[\x{00D9}\x{00DA}\x{00DB}\x{00DC}\x{0168}\x{016A}\x{016C}\x{016E}\x{0170}\x{0172}]/u',
|
||||
/* W */ '/[\x{0174}]/u',
|
||||
/* Y */ '/[\x{0176}]/u',
|
||||
/* Z */ '/[\x{0179}\x{017B}\x{017D}]/u',
|
||||
/* AE*/ '/[\x{00C6}]/u',
|
||||
/* OE*/ '/[\x{0152}]/u');
|
||||
|
||||
// ö to oe
|
||||
// å to aa
|
||||
// ä to ae
|
||||
|
||||
$replacements = array(
|
||||
'a', 'c', 'd', 'e', 'i', 'g', 'l', 'n', 'o', 'r', 's', 'ss', 't', 'u', 'y', 'z', 'ae', 'oe',
|
||||
'A', 'C', 'D', 'E', 'G', 'L', 'N', 'O', 'R', 'S', 'T', 'U', 'Z', 'AE', 'OE'
|
||||
'a', 'c', 'd', 'e', 'g', 'h', 'i', 'j', 'k', 'l', 'n', 'o', 'r', 's', 'ss', 't', 'u', 'y', 'w', 'z', 'ae', 'oe',
|
||||
'A', 'C', 'D', 'E', 'G', 'H', 'I', 'J', 'K', 'L', 'N', 'O', 'R', 'S', 'T', 'U', 'Z', 'AE', 'OE'
|
||||
);
|
||||
|
||||
return preg_replace($patterns, $replacements, $str);
|
||||
|
||||
@@ -189,7 +189,7 @@ class AdminManufacturersControllerCore extends AdminController
|
||||
$this->_join .= '
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m
|
||||
ON (a.`id_manufacturer` = m.`id_manufacturer`)';
|
||||
$this->_where = 'AND a.`id_customer` = 0 AND a.`id_supplier` = 0 AND a.`id_warehouse` = 0';
|
||||
$this->_where = 'AND a.`id_customer` = 0 AND a.`id_supplier` = 0 AND a.`id_warehouse` = 0 AND a.`deleted`=0';
|
||||
|
||||
$this->context->smarty->assign('title_list', $this->l('Manufacturers addresses:'));
|
||||
|
||||
@@ -406,6 +406,12 @@ class AdminManufacturersControllerCore extends AdminController
|
||||
'type' => 'hidden',
|
||||
'name' => 'alias',
|
||||
);
|
||||
|
||||
$form['input'][] = array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'id_address',
|
||||
);
|
||||
|
||||
$form['input'][] = array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Last name:'),
|
||||
@@ -712,6 +718,9 @@ class AdminManufacturersControllerCore extends AdminController
|
||||
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected function beforeDelete($object)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -85,11 +85,7 @@ class AuthControllerCore extends FrontController
|
||||
|
||||
$this->assignCountries();
|
||||
|
||||
$active_module_newsletter = false;
|
||||
if ($module_newsletter = Module::getInstanceByName('blocknewsletter'))
|
||||
$active_module_newsletter = $module_newsletter->active;
|
||||
|
||||
$this->context->smarty->assign('newsletter', (int)$active_module_newsletter);
|
||||
$this->context->smarty->assign('newsletter', 1);
|
||||
|
||||
$back = Tools::getValue('back');
|
||||
$key = Tools::safeOutput(Tools::getValue('key'));
|
||||
|
||||
67
js/admin.js
67
js/admin.js
@@ -35,25 +35,54 @@ function str2url(str, encoding, ucfirst)
|
||||
str = str.replace(/[^a-z0-9\s\'\:\/\[\]-]\\u00A1-\\uFFFF/g,'');
|
||||
else
|
||||
{
|
||||
str = str.replace(/[\u0105\u0104\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5]/g,'a');
|
||||
str = str.replace(/[\u00E7\u010D\u0107\u0106]/g,'c');
|
||||
str = str.replace(/[\u010F]/g,'d');
|
||||
str = str.replace(/[\u00E8\u00E9\u00EA\u00EB\u011B\u0119\u0118\u0117]/g,'e');
|
||||
str = str.replace(/[\u00EC\u00ED\u00EE\u00EF\u012F]/g,'i');
|
||||
str = str.replace(/[\u0142\u0141]/g,'l');
|
||||
str = str.replace(/[\u00F1\u0148]/g,'n');
|
||||
str = str.replace(/[\u00F2\u00F3\u00F4\u00F5\u00F6\u00F8\u00D3]/g,'o');
|
||||
str = str.replace(/[\u0159]/g,'r');
|
||||
str = str.replace(/[\u015B\u015A\u0161]/g,'s');
|
||||
str = str.replace(/[\u00DF]/g,'ss');
|
||||
str = str.replace(/[\u0165]/g,'t');
|
||||
str = str.replace(/[\u00F9\u00FA\u00FB\u00FC\u016F\u016B\u0173]/g,'u');
|
||||
str = str.replace(/[\u00FD\u00FF]/g,'y');
|
||||
str = str.replace(/[\u017C\u017A\u017B\u0179\u017E]/g,'z');
|
||||
str = str.replace(/[\u00E6]/g,'ae');
|
||||
str = str.replace(/[\u0153]/g,'oe');
|
||||
str = str.replace(/[\u013E\u013A]/g,'l');
|
||||
str = str.replace(/[\u0155]/g,'r');
|
||||
/* Lowercase */
|
||||
str = str.replace(/[\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u0101\u0103\u0105]/g, 'a');
|
||||
str = str.replace(/[\u00E7\u0107\u0109\u010D]/g, 'c');
|
||||
str = str.replace(/[\u010F\u0111]/g, 'd');
|
||||
str = str.replace(/[\u00E8\u00E9\u00EA\u00EB\u0113\u0115\u0117\u0119\u011B]/g, 'e');
|
||||
str = str.replace(/[\u011F\u0121\u0123]/g, 'g');
|
||||
str = str.replace(/[\u0125\u0127]/g, 'h');
|
||||
str = str.replace(/[\u00EC\u00ED\u00EE\u00EF\u0129\u012B\u012D\u012F\u0131]/g, 'i');
|
||||
str = str.replace(/[\u0135]/g, 'j');
|
||||
str = str.replace(/[\u0137\u0138]/g, 'k');
|
||||
str = str.replace(/[\u013A\u013C\u013E\u0140\u0142]/g, 'l');
|
||||
str = str.replace(/[\u00F1\u0144\u0146\u0148\u0149\u014B]/g, 'n');
|
||||
str = str.replace(/[\u00F2\u00F3\u00F4\u00F5\u00F6\u00F8\u014D\u014F\u0151]/g, 'o');
|
||||
str = str.replace(/[\u0155\u0157\u0159]/g, 'r');
|
||||
str = str.replace(/[\u015B\u015D\u015F\u0161]/g, 's');
|
||||
str = str.replace(/[\u00DF]/g, 'ss');
|
||||
str = str.replace(/[\u0163\u0165\u0167]/g, 't');
|
||||
str = str.replace(/[\u00F9\u00FA\u00FB\u00FC\u0169\u016B\u016D\u016F\u0171\u0173]/g, 'u');
|
||||
str = str.replace(/[\u0175]/g, 'w');
|
||||
str = str.replace(/[\u00FF\u0177\u00FD]/g, 'y');
|
||||
str = str.replace(/[\u017A\u017C\u017E]/g, 'z');
|
||||
str = str.replace(/[\u00E6]/g, 'ae');
|
||||
str = str.replace(/[\u0153]/g, 'oe');
|
||||
|
||||
/* Uppercase */
|
||||
str = str.replace(/[\u0100\u0102\u0104\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5]/g, 'A');
|
||||
str = str.replace(/[\u00C7\u0106\u0108\u010A\u010C]/g, 'C');
|
||||
str = str.replace(/[\u010E\u0110]/g, 'D');
|
||||
str = str.replace(/[\u00C8\u00C9\u00CA\u00CB\u0112\u0114\u0116\u0118\u011A]/g, 'E');
|
||||
str = str.replace(/[\u011C\u011E\u0120\u0122]/g, 'G');
|
||||
str = str.replace(/[\u0124\u0126]/g, 'H');
|
||||
str = str.replace(/[\u0128\u012A\u012C\u012E\u0130]/g, 'I');
|
||||
str = str.replace(/[\u0134]/g, 'J');
|
||||
str = str.replace(/[\u0136]/g, 'K');
|
||||
str = str.replace(/[\u0139\u013B\u013D\u0139\u0141]/g, 'L');
|
||||
str = str.replace(/[\u00D1\u0143\u0145\u0147\u014A]/g, 'N');
|
||||
str = str.replace(/[\u00D3\u014C\u014E\u0150]/g, 'O');
|
||||
str = str.replace(/[\u0154\u0156\u0158]/g, 'R');
|
||||
str = str.replace(/[\u015A\u015C\u015E\u0160]/g, 'S');
|
||||
str = str.replace(/[\u0162\u0164\u0166]/g, 'T');
|
||||
str = str.replace(/[\u00D9\u00DA\u00DB\u00DC\u0168\u016A\u016C\u016E\u0170\u0172]/g, 'U');
|
||||
str = str.replace(/[\u0174]/g, 'W');
|
||||
str = str.replace(/[\u0176]/g, 'Y');
|
||||
str = str.replace(/[\u0179\u017B\u017D]/g, 'Z');
|
||||
str = str.replace(/[\u00C6]/g, 'AE');
|
||||
str = str.replace(/[\u0152]/g, 'OE');
|
||||
|
||||
str = str.toLowerCase();
|
||||
|
||||
str = str.replace(/[^a-z0-9\s\'\:\/\[\]-]/g,'');
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ class BlockBestSellers extends Module
|
||||
{
|
||||
$this->name = 'blockbestsellers';
|
||||
$this->tab = 'front_office_features';
|
||||
$this->version = '1.1';
|
||||
$this->version = '1.2';
|
||||
$this->author = 'PrestaShop';
|
||||
$this->need_instance = 0;
|
||||
|
||||
@@ -51,14 +51,53 @@ class BlockBestSellers extends Module
|
||||
*/
|
||||
public function install()
|
||||
{
|
||||
if (!parent::install() ||
|
||||
!$this->registerHook('rightColumn') ||
|
||||
!$this->registerHook('header') ||
|
||||
!$this->registerHook('updateOrderStatus') ||
|
||||
!ProductSale::fillProductSales())
|
||||
$this->_clearCache('blockbestsellers.tpl');
|
||||
$this->_clearCache('blockbestsellers-home.tpl');
|
||||
|
||||
if (!parent::install()
|
||||
|| !$this->registerHook('rightColumn')
|
||||
|| !$this->registerHook('header')
|
||||
|| !$this->registerHook('actionOrderStatusPostUpdate')
|
||||
|| !$this->registerHook('addproduct')
|
||||
|| !$this->registerHook('updateproduct')
|
||||
|| !$this->registerHook('deleteproduct')
|
||||
|| !ProductSale::fillProductSales()
|
||||
)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function uninstall()
|
||||
{
|
||||
$this->_clearCache('blockbestsellers.tpl');
|
||||
$this->_clearCache('blockbestsellers-home.tpl');
|
||||
|
||||
return parent::uninstall();
|
||||
}
|
||||
|
||||
public function hookAddProduct($params)
|
||||
{
|
||||
$this->_clearCache('blockbestsellers.tpl');
|
||||
$this->_clearCache('blockbestsellers-home.tpl');
|
||||
}
|
||||
|
||||
public function hookUpdateProduct($params)
|
||||
{
|
||||
$this->_clearCache('blockbestsellers.tpl');
|
||||
$this->_clearCache('blockbestsellers-home.tpl');
|
||||
}
|
||||
|
||||
public function hookDeleteProduct($params)
|
||||
{
|
||||
$this->_clearCache('blockbestsellers.tpl');
|
||||
$this->_clearCache('blockbestsellers-home.tpl');
|
||||
}
|
||||
|
||||
public function hookActionOrderStatusPostUpdate($params)
|
||||
{
|
||||
$this->_clearCache('blockbestsellers.tpl');
|
||||
$this->_clearCache('blockbestsellers-home.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Called in administration -> module -> configure
|
||||
@@ -102,28 +141,34 @@ class BlockBestSellers extends Module
|
||||
|
||||
public function hookHome($params)
|
||||
{
|
||||
$best_sellers = $this->getBestSellers($params);
|
||||
if ($best_sellers === false)
|
||||
return;
|
||||
if (!$this->isCached('blockbestsellers-home.tpl', $this->getCacheId('blockbestsellers-home')))
|
||||
{
|
||||
$best_sellers = $this->getBestSellers($params);
|
||||
if ($best_sellers === false)
|
||||
return;
|
||||
|
||||
$this->smarty->assign(array(
|
||||
'best_sellers' => $best_sellers,
|
||||
'homeSize' => Image::getSize(ImageType::getFormatedName('home'))));
|
||||
return $this->display(__FILE__, 'blockbestsellers-home.tpl');
|
||||
$this->smarty->assign(array(
|
||||
'best_sellers' => $best_sellers,
|
||||
'homeSize' => Image::getSize(ImageType::getFormatedName('home'))));
|
||||
}
|
||||
return $this->display(__FILE__, 'blockbestsellers-home.tpl', $this->getCacheId('blockbestsellers-home'));
|
||||
}
|
||||
|
||||
public function hookRightColumn($params)
|
||||
{
|
||||
$best_sellers = $this->getBestSellers($params);
|
||||
if ($best_sellers === false)
|
||||
return;
|
||||
if (!$this->isCached('blockbestsellers.tpl', $this->getCacheId('blockbestsellers')))
|
||||
{
|
||||
$best_sellers = $this->getBestSellers($params);
|
||||
if ($best_sellers === false)
|
||||
return;
|
||||
|
||||
$this->smarty->assign(array(
|
||||
'best_sellers' => $best_sellers,
|
||||
'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')),
|
||||
'smallSize' => Image::getSize(ImageType::getFormatedName('small'))
|
||||
));
|
||||
return $this->display(__FILE__, 'blockbestsellers.tpl');
|
||||
$this->smarty->assign(array(
|
||||
'best_sellers' => $best_sellers,
|
||||
'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')),
|
||||
'smallSize' => Image::getSize(ImageType::getFormatedName('small'))
|
||||
));
|
||||
}
|
||||
return $this->display(__FILE__, 'blockbestsellers.tpl', $this->getCacheId('blockbestsellers'));
|
||||
}
|
||||
|
||||
public function hookLeftColumn($params)
|
||||
@@ -136,7 +181,7 @@ class BlockBestSellers extends Module
|
||||
if (Configuration::get('PS_CATALOG_MODE'))
|
||||
return false;
|
||||
|
||||
if (!($result = ProductSale::getBestSalesLight((int)($params['cookie']->id_lang), 0, 5)))
|
||||
if (!($result = ProductSale::getBestSalesLight((int)$params['cookie']->id_lang, 0, 5)))
|
||||
return (Configuration::get('PS_BLOCK_BESTSELLERS_DISPLAY') ? array() : false);
|
||||
|
||||
$bestsellers = array();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<module>
|
||||
<name>blockbestsellers</name>
|
||||
<displayName><![CDATA[Top-seller block]]></displayName>
|
||||
<version><![CDATA[1.1]]></version>
|
||||
<version><![CDATA[1.2]]></version>
|
||||
<description><![CDATA[Add a block displaying your store's top-selling products.]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[front_office_features]]></tab>
|
||||
|
||||
9
modules/blockbestsellers/upgrade/install-1.2.php
Normal file
9
modules/blockbestsellers/upgrade/install-1.2.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
function upgrade_module_1_2($object)
|
||||
{
|
||||
return ($object->registerHook('addproduct') && $object->registerHook('updateproduct') && $object->registerHook('deleteproduct') && $object->registerHook('actionOrderStatusPostUpdate'));
|
||||
}
|
||||
@@ -38,6 +38,7 @@ class BlockCMSModel extends ObjectModel
|
||||
|
||||
const LEFT_COLUMN = 0;
|
||||
const RIGHT_COLUMN = 1;
|
||||
const FOOTER = 2;
|
||||
|
||||
/**
|
||||
* @see ObjectModel::$definition
|
||||
|
||||
@@ -39,7 +39,7 @@ class BlockCms extends Module
|
||||
{
|
||||
$this->name = 'blockcms';
|
||||
$this->tab = 'front_office_features';
|
||||
$this->version = '1.1.1';
|
||||
$this->version = '1.2';
|
||||
$this->author = 'PrestaShop';
|
||||
$this->need_instance = 0;
|
||||
|
||||
@@ -52,14 +52,23 @@ class BlockCms extends Module
|
||||
|
||||
public function install()
|
||||
{
|
||||
if (!parent::install() ||
|
||||
!$this->registerHooks() ||
|
||||
!BlockCMSModel::createTables() ||
|
||||
!Configuration::updateValue('FOOTER_CMS', '') ||
|
||||
!Configuration::updateValue('FOOTER_BLOCK_ACTIVATION', 1) ||
|
||||
!Configuration::updateValue('FOOTER_POWEREDBY', 1))
|
||||
if (!parent::install()
|
||||
|| !$this->registerHook('leftColumn')
|
||||
|| !$this->registerHook('rightColumn')
|
||||
|| !$this->registerHook('header')
|
||||
|| !$this->registerHook('footer')
|
||||
|| !$this->registerHook('actionObjectCmsUpdateAfter')
|
||||
|| !$this->registerHook('actionObjectCmsDeleteAfter')
|
||||
|| !$this->registerHook('actionShopDataDuplication')
|
||||
|| !BlockCMSModel::createTables()
|
||||
|| !Configuration::updateValue('FOOTER_CMS', '')
|
||||
|| !Configuration::updateValue('FOOTER_BLOCK_ACTIVATION', 1)
|
||||
|| !Configuration::updateValue('FOOTER_POWEREDBY', 1)
|
||||
)
|
||||
return false;
|
||||
|
||||
$this->_clearCache('blockcms.tpl');
|
||||
|
||||
// Install fixtures for blockcms
|
||||
$default = Db::getInstance()->insert('cms_block', array(
|
||||
'id_cms_category' => 1,
|
||||
@@ -101,23 +110,16 @@ class BlockCms extends Module
|
||||
|
||||
public function uninstall()
|
||||
{
|
||||
$this->_clearCache('blockcms.tpl');
|
||||
if (!parent::uninstall() ||
|
||||
!BlockCMSModel::DropTables() ||
|
||||
!Configuration::deleteByName('FOOTER_CMS') ||
|
||||
!Configuration::deleteByName('FOOTER_BLOCK_ACTIVATION') ||
|
||||
!Configuration::deleteByName('FOOTER_POWEREDBY'))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private function registerHooks()
|
||||
{
|
||||
return (
|
||||
$this->registerHook('leftColumn') && $this->registerHook('rightColumn') &&
|
||||
$this->registerHook('header') && $this->registerHook('footer') && $this->registerHook('actionShopDataDuplication'));
|
||||
}
|
||||
|
||||
public function initToolbar()
|
||||
{
|
||||
$current_index = AdminController::$currentIndex;
|
||||
@@ -541,6 +543,8 @@ class BlockCms extends Module
|
||||
if ($this->_postValidation() == false)
|
||||
return false;
|
||||
|
||||
$this->_clearCache('blockcms.tpl');
|
||||
|
||||
$this->_errors = array();
|
||||
if (Tools::isSubmit('submitBlockCMS'))
|
||||
{
|
||||
@@ -661,42 +665,33 @@ class BlockCms extends Module
|
||||
|
||||
public function displayBlockCMS($column)
|
||||
{
|
||||
$cms_titles = BlockCMSModel::getCMSTitles($column);
|
||||
if (!$this->isCached('blockcms.tpl', $this->getCacheId($column)))
|
||||
{
|
||||
$cms_titles = BlockCMSModel::getCMSTitles($column);
|
||||
|
||||
$this->smarty->assign(array(
|
||||
'block' => 1,
|
||||
'cms_titles' => $cms_titles,
|
||||
'contact_url' => (_PS_VERSION_ >= 1.5) ? 'contact' : 'contact-form'
|
||||
));
|
||||
|
||||
return $this->display(__FILE__, 'blockcms.tpl');
|
||||
$this->smarty->assign(array(
|
||||
'block' => 1,
|
||||
'cms_titles' => $cms_titles,
|
||||
'contact_url' => (_PS_VERSION_ >= 1.5) ? 'contact' : 'contact-form'
|
||||
));
|
||||
}
|
||||
return $this->display(__FILE__, 'blockcms.tpl', $this->getCacheId($column));
|
||||
}
|
||||
|
||||
private function _prepareHook()
|
||||
|
||||
protected function getCacheId($name = null)
|
||||
{
|
||||
$block_activation = Configuration::get('FOOTER_BLOCK_ACTIVATION');
|
||||
|
||||
if (!$block_activation)
|
||||
return false;
|
||||
|
||||
$cms_titles = BlockCMSModel::getCMSTitlesFooter();
|
||||
$display_footer = Configuration::get('PS_STORES_DISPLAY_FOOTER');
|
||||
$display_poweredby = Configuration::get('FOOTER_POWEREDBY');
|
||||
$footer_text = Configuration::get('FOOTER_CMS_TEXT_'.(int)$this->context->language->id);
|
||||
|
||||
$this->smarty->assign(
|
||||
array(
|
||||
'block' => 0,
|
||||
'contact_url' => 'contact',
|
||||
'cmslinks' => $cms_titles,
|
||||
'display_stores_footer' => $display_footer,
|
||||
'display_poweredby' => ((int)$display_poweredby === 1 || $display_poweredby === false),
|
||||
'footer_text' => $footer_text
|
||||
)
|
||||
);
|
||||
return true;
|
||||
return parent::getCacheId('blockcms|'.$name);
|
||||
}
|
||||
|
||||
public function hookActionObjectCmsUpdateAfter()
|
||||
{
|
||||
$this->_clearCache('blockcms.tpl');
|
||||
}
|
||||
|
||||
public function hookActionObjectCmsDeleteAfter()
|
||||
{
|
||||
$this->_clearCache('blockcms.tpl');
|
||||
}
|
||||
|
||||
public function hookHeader($params)
|
||||
{
|
||||
@@ -715,9 +710,28 @@ class BlockCms extends Module
|
||||
|
||||
public function hookFooter()
|
||||
{
|
||||
if (!$this->_prepareHook())
|
||||
return ;
|
||||
return $this->display(__FILE__, 'blockcms.tpl');
|
||||
if (!($block_activation = Configuration::get('FOOTER_BLOCK_ACTIVATION')))
|
||||
return;
|
||||
|
||||
if (!$this->isCached('blockcms.tpl', $this->getCacheId(BlockCMSModel::FOOTER)))
|
||||
{
|
||||
$cms_titles = BlockCMSModel::getCMSTitlesFooter();
|
||||
$display_footer = Configuration::get('PS_STORES_DISPLAY_FOOTER');
|
||||
$display_poweredby = Configuration::get('FOOTER_POWEREDBY');
|
||||
$footer_text = Configuration::get('FOOTER_CMS_TEXT_'.(int)$this->context->language->id);
|
||||
|
||||
$this->smarty->assign(
|
||||
array(
|
||||
'block' => 0,
|
||||
'contact_url' => 'contact',
|
||||
'cmslinks' => $cms_titles,
|
||||
'display_stores_footer' => $display_footer,
|
||||
'display_poweredby' => ((int)$display_poweredby === 1 || $display_poweredby === false),
|
||||
'footer_text' => $footer_text
|
||||
)
|
||||
);
|
||||
}
|
||||
return $this->display(__FILE__, 'blockcms.tpl', $this->getCacheId(BlockCMSModel::FOOTER));
|
||||
}
|
||||
|
||||
protected function updatePositionsDnd()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<module>
|
||||
<name>blockcms</name>
|
||||
<displayName><![CDATA[CMS Block]]></displayName>
|
||||
<version><![CDATA[1.1.1]]></version>
|
||||
<version><![CDATA[1.2]]></version>
|
||||
<description><![CDATA[Adds a block with several CMS links.]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[front_office_features]]></tab>
|
||||
|
||||
9
modules/blockcms/upgrade/install-1.2.php
Normal file
9
modules/blockcms/upgrade/install-1.2.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
function upgrade_module_1_2($object)
|
||||
{
|
||||
return ($object->registerHook('actionObjectCmsUpdateAfter') && $object->registerHook('actionObjectCmsDeleteAfter'));
|
||||
}
|
||||
@@ -33,7 +33,7 @@ class BlockNewProducts extends Module
|
||||
{
|
||||
$this->name = 'blocknewproducts';
|
||||
$this->tab = 'front_office_features';
|
||||
$this->version = 0.9;
|
||||
$this->version = 1.0;
|
||||
$this->author = 'PrestaShop';
|
||||
$this->need_instance = 0;
|
||||
|
||||
@@ -45,9 +45,23 @@ class BlockNewProducts extends Module
|
||||
|
||||
public function install()
|
||||
{
|
||||
if (parent::install() == false || $this->registerHook('rightColumn') == false || $this->registerHook('header') == false || Configuration::updateValue('NEW_PRODUCTS_NBR', 5) == false)
|
||||
return false;
|
||||
return true;
|
||||
if (!parent::install()
|
||||
|| !$this->registerHook('rightColumn')
|
||||
|| !$this->registerHook('header')
|
||||
|| !$this->registerHook('addproduct')
|
||||
|| !$this->registerHook('updateproduct')
|
||||
|| !$this->registerHook('deleteproduct')
|
||||
|| !Configuration::updateValue('NEW_PRODUCTS_NBR', 5)
|
||||
)
|
||||
return false;
|
||||
$this->_clearCache('blocknewproducts.tpl');
|
||||
return true;
|
||||
}
|
||||
|
||||
public function uninstall()
|
||||
{
|
||||
$this->_clearCache('blocknewproducts.tpl');
|
||||
return parent::uninstall();
|
||||
}
|
||||
|
||||
public function getContent()
|
||||
@@ -95,16 +109,22 @@ class BlockNewProducts extends Module
|
||||
|
||||
public function hookRightColumn($params)
|
||||
{
|
||||
$newProducts = Product::getNewProducts((int)($params['cookie']->id_lang), 0, (int)(Configuration::get('NEW_PRODUCTS_NBR')));
|
||||
if (!$newProducts && !Configuration::get('PS_BLOCK_NEWPRODUCTS_DISPLAY'))
|
||||
return;
|
||||
if (!$this->isCached('blocknewproducts.tpl', $this->getCacheId()))
|
||||
{
|
||||
if (!Configuration::get('PS_BLOCK_NEWPRODUCTS_DISPLAY') && !($newProducts = Product::getNewProducts((int)$params['cookie']->id_lang, 0, (int)Configuration::get('NEW_PRODUCTS_NBR'))))
|
||||
return;
|
||||
|
||||
$this->smarty->assign(array(
|
||||
'new_products' => $newProducts,
|
||||
'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')),
|
||||
));
|
||||
$this->smarty->assign(array(
|
||||
'new_products' => $newProducts,
|
||||
'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')),
|
||||
));
|
||||
}
|
||||
return $this->display(__FILE__, 'blocknewproducts.tpl', $this->getCacheId());
|
||||
}
|
||||
|
||||
return $this->display(__FILE__, 'blocknewproducts.tpl');
|
||||
protected function getCacheId($name = null)
|
||||
{
|
||||
return parent::getCacheId('blocknewproducts|'.date('Ymd'));
|
||||
}
|
||||
|
||||
public function hookLeftColumn($params)
|
||||
@@ -117,6 +137,18 @@ class BlockNewProducts extends Module
|
||||
$this->context->controller->addCSS(($this->_path).'blocknewproducts.css', 'all');
|
||||
}
|
||||
|
||||
}
|
||||
public function hookAddProduct($params)
|
||||
{
|
||||
$this->_clearCache('blocknewproducts.tpl');
|
||||
}
|
||||
|
||||
public function hookUpdateProduct($params)
|
||||
{
|
||||
$this->_clearCache('blocknewproducts.tpl');
|
||||
}
|
||||
|
||||
public function hookDeleteProduct($params)
|
||||
{
|
||||
$this->_clearCache('blocknewproducts.tpl');
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
<module>
|
||||
<name>blocknewproducts</name>
|
||||
<displayName><![CDATA[New products block]]></displayName>
|
||||
<version><![CDATA[0.9]]></version>
|
||||
<version><![CDATA[1.0]]></version>
|
||||
<description><![CDATA[Displays a block featuring your store's newest products.]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[front_office_features]]></tab>
|
||||
|
||||
9
modules/blocknewproducts/upgrade/install-1.0.php
Normal file
9
modules/blocknewproducts/upgrade/install-1.0.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
function upgrade_module_1_0($object)
|
||||
{
|
||||
return ($object->registerHook('addproduct') && $object->registerHook('updateproduct') && $object->registerHook('deleteproduct'));
|
||||
}
|
||||
@@ -61,7 +61,8 @@ class Blocknewsletter extends Module
|
||||
|
||||
public function install()
|
||||
{
|
||||
if (parent::install() == false || $this->registerHook('leftColumn') == false || $this->registerHook('header') == false)
|
||||
if (parent::install() == false || $this->registerHook('leftColumn') == false || $this->registerHook('header') == false
|
||||
|| $this->registerHook('actionCustomerAccountAdd') == false)
|
||||
return false;
|
||||
|
||||
Configuration::updateValue('NW_SALT', Tools::passwdGen(16));
|
||||
@@ -521,4 +522,20 @@ class Blocknewsletter extends Module
|
||||
{
|
||||
$this->context->controller->addCSS($this->_path.'blocknewsletter.css', 'all');
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes duplicates email in newsletter table
|
||||
* @param $params
|
||||
* @return bool
|
||||
*/
|
||||
public function hookActionCustomerAccountAdd($params)
|
||||
{
|
||||
//if e-mail of the created user address has already been added to the newsletter through the blocknewsletter module,
|
||||
//we delete it from blocknewsletter table to prevent duplicates
|
||||
$id_shop = $params['newCustomer']->id_shop;
|
||||
$email = $params['newCustomer']->email;
|
||||
if (Validate::isEmail($email))
|
||||
return (bool)Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'newsletter WHERE id_shop='.(int)$id_shop.' AND email=\''.pSQL($email)."'");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ class BlockSpecials extends Module
|
||||
{
|
||||
$this->name = 'blockspecials';
|
||||
$this->tab = 'pricing_promotion';
|
||||
$this->version = '0.8';
|
||||
$this->version = '1.0';
|
||||
$this->author = 'PrestaShop';
|
||||
$this->need_instance = 0;
|
||||
|
||||
@@ -48,7 +48,23 @@ class BlockSpecials extends Module
|
||||
|
||||
public function install()
|
||||
{
|
||||
return (parent::install() AND $this->registerHook('rightColumn') AND $this->registerHook('header'));
|
||||
if (!Configuration::get('BLOCKSPECIALS_NB_CACHES'))
|
||||
Configuration::updateValue('BLOCKSPECIALS_NB_CACHES', 20);
|
||||
$this->_clearCache('blockspecials.tpl');
|
||||
|
||||
return (parent::install()
|
||||
&& $this->registerHook('rightColumn')
|
||||
&& $this->registerHook('header')
|
||||
&& $this->registerHook('addproduct')
|
||||
&& $this->registerHook('updateproduct')
|
||||
&& $this->registerHook('deleteproduct')
|
||||
);
|
||||
}
|
||||
|
||||
public function uninstall()
|
||||
{
|
||||
$this->_clearCache('blockspecials.tpl');
|
||||
return parent::uninstall();
|
||||
}
|
||||
|
||||
public function getContent()
|
||||
@@ -56,7 +72,8 @@ class BlockSpecials extends Module
|
||||
$output = '<h2>'.$this->displayName.'</h2>';
|
||||
if (Tools::isSubmit('submitSpecials'))
|
||||
{
|
||||
Configuration::updateValue('PS_BLOCK_SPECIALS_DISPLAY', (int)(Tools::getValue('always_display')));
|
||||
Configuration::updateValue('PS_BLOCK_SPECIALS_DISPLAY', (int)Tools::getValue('always_display'));
|
||||
Configuration::updateValue('BLOCKSPECIALS_NB_CACHES', (int)Tools::getValue('BLOCKSPECIALS_NB_CACHES'));
|
||||
$output .= '<div class="conf confirm">'.$this->l('Settings updated').'</div>';
|
||||
}
|
||||
return $output.$this->displayForm();
|
||||
@@ -76,6 +93,11 @@ class BlockSpecials extends Module
|
||||
<label class="t" for="display_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
|
||||
<p class="clear">'.$this->l('Show the block even if no product is available.').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('Number of cache files.').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" name="BLOCKSPECIALS_NB_CACHES" value="'.(int)Configuration::get('BLOCKSPECIALS_NB_CACHES').'" />
|
||||
<p class="clear">'.$this->l('Specials are displayed randomly on the front end, but since it takes a lot of ressources, it is better to cache the results. Cache is reset everyday. 0 will disable the cache.').'</p>
|
||||
</div>
|
||||
<center><input type="submit" name="submitSpecials" value="'.$this->l('Save').'" class="button" /></center>
|
||||
</fieldset>
|
||||
</form>';
|
||||
@@ -84,18 +106,24 @@ class BlockSpecials extends Module
|
||||
public function hookRightColumn($params)
|
||||
{
|
||||
if (Configuration::get('PS_CATALOG_MODE'))
|
||||
return ;
|
||||
|
||||
if (!($special = Product::getRandomSpecial((int)$params['cookie']->id_lang)) && !Configuration::get('PS_BLOCK_SPECIALS_DISPLAY'))
|
||||
return;
|
||||
|
||||
// We need to create multiple caches because the products are sorted randomly
|
||||
$random = date('Ymd').'|'.round(rand(1, max(Configuration::get('BLOCKSPECIALS_NB_CACHES'), 1)));
|
||||
|
||||
$this->smarty->assign(array(
|
||||
'special' => $special,
|
||||
'priceWithoutReduction_tax_excl' => Tools::ps_round($special['price_without_reduction'], 2),
|
||||
'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')),
|
||||
));
|
||||
if (!Configuration::get('BLOCKSPECIALS_NB_CACHES') || !$this->isCached('blockspecials.tpl', $this->getCacheId('blockspecials|'.$random)))
|
||||
{
|
||||
if (!($special = Product::getRandomSpecial((int)$params['cookie']->id_lang)) && !Configuration::get('PS_BLOCK_SPECIALS_DISPLAY'))
|
||||
return;
|
||||
|
||||
return $this->display(__FILE__, 'blockspecials.tpl');
|
||||
$this->smarty->assign(array(
|
||||
'special' => $special,
|
||||
'priceWithoutReduction_tax_excl' => Tools::ps_round($special['price_without_reduction'], 2),
|
||||
'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')),
|
||||
));
|
||||
}
|
||||
|
||||
return $this->display(__FILE__, 'blockspecials.tpl', $this->getCacheId('blockspecials|'.$random));
|
||||
}
|
||||
|
||||
public function hookLeftColumn($params)
|
||||
@@ -109,5 +137,19 @@ class BlockSpecials extends Module
|
||||
return ;
|
||||
$this->context->controller->addCSS(($this->_path).'blockspecials.css', 'all');
|
||||
}
|
||||
}
|
||||
|
||||
public function hookAddProduct($params)
|
||||
{
|
||||
$this->_clearCache('blockspecials.tpl');
|
||||
}
|
||||
|
||||
public function hookUpdateProduct($params)
|
||||
{
|
||||
$this->_clearCache('blockspecials.tpl');
|
||||
}
|
||||
|
||||
public function hookDeleteProduct($params)
|
||||
{
|
||||
$this->_clearCache('blockspecials.tpl');
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
<module>
|
||||
<name>blockspecials</name>
|
||||
<displayName><![CDATA[Specials block]]></displayName>
|
||||
<version><![CDATA[0.8]]></version>
|
||||
<version><![CDATA[1.0]]></version>
|
||||
<description><![CDATA[Adds a block displaying current product specials.]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[pricing_promotion]]></tab>
|
||||
|
||||
10
modules/blockspecials/upgrade/install-1.0.php
Normal file
10
modules/blockspecials/upgrade/install-1.0.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
function upgrade_module_1_0($object)
|
||||
{
|
||||
Configuration::updateValue('BLOCKSPECIALS_NB_CACHES', 20);
|
||||
return ($object->registerHook('addproduct') && $object->registerHook('updateproduct') && $object->registerHook('deleteproduct'));
|
||||
}
|
||||
@@ -32,7 +32,7 @@ $('document').ready(function()
|
||||
var parent = $(this).parent().parent();
|
||||
|
||||
$.ajax({
|
||||
url: "{$link->getModuleLink('favoriteproducts', 'actions', ['process' => 'remove'], true)|escape:'html'}",
|
||||
url: "{$link->getModuleLink('favoriteproducts', 'actions', ['process' => 'remove'], true)|addslashes}",
|
||||
type: "POST",
|
||||
data: {
|
||||
'id_product': idFavoriteProduct,
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
<script type="text/javascript">
|
||||
var favorite_products_url_add = '{$link->getModuleLink('favoriteproducts', 'actions', ['process' => 'add'], false)|escape:'html'}';
|
||||
var favorite_products_url_remove = '{$link->getModuleLink('favoriteproducts', 'actions', ['process' => 'remove'], false)|escape:'html'}';
|
||||
var favorite_products_url_add = '{$link->getModuleLink('favoriteproducts', 'actions', ['process' => 'add'], false)|addslashes}';
|
||||
var favorite_products_url_remove = '{$link->getModuleLink('favoriteproducts', 'actions', ['process' => 'remove'], false)|addslashes}';
|
||||
{if isset($smarty.get.id_product)}
|
||||
var favorite_products_id_product = '{$smarty.get.id_product|intval}';
|
||||
{/if}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>homefeatured</name>
|
||||
<displayName><![CDATA[Featured products on the homepage.]]></displayName>
|
||||
<version><![CDATA[0.9]]></version>
|
||||
<description><![CDATA[Displays featured products in the middle of your homepage.]]></description>
|
||||
<displayName><![CDATA[Produits phares sur la page d'accueil]]></displayName>
|
||||
<version><![CDATA[1.0]]></version>
|
||||
<description><![CDATA[Affiche les produits phares au centre de votre page d'accueil]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[front_office_features]]></tab>
|
||||
<is_configurable>1</is_configurable>
|
||||
|
||||
@@ -36,7 +36,7 @@ class HomeFeatured extends Module
|
||||
{
|
||||
$this->name = 'homefeatured';
|
||||
$this->tab = 'front_office_features';
|
||||
$this->version = '0.9';
|
||||
$this->version = '1.0';
|
||||
$this->author = 'PrestaShop';
|
||||
$this->need_instance = 0;
|
||||
|
||||
@@ -48,17 +48,32 @@ class HomeFeatured extends Module
|
||||
|
||||
function install()
|
||||
{
|
||||
if (!Configuration::updateValue('HOME_FEATURED_NBR', 8) || !parent::install() || !$this->registerHook('displayHome') || !$this->registerHook('header'))
|
||||
$this->_clearCache('homefeatured.tpl');
|
||||
Configuration::updateValue('HOME_FEATURED_NBR', 8);
|
||||
|
||||
if (!parent::install()
|
||||
|| !$this->registerHook('displayHome')
|
||||
|| !$this->registerHook('header')
|
||||
|| !$this->registerHook('addproduct')
|
||||
|| !$this->registerHook('updateproduct')
|
||||
|| !$this->registerHook('deleteproduct')
|
||||
)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function uninstall()
|
||||
{
|
||||
$this->_clearCache('homefeatured.tpl');
|
||||
return parent::uninstall();
|
||||
}
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
$output = '<h2>'.$this->displayName.'</h2>';
|
||||
if (Tools::isSubmit('submitHomeFeatured'))
|
||||
{
|
||||
$nbr = (int)(Tools::getValue('nbr'));
|
||||
$nbr = (int)Tools::getValue('nbr');
|
||||
if (!$nbr OR $nbr <= 0 OR !Validate::isInt($nbr))
|
||||
$errors[] = $this->l('An invalid number of products has been specified.');
|
||||
else
|
||||
@@ -101,16 +116,33 @@ class HomeFeatured extends Module
|
||||
|
||||
public function hookDisplayHome($params)
|
||||
{
|
||||
$category = new Category(Context::getContext()->shop->getCategory(), (int)Context::getContext()->language->id);
|
||||
$nb = (int)(Configuration::get('HOME_FEATURED_NBR'));
|
||||
$products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 10));
|
||||
if (!$this->isCached('homefeatured.tpl', $this->getCacheId('homefeatured')))
|
||||
{
|
||||
$category = new Category(Context::getContext()->shop->getCategory(), (int)Context::getContext()->language->id);
|
||||
$nb = (int)Configuration::get('HOME_FEATURED_NBR');
|
||||
$products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 10));
|
||||
|
||||
$this->smarty->assign(array(
|
||||
'products' => $products,
|
||||
'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
|
||||
'homeSize' => Image::getSize(ImageType::getFormatedName('home')),
|
||||
));
|
||||
|
||||
return $this->display(__FILE__, 'homefeatured.tpl');
|
||||
$this->smarty->assign(array(
|
||||
'products' => $products,
|
||||
'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
|
||||
'homeSize' => Image::getSize(ImageType::getFormatedName('home')),
|
||||
));
|
||||
}
|
||||
return $this->display(__FILE__, 'homefeatured.tpl', $this->getCacheId('homefeatured'));
|
||||
}
|
||||
}
|
||||
|
||||
public function hookAddProduct($params)
|
||||
{
|
||||
$this->_clearCache('homefeatured.tpl');
|
||||
}
|
||||
|
||||
public function hookUpdateProduct($params)
|
||||
{
|
||||
$this->_clearCache('homefeatured.tpl');
|
||||
}
|
||||
|
||||
public function hookDeleteProduct($params)
|
||||
{
|
||||
$this->_clearCache('homefeatured.tpl');
|
||||
}
|
||||
}
|
||||
9
modules/homefeatured/upgrade/install-1.0.php
Normal file
9
modules/homefeatured/upgrade/install-1.0.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
function upgrade_module_1_0($object)
|
||||
{
|
||||
return ($object->registerHook('addproduct') && $object->registerHook('updateproduct') && $object->registerHook('deleteproduct'));
|
||||
}
|
||||
@@ -35,7 +35,7 @@ $('document').ready(function()
|
||||
var parent = $(this).parent().parent();
|
||||
|
||||
$.ajax({
|
||||
url: "{$link->getModuleLink('mailalerts', 'actions', ['process' => 'remove'])|escape:'html'}",
|
||||
url: "{$link->getModuleLink('mailalerts', 'actions', ['process' => 'remove'])|addslashes}",
|
||||
type: "POST",
|
||||
data: {
|
||||
'id_product': id_product_mail_alert,
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
var txtProducts = "{l s='products' js=1}";
|
||||
{/if}
|
||||
|
||||
var addressMultishippingUrl = "{$link->getPageLink('address', true, NULL, "back={$back_order_page}?step=1{'&multi-shipping=1'|urlencode}{if $back}&mod={$back|urlencode}{/if}")|escape:'html'}";
|
||||
var addressUrl = "{$link->getPageLink('address', true, NULL, "back={$back_order_page}?step=1{if $back}&mod={$back}{/if}")|escape:'html'}";
|
||||
var addressMultishippingUrl = "{$link->getPageLink('address', true, NULL, "back={$back_order_page}?step=1{'&multi-shipping=1'|urlencode}{if $back}&mod={$back|urlencode}{/if}")|addslashes'}";
|
||||
var addressUrl = "{$link->getPageLink('address', true, NULL, "back={$back_order_page}?step=1{if $back}&mod={$back}{/if}")|addslashes'}";
|
||||
|
||||
var formatedAddressFieldsValuesList = new Array();
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
dest_comp.html('');
|
||||
|
||||
li_content['title'] = adr_titles_vals[address_type];
|
||||
li_content['update'] = '<a href="{$link->getPageLink('address', true, NULL, "id_address")|escape:'html'}'+id_address+'&back={$back_order_page}?step=1{if $back}&mod={$back}{/if}" title="{l s='Update' js=1}" style="font-size:.9em;font-weight:normal;padding:8px 0;display:block;text-align:right">» {l s='Update' js=1}</a>';
|
||||
li_content['update'] = '<a href="{$link->getPageLink('address', true, NULL, "id_address")|addslashes}'+id_address+'&back={$back_order_page}?step=1{if $back}&mod={$back}{/if}" title="{l s='Update' js=1}" style="font-size:.9em;font-weight:normal;padding:8px 0;display:block;text-align:right">» {l s='Update' js=1}</a>';
|
||||
|
||||
appendAddressList(dest_comp, li_content, ordered_fields_name);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
var currencyBlank = '{$currencyBlank|intval}';
|
||||
var txtProduct = "{l s='product' js=1}";
|
||||
var txtProducts = "{l s='products' js=1}";
|
||||
var orderUrl = '{$link->getPageLink("order", true)|escape:'html'}';
|
||||
var orderUrl = '{$link->getPageLink("order", true)|addslashes}';
|
||||
|
||||
var msg = "{l s='You must agree to the terms of service before continuing.' js=1}";
|
||||
{literal}
|
||||
|
||||
@@ -33,11 +33,11 @@
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
var imgDir = '{$img_dir}';
|
||||
var authenticationUrl = '{$link->getPageLink("authentication", true)|escape:'html'}';
|
||||
var orderOpcUrl = '{$link->getPageLink("order-opc", true)|escape:'html'}';
|
||||
var historyUrl = '{$link->getPageLink("history", true)|escape:'html'}';
|
||||
var guestTrackingUrl = '{$link->getPageLink("guest-tracking", true)|escape:'html'}';
|
||||
var addressUrl = '{$link->getPageLink("address", true)|escape:'html'}';
|
||||
var authenticationUrl = '{$link->getPageLink("authentication", true)|addslashes}';
|
||||
var orderOpcUrl = '{$link->getPageLink("order-opc", true)|addslashes}';
|
||||
var historyUrl = '{$link->getPageLink("history", true)|addslashes}';
|
||||
var guestTrackingUrl = '{$link->getPageLink("guest-tracking", true)|addslashes}';
|
||||
var addressUrl = '{$link->getPageLink("address", true)|addslashes}';
|
||||
var orderProcess = 'order-opc';
|
||||
var guestCheckoutEnabled = {$PS_GUEST_CHECKOUT_ENABLED|intval};
|
||||
var currencySign = '{$currencySign|html_entity_decode:2:"UTF-8"}';
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
dest_comp.html('');
|
||||
|
||||
li_content['title'] = adr_titles_vals[address_type];
|
||||
li_content['update'] = '<a href="{$link->getPageLink('address', true, NULL, "id_address")|escape:'html'}'+id_address+'&back=order?step=1{if $back}&mod={$back}{/if}" title="{l s='Update' js=1}">{l s='Update' js=1}</a>';
|
||||
li_content['update'] = '<a href="{$link->getPageLink('address', true, NULL, "id_address")|addslashes}'+id_address+'&back=order?step=1{if $back}&mod={$back}{/if}" title="{l s='Update' js=1}">{l s='Update' js=1}</a>';
|
||||
|
||||
appendAddressList(dest_comp, li_content, ordered_fields_name);
|
||||
}
|
||||
|
||||
@@ -75,8 +75,8 @@
|
||||
var txtProducts = "{l s='products' js=1}";
|
||||
{/if}
|
||||
|
||||
var addressMultishippingUrl = "{$link->getPageLink('address', true, NULL, "back={$back_order_page}?step=1{'&multi-shipping=1'|urlencode}{if $back}&mod={$back|urlencode}{/if}")|escape:'html'}";
|
||||
var addressUrl = "{$link->getPageLink('address', true, NULL, "back={$back_order_page}?step=1{if $back}&mod={$back}{/if}")|escape:'html'}";
|
||||
var addressMultishippingUrl = "{$link->getPageLink('address', true, NULL, "back={$back_order_page}?step=1{'&multi-shipping=1'|urlencode}{if $back}&mod={$back|urlencode}{/if}")|addslashes}";
|
||||
var addressUrl = "{$link->getPageLink('address', true, NULL, "back={$back_order_page}?step=1{if $back}&mod={$back}{/if}")|addslashes}";
|
||||
|
||||
var formatedAddressFieldsValuesList = new Array();
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
dest_comp.html('');
|
||||
|
||||
li_content['title'] = adr_titles_vals[address_type];
|
||||
li_content['update'] = '<a href="{$link->getPageLink('address', true, NULL, "id_address")|escape:'html'}'+id_address+'&back={$back_order_page}?step=1{if $back}&mod={$back}{/if}" title="{l s='Update' js=1}">» {l s='Update' js=1}</a>';
|
||||
li_content['update'] = '<a href="{$link->getPageLink('address', true, NULL, "id_address")|addslashes}'+id_address+'&back={$back_order_page}?step=1{if $back}&mod={$back}{/if}" title="{l s='Update' js=1}">» {l s='Update' js=1}</a>';
|
||||
|
||||
appendAddressList(dest_comp, li_content, ordered_fields_name);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
var currencyBlank = '{$currencyBlank|intval}';
|
||||
var txtProduct = "{l s='Product' js=1}";
|
||||
var txtProducts = "{l s='Products' js=1}";
|
||||
var orderUrl = '{$link->getPageLink("order", true)|escape:'html'}';
|
||||
var orderUrl = '{$link->getPageLink("order", true)|addslashes}';
|
||||
|
||||
var msg = "{l s='You must agree to the terms of service before continuing.' js=1}";
|
||||
{literal}
|
||||
|
||||
@@ -38,11 +38,11 @@
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
var imgDir = '{$img_dir}';
|
||||
var authenticationUrl = '{$link->getPageLink("authentication", true)|escape:'html'}';
|
||||
var orderOpcUrl = '{$link->getPageLink("order-opc", true)|escape:'html'}';
|
||||
var historyUrl = '{$link->getPageLink("history", true)|escape:'html'}';
|
||||
var guestTrackingUrl = '{$link->getPageLink("guest-tracking", true)|escape:'html'}';
|
||||
var addressUrl = '{$link->getPageLink("address", true, NULL, "back={$back_order_page}")|escape:'html'}';
|
||||
var authenticationUrl = '{$link->getPageLink("authentication", true)|addslashes}';
|
||||
var orderOpcUrl = '{$link->getPageLink("order-opc", true)|addslashes}';
|
||||
var historyUrl = '{$link->getPageLink("history", true)|addslashes}';
|
||||
var guestTrackingUrl = '{$link->getPageLink("guest-tracking", true)|addslashes}';
|
||||
var addressUrl = '{$link->getPageLink("address", true, NULL, "back={$back_order_page}")|addslashes}';
|
||||
var orderProcess = 'order-opc';
|
||||
var guestCheckoutEnabled = {$PS_GUEST_CHECKOUT_ENABLED|intval};
|
||||
var currencySign = '{$currencySign|html_entity_decode:2:"UTF-8"}';
|
||||
|
||||
Reference in New Issue
Block a user