Post by travoltron » Sat Jan 07, 2012 8:22 am

In /model/checkout/order.php I've modded the admin alert email to reflect using a templated file

Code: Select all

$template->data['text_greeting'] = $language->get('text_new_received') . "\n\n";
				$template->data['invoice_no'] = '';
				$template->data['text_invoice_no'] = '';
				$html = $template->fetch($this->config->get('config_template') . '/template/mail/xml.tpl');
				$subject = sprintf($language->get('text_new_subject'), html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'), $order_id . ' (' . $order_total . ')');
				$mail->setSubject($subject);
				$mail->setTo($this->config->get('config_email'));
				$mail->setHtml($html);
				$mail->send();
Here is the text of xml.tpl. I know that there are characters that aren't going to be parsed.

Code: Select all

<?xml version="1.0" encoding="ISO-8859-15"?>
<Order>
	<OrderID><?php echo $order_id; ?></OrderID>
	<OrderDate><?php echo $date_added; ?></OrderDate>
	<ShippingAddress>
		<Name><?php echo $shipping_address_split['firstname'] . " " . $shipping_address_split['lastname']; ?></Name>
		<Street1><?php echo $shipping_address_split['address_1']; ?></Street1>
		<City><?php echo $shipping_address_split['city']; ?></City>
		<State><?php echo $shipping_address_split['zone_code']; ?></State>
		<Zip><?php echo $shipping_address_split['postcode']; ?></Zip>
		<Country><?php echo $shipping_address_split['country']; ?></Country>
		<Phone><?php echo $telephone; ?></Phone>
		<EmailAddress><?php echo $email; ?></EmailAddress>
	</ShippingAddress>
		<OrderLineItems>
			<?php foreach ($products as $product) { 
				$str = $option['value'];
				$start  = strpos($str, '[');
				$end    = strpos($str, ']', $start + 1);
				$length = $end - $start;
				$result = substr($str, $start + 1, $length - 1);
			?>
			<Product>
				<SKU><?php echo $result; ?></SKU>
				<Name><?php echo $product['name']; ?></Name>
				<Quantity><?php echo $product['quantity']; ?></Quantity>
			</Product>
			<? } ?>
		</OrderLineItems>
	<ShippingMethod><?php echo $shipping_method; ?></ShippingMethod>
	<CommentsCustomer><?php echo $comment; ?></CommentsCustomer>
</Order>

This email is not fired, and the apache error logs are telling me it's a string issue in line 1, I know I can echo everything out, but I'm hoping there's a better way.

Thank you in advance!

Newbie

Posts

Joined
Fri Nov 04, 2011 4:07 am

Post by travoltron » Tue Jan 10, 2012 2:59 pm

I went ahead and echo'd everything out. This could be easily tweaked for people looking for a way to mod the output of admin emails.

Newbie

Posts

Joined
Fri Nov 04, 2011 4:07 am

Post by estone » Thu Jan 17, 2013 1:09 am

Hi travoltron,
thanks for your question and solution...
Could you post here your final code?

I am going to try to have the shop send an email to the owner wich has a xml attachment. The owner can open this xml file with his booking program (Accountview) and the order is read in.

Can this be done with your code?

Thanks!

Newbie

Posts

Joined
Fri Dec 21, 2012 8:17 pm
Who is online

Users browsing this forum: No registered users and 2 guests