*/ require_once dirname(__FILE__) . '/../../config/config.inc.php'; require_once dirname(__FILE__) . '/../../init.php'; require_once dirname(__FILE__) . '/WishList.php'; $context = Context::getContext(); // Instance of module class for translations $module = new BlockWishList(); if (Configuration::get('PS_TOKEN_ENABLE') == 1 and strcmp(Tools::getToken(false), Tools::getValue('token')) and $context->customer->isLogged() === true) { exit($module->l('invalid token', 'sendwishlist')); } if ($context->customer->isLogged()) { $id_wishlist = (int) Tools::getValue('id_wishlist'); if (empty($id_wishlist) === true) { exit($module->l('Invalid wishlist', 'sendwishlist')); } for ($i = 1; empty($_POST['email' . strval($i)]) === false; ++$i) { $to = Tools::getValue('email' . $i); $wishlist = WishList::exists($id_wishlist, $context->customer->id, true); if ($wishlist === false) { exit($module->l('Invalid wishlist', 'sendwishlist')); } if (WishList::addEmail($id_wishlist, $to) === false) { exit($module->l('Wishlist send error', 'sendwishlist')); } $toName = strval(Configuration::get('PS_SHOP_NAME')); $customer = $context->customer; if (Validate::isLoadedObject($customer)) { Mail::Send($context->language->id, 'wishlist', sprintf(Mail::l('Message from %1$s %2$s', $context->language->id), $customer->lastname, $customer->firstname), array('{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname, '{wishlist}' => $wishlist['name'], '{message}' => Tools::getProtocol() . htmlentities($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . __PS_BASE_URI__ . 'modules/blockwishlist/view.php?token=' . $wishlist['token']), $to, $toName, $customer->email, $customer->firstname . ' ' . $customer->lastname, NULL, NULL, dirname(__FILE__) . '/mails/'); } } }
public function hookRightColumn($params) { global $errors; require_once dirname(__FILE__) . '/WishList.php'; if ($this->context->customer->isLogged()) { $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']; $this->context->cookie->id_wishlist = (int) $id_wishlist; } } else { $id_wishlist = $this->context->cookie->id_wishlist; } $this->smarty->assign(array('id_wishlist' => $id_wishlist, 'isLogged' => 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))); } 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'); }
$add = !strcmp($action, 'add') ? 1 : 0; $delete = !strcmp($action, 'delete') ? 1 : 0; $id_wishlist = (int) Tools::getValue('id_wishlist'); $id_product = (int) Tools::getValue('id_product'); $quantity = (int) Tools::getValue('quantity'); $id_product_attribute = (int) Tools::getValue('id_product_attribute'); // Instance of module class for translations $module = new BlockWishList(); if (Configuration::get('PS_TOKEN_ENABLE') == 1 && strcmp(Tools::getToken(false), Tools::getValue('token')) && $context->customer->isLogged() === true) { echo $module->l('Invalid token', 'cart'); } if ($context->customer->isLogged()) { if ($id_wishlist && WishList::exists($id_wishlist, $context->customer->id) === true) { $context->cookie->id_wishlist = (int) $id_wishlist; } if ((int) $context->cookie->id_wishlist > 0 && !WishList::exists($context->cookie->id_wishlist, $context->customer->id)) { $context->cookie->id_wishlist = ''; } if (empty($context->cookie->id_wishlist) === true || $context->cookie->id_wishlist == false) { $context->smarty->assign('error', true); } if (($add || $delete) && empty($id_product) === false) { if (!isset($context->cookie->id_wishlist) || $context->cookie->id_wishlist == '') { $wishlist = new WishList(); $wishlist->id_shop = $context->shop->id; $wishlist->id_shop_group = $context->shop->id_shop_group; $wishlist->default = 1; $mod_wishlist = new BlockWishList(); $wishlist->name = $mod_wishlist->default_wishlist_name; $wishlist->id_customer = (int) $context->customer->id; list($us, $s) = explode(' ', microtime());
public function hookRightColumn($params) { if ($this->context->customer->isLogged()) { $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 (!count($wishlists)) { $id_wishlist = false; } else { $id_wishlist = (int) $wishlists[0]['id_wishlist']; $this->context->cookie->id_wishlist = (int) $id_wishlist; } } else { $id_wishlist = $this->context->cookie->id_wishlist; } $this->smarty->assign(array('id_wishlist' => $id_wishlist, 'isLogged' => 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))); } else { $this->smarty->assign(array('wishlist_products' => false, 'wishlists' => false)); } return $this->display(__FILE__, 'blockwishlist.tpl'); }
<?php require_once dirname(__FILE__) . '/../../config/config.inc.php'; require_once dirname(__FILE__) . '/../../init.php'; require_once dirname(__FILE__) . '/WishList.php'; if (Configuration::get('PS_TOKEN_ENABLE') == 1 and strcmp(Tools::getToken(false), Tools::getValue('token')) and $cookie->isLogged() === true) { exit(Tools::displayError('invalid token')); } if ($cookie->isLogged()) { $id_wishlist = intval(Tools::getValue('id_wishlist')); if (empty($id_wishlist) === true) { exit(Tools::displayError('Invalid wishlist')); } for ($i = 1; empty($_POST['email' . strval($i)]) === false; ++$i) { $to = Tools::getValue('email' . $i); $wishlist = WishList::exists($id_wishlist, $cookie->id_customer, true); if ($wishlist === false) { exit(Tools::displayError('Invalid wishlist')); } if (WishList::addEmail($id_wishlist, $to) === false) { exit(Tools::displayError('Wishlist send error')); } $toName = strval(Configuration::get('PS_SHOP_NAME')); $customer = new Customer(intval($cookie->id_customer)); if (Validate::isLoadedObject($customer)) { Mail::Send(intval($cookie->id_lang), 'wishlist', 'Message from ' . $customer->lastname . ' ' . $customer->firstname, array('{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname, '{wishlist}' => $wishlist['name'], '{message}' => 'http://' . htmlentities($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . __PS_BASE_URI__ . 'modules/blockwishlist/view.php?token=' . $wishlist['token']), $to, $toName, $customer->email, $customer->firstname . ' ' . $customer->lastname, NULL, NULL, dirname(__FILE__) . '/mails/'); } } }
public function hookRightColumn($params) { global $smarty; global $errors; if (Configuration::get('PS_BLOCK_WISHLIST_ACTIVATED') == 0) { return null; } require_once dirname(__FILE__) . '/WishList.php'; if ($params['cookie']->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) { if (!sizeof($wishlists)) { $id_wishlist = false; } else { $id_wishlist = intval($wishlists[0]['id_wishlist']); $params['cookie']->id_wishlist = intval($id_wishlist); } } else { $id_wishlist = $params['cookie']->id_wishlist; } $smarty->assign(array('id_wishlist' => $id_wishlist, 'isLogged' => true, 'products' => $id_wishlist == false ? false : WishList::getProductByIdCustomer($id_wishlist, $params['cookie']->id_customer, $params['cookie']->id_lang, null, true), 'wishlists' => $wishlists, 'ptoken' => Tools::getToken(false))); } else { $smarty->assign(array('products' => false, 'wishlists' => false)); } return $this->display(__FILE__, 'blockwishlist.tpl'); }
require_once dirname(__FILE__) . '/../../config/config.inc.php'; require_once dirname(__FILE__) . '/../../init.php'; require_once dirname(__FILE__) . '/WishList.php'; require_once dirname(__FILE__) . '/blockwishlist.php'; $action = Tools::getValue('action'); $add = !strcmp($action, 'add') ? 1 : 0; $delete = !strcmp($action, 'delete') ? 1 : 0; $id_wishlist = (int) Tools::getValue('id_wishlist'); $id_product = (int) Tools::getValue('id_product'); $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 $cookie->isLogged() === true) { echo Tools::displayError('Invalid token'); } if ($cookie->isLogged()) { if ($id_wishlist and WishList::exists($id_wishlist, $cookie->id_customer) === true) { $cookie->id_wishlist = (int) $id_wishlist; } if (empty($cookie->id_wishlist) === true or $cookie->id_wishlist == false) { $smarty->assign('error', true); } if (($add or $delete) and empty($id_product) === false) { if (!isset($cookie->id_wishlist) or $cookie->id_wishlist == '') { // Try to get an existing wishlist before creating a new one (useful if there is no wishlist block hooked left or right) $wishlists = Wishlist::getByIdCustomer($cookie->id_customer); if (!empty($wishlists)) { $id_wishlist = (int) $wishlists[0]['id_wishlist']; $cookie->id_wishlist = (int) $id_wishlist; } else { $wishlist = new WishList(); $modWishlist = new BlockWishList();
require_once dirname(__FILE__) . '/blockwishlist.php'; $context = Context::getContext(); $action = Tools::getValue('action'); $add = !strcmp($action, 'add') ? 1 : 0; $delete = !strcmp($action, 'delete') ? 1 : 0; $id_wishlist = (int) Tools::getValue('id_wishlist'); $id_product = (int) Tools::getValue('id_product'); $quantity = (int) Tools::getValue('quantity'); $id_product_attribute = (int) Tools::getValue('id_product_attribute'); // Instance of module class for translations $module = new BlockWishList(); if (Configuration::get('PS_TOKEN_ENABLE') == 1 and strcmp(Tools::getToken(false), Tools::getValue('token')) and $context->customer->isLogged() === true) { echo $module->l('Invalid token', 'cart'); } if ($context->customer->isLogged()) { if ($id_wishlist and WishList::exists($id_wishlist, $context->customer->id) === true) { $context->cookie->id_wishlist = (int) $id_wishlist; } if (empty($context->cookie->id_wishlist) === true or $context->cookie->id_wishlist == false) { $context->smarty->assign('error', true); } if (($add or $delete) and empty($id_product) === false) { if (!isset($context->cookie->id_wishlist) or $context->cookie->id_wishlist == '') { $wishlist = new WishList(); $wishlist->id_shop = $context->shop->id; $wishlist->id_shop_group = $context->shop->id_shop_group; $modWishlist = new BlockWishList(); $wishlist->name = $modWishlist->default_wishlist_name; $wishlist->id_customer = (int) $context->customer->id; list($us, $s) = explode(' ', microtime()); srand($s * $us);