Jump to content

Receive a copy of the email when a customer send a wishlist to a friend/family


Recommended Posts

Hi !

 

I would like to know how the change this code in modules/blockwishlist/sendwishlist.php  so I could receive a copy of the email when a customer send his wishlist to someone.

 

$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}' => $context->link->getModuleLink('blockwishlist', 'view', array('token' => $wishlist['token']))
				),
				$to, $toName, $customer->email, $customer->firstname.' '.$customer->lastname, null, null, dirname(__FILE__).'/mails/'
			);
	}
}

I guess it's in this file right ?
 

 

I'm also wondering if there is a way to know what products are the most added to the wishlist module ?

Christmas is coming and it would really help me in deciding what quantities of each product I should buy..

 

Thanks a lot for your help !

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...