本文整理汇总了PHP中WishList::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP WishList::exists方法的具体用法?PHP WishList::exists怎么用?PHP WishList::exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WishList
的用法示例。
在下文中一共展示了WishList::exists方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dirname
*/
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/');
}
}
}
示例2: hookRightColumn
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');
}
示例3: BlockWishList
$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());
示例4: hookRightColumn
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');
}
示例5: dirname
<?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/');
}
}
}
示例6: hookRightColumn
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');
}
示例7: dirname
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();
示例8: dirname
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);