// Add wish list button to blockwishlist module
This commit is contained in:
@@ -283,5 +283,8 @@
|
||||
<hook id="displayBackOfficeCategory" live_edit="0">
|
||||
<name>displayBackOfficeCategory</name><title>Display new elements in the Back Office, tab AdminCategories</title><description>This hook launches modules when the AdminCategories tab is displayed in the Back Office</description>
|
||||
</hook>
|
||||
<hook id="displayProductListFunctionalButtons" live_edit="0">
|
||||
<name>displayProductListFunctionalButtons</name><title>Display new elements in the Front Office, products list</title><description>This hook launches modules when the products list is displayed in the Front Office</description>
|
||||
</hook>
|
||||
</entities>
|
||||
</entity_hook>
|
||||
|
||||
@@ -38,7 +38,7 @@ class BlockWishList extends Module
|
||||
{
|
||||
$this->name = 'blockwishlist';
|
||||
$this->tab = 'front_office_features';
|
||||
$this->version = 0.2;
|
||||
$this->version = 0.3;
|
||||
$this->author = 'PrestaShop';
|
||||
$this->need_instance = 0;
|
||||
|
||||
@@ -62,13 +62,15 @@ class BlockWishList extends Module
|
||||
if($query)
|
||||
if(!Db::getInstance()->execute(trim($query)))
|
||||
return false;
|
||||
if (!parent::install() OR
|
||||
!$this->registerHook('rightColumn') OR
|
||||
!$this->registerHook('productActions') OR
|
||||
!$this->registerHook('cart') OR
|
||||
!$this->registerHook('customerAccount') OR
|
||||
!$this->registerHook('header') OR
|
||||
!$this->registerHook('adminCustomers')
|
||||
if (!parent::install() ||
|
||||
!$this->registerHook('rightColumn') ||
|
||||
!$this->registerHook('productActions') ||
|
||||
!$this->registerHook('cart') ||
|
||||
!$this->registerHook('customerAccount') ||
|
||||
!$this->registerHook('header') ||
|
||||
!$this->registerHook('adminCustomers') ||
|
||||
!$this->registerHook('displayProductListFunctionalButtons') ||
|
||||
!$this->registerHook('top')
|
||||
)
|
||||
return false;
|
||||
/* This hook is optional */
|
||||
@@ -79,10 +81,10 @@ class BlockWishList extends Module
|
||||
public function uninstall()
|
||||
{
|
||||
return (
|
||||
Db::getInstance()->execute('DROP TABLE '._DB_PREFIX_.'wishlist') AND
|
||||
Db::getInstance()->execute('DROP TABLE '._DB_PREFIX_.'wishlist_email') AND
|
||||
Db::getInstance()->execute('DROP TABLE '._DB_PREFIX_.'wishlist_product') AND
|
||||
Db::getInstance()->execute('DROP TABLE '._DB_PREFIX_.'wishlist_product_cart') AND
|
||||
Db::getInstance()->execute('DROP TABLE '._DB_PREFIX_.'wishlist') &&
|
||||
Db::getInstance()->execute('DROP TABLE '._DB_PREFIX_.'wishlist_email') &&
|
||||
Db::getInstance()->execute('DROP TABLE '._DB_PREFIX_.'wishlist_product') &&
|
||||
Db::getInstance()->execute('DROP TABLE '._DB_PREFIX_.'wishlist_product_cart') &&
|
||||
parent::uninstall()
|
||||
);
|
||||
}
|
||||
@@ -107,6 +109,18 @@ class BlockWishList extends Module
|
||||
return $this->_html;
|
||||
}
|
||||
|
||||
public function hookDisplayProductListFunctionalButtons($params)
|
||||
{
|
||||
//TODO : Add cache
|
||||
$this->smarty->assign('product', $params['product']);
|
||||
return $this->display(__FILE__, 'blockwishlist_button.tpl');
|
||||
}
|
||||
|
||||
public function hookTop($params)
|
||||
{
|
||||
return $this->display(__FILE__, 'blockwishlist_top.tpl');
|
||||
}
|
||||
|
||||
public function hookHeader($params)
|
||||
{
|
||||
$this->context->controller->addCSS(($this->_path).'blockwishlist.css', 'all');
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
{*
|
||||
* 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
|
||||
*}
|
||||
|
||||
<div class="wishlist">
|
||||
<a href="#" id="wishlist_button" onclick="WishlistCart('wishlist_block_list', 'add', '{$product.id_product|intval}', false, 1); return false;" class="addToWishlist"><i class="icon-heart-empty"></i> Add to Wishlist</a>
|
||||
</div>
|
||||
@@ -0,0 +1,28 @@
|
||||
{*
|
||||
* 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
|
||||
*}
|
||||
|
||||
<script type="text/javascript">
|
||||
var isLoggedWishlist = {if $logged}true{else}false{/if};
|
||||
</script>
|
||||
@@ -2,7 +2,7 @@
|
||||
<module>
|
||||
<name>blockwishlist</name>
|
||||
<displayName><![CDATA[Wishlist block]]></displayName>
|
||||
<version><![CDATA[0.2]]></version>
|
||||
<version><![CDATA[0.3]]></version>
|
||||
<description><![CDATA[Adds a block containing the customer's wishlists.]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[front_office_features]]></tab>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
function upgrade_module_0_3($object)
|
||||
{
|
||||
return ($object->registerHook('displayProductListFunctionalButtons') && $object->registerHook('top'));
|
||||
}
|
||||
Reference in New Issue
Block a user