// Context part 31

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8087 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
tDidierjean
2011-08-17 10:07:12 +00:00
parent b8706ddd8a
commit cb3d802346
57 changed files with 200 additions and 165 deletions
+7 -7
View File
@@ -178,26 +178,26 @@ class BlockWishList extends Module
global $errors;
require_once(dirname(__FILE__).'/WishList.php');
if ($params['cookie']->isLogged())
if ($this->context->customer->isLogged())
{
$wishlists = Wishlist::getByIdCustomer($params['cookie']->id_customer);
if (empty($params['cookie']->id_wishlist) === true ||
WishList::exists($params['cookie']->id_wishlist, $params['cookie']->id_customer) === false)
$wishlists = Wishlist::getByIdCustomer($this->context->customer->id);
if (empty($this->context->cookie->id_wishlist) === true ||
WishList::exists($this->context->cookie->id_wishlist, $this->context->customer->id) === false)
{
if (!sizeof($wishlists))
$id_wishlist = false;
else
{
$id_wishlist = (int)($wishlists[0]['id_wishlist']);
$params['cookie']->id_wishlist = (int)($id_wishlist);
$this->context->cookie->id_wishlist = (int)($id_wishlist);
}
}
else
$id_wishlist = $params['cookie']->id_wishlist;
$id_wishlist = $this->context->cookie->id_wishlist;
$this->context->smarty->assign(array(
'id_wishlist' => $id_wishlist,
'isLogged' => true,
'wishlist_products' => ($id_wishlist == false ? false : WishList::getProductByIdCustomer($id_wishlist, $params['cookie']->id_customer, $params['cookie']->id_lang, null, true)),
'wishlist_products' => ($id_wishlist == false ? false : WishList::getProductByIdCustomer($id_wishlist, $this->context->customer->id, $this->context->language->id, null, true)),
'wishlists' => $wishlists,
'ptoken' => Tools::getToken(false)));
}
+2 -2
View File
@@ -40,9 +40,9 @@ $quantity = (int)(Tools::getValue('quantity'));
$id_product_attribute = (int)(Tools::getValue('id_product_attribute'));
if (Configuration::get('PS_TOKEN_ENABLE') == 1 AND
strcmp(Tools::getToken(false), Tools::getValue('token')) AND
$context->cookie->isLogged() === true)
$context->customer->isLogged() === true)
echo Tools::displayError('Invalid token');
if ($context->cookie->isLogged())
if ($context->customer->isLogged())
{
if ($id_wishlist AND WishList::exists($id_wishlist, $context->customer->id) === true)
$context->cookie->id_wishlist = (int)($id_wishlist);
+1 -1
View File
@@ -32,7 +32,7 @@ require_once(dirname(__FILE__).'/../../config/config.inc.php');
require_once(dirname(__FILE__).'/../../init.php');
require_once(dirname(__FILE__).'/WishList.php');
$context = Context::getContext();
if ($context->cookie->isLogged())
if ($context->customer->isLogged())
{
$action = Tools::getValue('action');
$id_wishlist = (int)Tools::getValue('id_wishlist');
+1 -1
View File
@@ -35,7 +35,7 @@ include_once(dirname(__FILE__).'/WishList.php');
$context = Context::getContext();
$errors = array();
if ($cookie->isLogged())
if ($context->customer->isLogged())
{
$add = Tools::getIsset('add');
$add = (empty($add) === false ? 1 : 0);
+4 -2
View File
@@ -29,12 +29,14 @@ require_once(dirname(__FILE__).'/../../config/config.inc.php');
require_once(dirname(__FILE__).'/../../init.php');
require_once(dirname(__FILE__).'/WishList.php');
$context = Context::getContext();
if (Configuration::get('PS_TOKEN_ENABLE') == 1 AND
strcmp(Tools::getToken(false), Tools::getValue('token')) AND
$context->cookie->isLogged() === true)
$context->customer->isLogged() === true)
exit(Tools::displayError('invalid token',false));
if ($context->cookie->isLogged())
if ($context->customer->isLogged())
{
$id_wishlist = (int)(Tools::getValue('id_wishlist'));
if (empty($id_wishlist) === true)