Jump to content

Custom Mail Alerts


Recommended Posts

Hello,

 

I need to configure the MailAlerts module to send custom text email (just plain text, not multipart or html). So, i tried modifying the mailalerts.php

 

Now my question for you is this (newbie question btw):  What do i need to edit so the module wont take the text from inside the .txt file or .html file. All i want the module to do with the New Order is to take the delivery phone and send it as the Subject and the body of the email to be one that i preset (even in the php file).

 

So the code from mailalerts.php is this: 


		// Filling-in vars for email
		$template = 'new_order';
		$subjectnou = 'Testing';
		$template_vars = array(
			'{firstname}' => $customer->firstname,
			'{lastname}' => $customer->lastname,
			'{email}' => $customer->email,
			'{delivery_block_txt}' => MailAlert::getFormatedAddress($delivery, "\n"),
			'{invoice_block_txt}' => MailAlert::getFormatedAddress($invoice, "\n"),
			'{delivery_block_html}' => MailAlert::getFormatedAddress($delivery, '<br />', array(
			'firstname' => '<span style="color:#DB3484; font-weight:bold;">%s</span>',
			'lastname' => '<span style="color:#DB3484; font-weight:bold;">%s</span>')),
			'{invoice_block_html}' => MailAlert::getFormatedAddress($invoice, '<br />', array(
			'firstname' => '<span style="color:#DB3484; font-weight:bold;">%s</span>',
			'lastname' => '<span style="color:#DB3484; font-weight:bold;">%s</span>')),
			'{delivery_company}' => $delivery->company,
			'{delivery_firstname}' => $delivery->firstname,
			'{delivery_lastname}' => $delivery->lastname,
			'{delivery_address1}' => $delivery->address1,
			'{delivery_address2}' => $delivery->address2,
			'{delivery_city}' => $delivery->city,
			'{delivery_postal_code}' => $delivery->postcode,
			'{delivery_country}' => $delivery->country,
			'{delivery_state}' => $delivery->id_state ? $delivery_state->name : '',
			'{delivery_phone}' => $delivery->phone,
			'{delivery_other}' => $delivery->other,
			'{invoice_company}' => $invoice->company,
			'{invoice_firstname}' => $invoice->firstname,
			'{invoice_lastname}' => $invoice->lastname,
			'{invoice_address2}' => $invoice->address2,
			'{invoice_address1}' => $invoice->address1,
			'{invoice_city}' => $invoice->city,
			'{invoice_postal_code}' => $invoice->postcode,
			'{invoice_country}' => $invoice->country,
			'{invoice_state}' => $invoice->id_state ? $invoice_state->name : '',
			'{invoice_phone}' => $invoice->phone,
			'{invoice_other}' => $invoice->other,
			'{order_name}' => sprintf('%06d', $order->id),
			'{shop_name}' => Configuration::get('PS_SHOP_NAME'),
			'{date}' => $order_date_text,
			'{carrier}' => (($carrier->name == '0') ? Configuration::get('PS_SHOP_NAME') : $carrier->name),
			'{payment}' => Tools::substr($order->payment, 0, 32),
			'{items}' => $items_table,
			'{total_paid}' => Tools::displayPrice($order->total_paid, $currency),
			'{total_products}' => Tools::displayPrice($order->getTotalProductsWithTaxes(), $currency),
			'{total_discounts}' => Tools::displayPrice($order->total_discounts, $currency),
			'{total_shipping}' => Tools::displayPrice($order->total_shipping, $currency),
			'{total_wrapping}' => Tools::displayPrice($order->total_wrapping, $currency),
			'{currency}' => $currency->sign,
			'{message}' => $message
		);

		$iso = Language::getIsoById($id_lang);

		if (file_exists(dirname(__FILE__).'/mails/'.$iso.'/'.$template.'.txt') &&
			file_exists(dirname(__FILE__).'/mails/'.$iso.'/'.$template.'.html'))
			Mail::Send(
				$id_lang,
				$template,
				sprintf(Mail::l('{delivery_phone}', $id_lang), $order->id),
				$template_vars,
				explode(self::__MA_MAIL_DELIMITOR__, $this->_merchant_mails),
				null,
				$configuration['PS_SHOP_EMAIL'],
				$configuration['PS_SHOP_NAME'],
				null,
				null,
				dirname(__FILE__).'/mails/'
			);
	}

Any ideas? I really need that the email sent to have the DELIVERY Phone as Subject and the "WE RECEIVED YOUR EMAIL" as the text from the email body.

 

Hope you`ll help. Thanks

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...