[-] MO : #PSFV-636 - Remove warnings lile "Warning: Function displayHeader() is deprecated" with module blockwishlist
This commit is contained in:
@@ -203,6 +203,9 @@ class BlockWishList extends Module
|
||||
}
|
||||
else
|
||||
$this->smarty->assign(array('wishlist_products' => false, 'wishlists' => false));
|
||||
|
||||
$this->smarty->assign(array('wishlist_link' => $this->context->link->getModuleLink('blockwishlist', 'mywishlist')));
|
||||
|
||||
return ($this->display(__FILE__, 'blockwishlist.tpl'));
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
<div id="wishlist_block" class="block account">
|
||||
<h4>
|
||||
<a href="{$base_dir_ssl}/modules/blockwishlist/mywishlist.php">{l s='Wishlist' mod='blockwishlist'}</a>
|
||||
<a href="{$wishlist_link}">{l s='Wishlist' mod='blockwishlist'}</a>
|
||||
</h4>
|
||||
<div class="block_content">
|
||||
<div id="wishlist_block_list" class="expanded">
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>blockwishlist</name>
|
||||
<displayName><![CDATA[Wishlist block]]></displayName>
|
||||
<displayName><![CDATA[Bloc liste de cadeaux]]></displayName>
|
||||
<version><![CDATA[0.2]]></version>
|
||||
<description><![CDATA[Adds a block containing the customer\'s wishlists.]]></description>
|
||||
<description><![CDATA[Ajoute un bloc gérant les listes de cadeaux]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[front_office_features]]></tab>
|
||||
<is_configurable>1</is_configurable>
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2012 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-2012 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @since 1.5.0
|
||||
*/
|
||||
class BlockWishListMyWishListModuleFrontController extends ModuleFrontController
|
||||
{
|
||||
public $display_column_left = false;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->context = Context::getContext();
|
||||
|
||||
include_once($this->module->getLocalPath().'WishList.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* @see FrontController::initContent()
|
||||
*/
|
||||
public function initContent()
|
||||
{
|
||||
parent::initContent();
|
||||
|
||||
$this->assign();
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign wishlist template
|
||||
*/
|
||||
public function assign()
|
||||
{
|
||||
$errors = array();
|
||||
|
||||
if ($this->context->customer->isLogged())
|
||||
{
|
||||
$add = Tools::getIsset('add');
|
||||
$add = (empty($add) === false ? 1 : 0);
|
||||
$delete = Tools::getIsset('deleted');
|
||||
$delete = (empty($delete) === false ? 1 : 0);
|
||||
$id_wishlist = Tools::getValue('id_wishlist');
|
||||
if (Tools::isSubmit('submitWishlist'))
|
||||
{
|
||||
if (Configuration::get('PS_TOKEN_ACTIVATED') == 1 AND
|
||||
strcmp(Tools::getToken(), Tools::getValue('token')))
|
||||
$errors[] = Tools::displayError('Invalid token');
|
||||
if (!sizeof($errors))
|
||||
{
|
||||
$name = Tools::getValue('name');
|
||||
if (empty($name))
|
||||
$errors[] = Tools::displayError('You must specify a name.');
|
||||
if (WishList::isExistsByNameForUser($name))
|
||||
$errors[] = Tools::displayError('This name is already used by another list.');
|
||||
|
||||
if(!sizeof($errors))
|
||||
{
|
||||
$wishlist = new WishList();
|
||||
$wishlist->name = $name;
|
||||
$wishlist->id_customer = (int)$this->context->customer->id;
|
||||
list($us, $s) = explode(' ', microtime());
|
||||
srand($s * $us);
|
||||
$wishlist->token = strtoupper(substr(sha1(uniqid(rand(), true)._COOKIE_KEY_.$this->context->customer->id), 0, 16));
|
||||
$wishlist->add();
|
||||
Mail::Send(
|
||||
$this->context->language->id,
|
||||
'wishlink',
|
||||
Mail::l('Your wishlist\'s link',
|
||||
$this->context->language->id),
|
||||
array(
|
||||
'{wishlist}' => $wishlist->name,
|
||||
'{message}' => Tools::getProtocol().htmlentities($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__.'modules/blockwishlist/view.php?token='.$wishlist->token),
|
||||
$this->context->customer->email,
|
||||
$this->context->customer->firstname.' '.$this->context->customer->lastname,
|
||||
NULL,
|
||||
strval(Configuration::get('PS_SHOP_NAME')),
|
||||
NULL,
|
||||
NULL,
|
||||
$this->module->getLocalPath().'mails/');
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ($add)
|
||||
WishList::addCardToWishlist($this->context->customer->id, Tools::getValue('id_wishlist'), $this->context->language->id);
|
||||
else if ($delete AND empty($id_wishlist) === false)
|
||||
{
|
||||
$wishlist = new WishList((int)($id_wishlist));
|
||||
if (Validate::isLoadedObject($wishlist))
|
||||
$wishlist->delete();
|
||||
else
|
||||
$errors[] = Tools::displayError('Cannot delete this wishlist');
|
||||
}
|
||||
$this->context->smarty->assign('wishlists', WishList::getByIdCustomer($this->context->customer->id));
|
||||
$this->context->smarty->assign('nbProducts', WishList::getInfosByIdCustomer($this->context->customer->id));
|
||||
}
|
||||
else
|
||||
Tools::redirect('index.php?controller=authentication&back='.urlencode($this->context->link->getModuleLink('blockwishlist', 'mywishlist')));
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'id_customer' => (int)$this->context->customer->id,
|
||||
'errors' => $errors,
|
||||
'form_link' => $errors,
|
||||
));
|
||||
|
||||
$this->setTemplate('mywishlist.tpl');
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,8 @@ include_once(dirname(__FILE__).'/WishList.php');
|
||||
$context = Context::getContext();
|
||||
$errors = array();
|
||||
|
||||
Tools::displayFileAsDeprecated();
|
||||
|
||||
if ($context->customer->isLogged())
|
||||
{
|
||||
$add = Tools::getIsset('add');
|
||||
@@ -97,8 +99,8 @@ $context->smarty->assign(array(
|
||||
|
||||
if (Tools::file_exists_cache(_PS_THEME_DIR_.'modules/blockwishlist/mywishlist.tpl'))
|
||||
$context->smarty->display(_PS_THEME_DIR_.'modules/blockwishlist/mywishlist.tpl');
|
||||
elseif (Tools::file_exists_cache(dirname(__FILE__).'/mywishlist.tpl'))
|
||||
$context->smarty->display(dirname(__FILE__).'/mywishlist.tpl');
|
||||
elseif (Tools::file_exists_cache(dirname(__FILE__).'/views/templates/front/mywishlist.tpl'))
|
||||
$context->smarty->display(dirname(__FILE__).'/views/templates/front/mywishlist.tpl');
|
||||
else
|
||||
echo Tools::displayError('No template found');
|
||||
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@
|
||||
{include file="$tpl_dir./errors.tpl"}
|
||||
|
||||
{if $id_customer|intval neq 0}
|
||||
<form action="{$base_dir_ssl}modules/blockwishlist/mywishlist.php" method="post" class="std" id="form_wishlist">
|
||||
<form method="post" class="std" id="form_wishlist">
|
||||
<fieldset>
|
||||
<h3>{l s='New wishlist' mod='blockwishlist'}</h3>
|
||||
<p class="text">
|
||||
@@ -36,7 +36,7 @@ class LoyaltyDefaultModuleFrontController extends ModuleFrontController
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->context = Context::getContext();
|
||||
$this->context = Context::getContext();
|
||||
|
||||
include_once($this->module->getLocalPath().'LoyaltyModule.php');
|
||||
include_once($this->module->getLocalPath().'LoyaltyStateModule.php');
|
||||
|
||||
Reference in New Issue
Block a user