[*] FO : New hooks for home tabs
This commit is contained in:
1 parent
2e65214c39
commit
62aaf16d60
22 files changed
+156
-229
No files matched your search
@@ -34,9 +34,10 @@ class BlockBestSellers extends Module
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->name = 'blockbestsellers';
|
||||
$this->tab = 'front_office_features';
|
||||
$this->version = '1.2';
|
||||
$this->version = '1.3';
|
||||
$this->author = 'PrestaShop';
|
||||
$this->need_instance = 0;
|
||||
|
||||
@@ -52,15 +53,16 @@ class BlockBestSellers extends Module
|
||||
public function install()
|
||||
{
|
||||
$this->_clearCache('blockbestsellers.tpl');
|
||||
$this->_clearCache('blockbestsellers-home.tpl');
|
||||
$this->_clearCache('tab.tpl');
|
||||
|
||||
if (!parent::install()
|
||||
|| !$this->registerHook('rightColumn')
|
||||
|| !$this->registerHook('header')
|
||||
|| !$this->registerHook('actionOrderStatusPostUpdate')
|
||||
|| !$this->registerHook('addproduct')
|
||||
|| !$this->registerHook('updateproduct')
|
||||
|| !$this->registerHook('deleteproduct')
|
||||
|| !$this->registerHook('displayHomeTab')
|
||||
|| !$this->registerHook('displayHomeTabContent')
|
||||
|| !ProductSale::fillProductSales()
|
||||
)
|
||||
return false;
|
||||
@@ -70,7 +72,7 @@ class BlockBestSellers extends Module
|
||||
public function uninstall()
|
||||
{
|
||||
$this->_clearCache('blockbestsellers.tpl');
|
||||
$this->_clearCache('blockbestsellers-home.tpl');
|
||||
$this->_clearCache('tab.tpl');
|
||||
|
||||
return parent::uninstall();
|
||||
}
|
||||
@@ -78,25 +80,21 @@ class BlockBestSellers extends Module
|
||||
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');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -175,9 +173,14 @@ class BlockBestSellers extends Module
|
||||
$this->context->controller->addCSS($this->_path.'blockbestsellers.css', 'all');
|
||||
}
|
||||
|
||||
public function hookHome($params)
|
||||
public function hookDisplayHomeTab($params)
|
||||
{
|
||||
if (!$this->isCached('blockbestsellers-home.tpl', $this->getCacheId('blockbestsellers-home')))
|
||||
return $this->display(__FILE__, 'tab.tpl', $this->getCacheId('blockbestsellers-tab'));
|
||||
}
|
||||
|
||||
public function hookdisplayHomeTabContent($params)
|
||||
{
|
||||
if (!$this->isCached('blockbestsellers.tpl', $this->getCacheId()))
|
||||
{
|
||||
$best_sellers = $this->getBestSellers($params);
|
||||
if ($best_sellers === false)
|
||||
@@ -187,12 +190,12 @@ class BlockBestSellers extends Module
|
||||
'best_sellers' => $best_sellers,
|
||||
'homeSize' => Image::getSize(ImageType::getFormatedName('home'))));
|
||||
}
|
||||
return $this->display(__FILE__, 'blockbestsellers-home.tpl', $this->getCacheId('blockbestsellers-home'));
|
||||
return $this->display(__FILE__, 'blockbestsellers.tpl', $this->getCacheId());
|
||||
}
|
||||
|
||||
public function hookRightColumn($params)
|
||||
{
|
||||
if (!$this->isCached('blockbestsellers.tpl', $this->getCacheId('blockbestsellers')))
|
||||
if (!$this->isCached('blockbestsellers.tpl', $this->getCacheId()))
|
||||
{
|
||||
$best_sellers = $this->getBestSellers($params);
|
||||
if ($best_sellers === false)
|
||||
@@ -204,7 +207,7 @@ class BlockBestSellers extends Module
|
||||
'smallSize' => Image::getSize(ImageType::getFormatedName('small'))
|
||||
));
|
||||
}
|
||||
return $this->display(__FILE__, 'blockbestsellers.tpl', $this->getCacheId('blockbestsellers'));
|
||||
return $this->display(__FILE__, 'blockbestsellers.tpl', $this->getCacheId());
|
||||
}
|
||||
|
||||
public function hookLeftColumn($params)
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
{*
|
||||
* 2007-2013 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
<li><a class="blockbestsellers">{l s='Best Sellers' mod='blockbestsellers'}</a></li>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
function upgrade_module_1_3($object)
|
||||
{
|
||||
return ($object->unregisterHook('rightColumn') && $object->registerHook('displayHomeTab') && $object->registerHook('displayHomeTabContent'));
|
||||
}
|
||||
Reference in new issue
Block a user