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