Hi Guys
I really would appreciate some help here.
My client has their own shipping service tied to a warehouse.
The Idea is that when an order is made, the administrator will forward the confirmation E-mail to the warehouse where the order is assembled and packed ready for shipping. The old system they used provided a confirmation email in PDF which was assembled with the Shipping address in the bottom left hand corner. When the document was printed, the shipping address would fall into an area which could be torn off and attached to the package.
Now I have changed the Email confirmation template to provide that but it is dependant on how many items a customer purchaces. To few and the ship address is to high, to many and the ship address can be half on one page and half on the next page. The result needs to be standard A4 size with a defined area for purchaced products that will automatically create another page if required but at the same time place the shipping address in the same place all the time.
Here is my email template code:
<?php
// $Id: confirmation_email.tpl.php 1393 2008-05-02 11:42:19Z soeren_nb $
if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
?>
<html>
<head>
<title><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_LBL') ?></title>
<style type="text/css">
<!--
.Stil1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
}
.Stil2 {font-family: Verdana, Arial, Helvetica, sans-serif}
-->
</style>
</head>
<body>
<table width="100%" align="center" border="0" cellspacing="0" cellpadding="10">
<tr valign="top">
<td width=53% align="left" class="Stil1"><?php echo ps_vendor::formatted_store_address(true) ?></td>
<td width="47%" align="right"><img src="cid:vendor_image" alt="vendor_image" border="0" /></td>
</tr>
<tr>
<td colspan="2" class="Stil1"><?php echo $order_header_msg ?></td>
</tr>
<tr bgcolor="white">
<td colspan="2">
<h5 class="Stil2"><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_LBL') ?></h5> </td>
</tr>
</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<!-- begin order items information -->
<tr bgcolor="#CCCCCC" class="Stil2">
<td colspan="2"><b><?php echo $VM_LANG->_('PHPSHOP_ORDER_ITEM') ?></b></td>
</tr>
<tr>
<td colspan="2">
<table width="100%" cellspacing="0" cellpadding="2" border="0">
<tr align="left" class="Stil1">
<th><?php echo $VM_LANG->_('PHPSHOP_CART_QUANTITY') ?></th>
<th><?php echo $VM_LANG->_('PHPSHOP_CART_NAME') ?></th>
<th><?php echo $VM_LANG->_('PHPSHOP_CART_SKU') ?></th>
<th><?php echo $VM_LANG->_('PHPSHOP_CART_PRICE') ?></th>
<th><?php echo $VM_LANG->_('PHPSHOP_CART_SUBTOTAL') ?></th>
</tr>
<?php
// CREATE THE LIST WITH ALL ORDER ITEMS
$order_items = "";
$sub_total = 0.00;
while($dboi->next_record()) {
$my_qty = $dboi->f("product_quantity");
if ($auth["show_price_including_tax"] == 1) {
$price = $dboi->f("product_final_price");
$my_price = $CURRENCY_DISPLAY->getFullValue($dboi->f("product_final_price"), '', $db->f('order_currency'));
} else {
$price = $dboi->f("product_item_price");
$my_price = $CURRENCY_DISPLAY->getFullValue($dboi->f("product_item_price"), '', $db->f('order_currency'));
}
$my_subtotal = $my_qty * $price;
$sub_total += $my_subtotal;
?>
<tr class="Stil1">
<td height="15"><?php echo $my_qty ?></td>
<td><?php $dboi->p("product_name")?> <?php echo ($dboi->f("product_attribute") ? ' ('.$dboi->f("product_attribute").')' : ''); ?></td>
<td><?php echo $ps_product->get_field($dboi->f("product_id"), "product_sku") ?></td>
<td><?php echo $my_price ?></td>
<td><?php echo $CURRENCY_DISPLAY->getFullValue($my_subtotal, '', $db->f('order_currency')) ?></td>
</tr>
<?php
}
?>
<tr class="Stil1">
<td colspan="4" align="right"> </td>
<td> </td>
</tr>
<tr class="Stil1">
<td colspan="4" align="right"><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_SUBTOTAL') ?> :</td>
<td><?php echo $order_subtotal ?></td>
</tr>
<?php
// DISCOUNT HANDLING
if ( PAYMENT_DISCOUNT_BEFORE == '1') {
if ($order_discount > 0 || $order_discount < 0) {
?>
<tr class="Stil1">
<td align="right" colspan="4"><?php echo $order_discount_lbl ?>: </td>
<td> <?php echo $order_discount_plusminus .' '. $CURRENCY_DISPLAY->getFullValue(abs($order_discount), '', $db->f('order_currency')) ?></td>
</tr>
<?php
}
if ($coupon_discount > 0 || $coupon_discount < 0) {
?>
<tr class="Stil1">
<td align="right" colspan="4"><?php echo $VM_LANG->_('PHPSHOP_COUPON_DISCOUNT') ?>: </td>
<td><?php echo $coupon_discount_plusminus. ' '.$CURRENCY_DISPLAY->getFullValue(abs($coupon_discount), '', $db->f('order_currency')) ?></td>
</tr>
<?php
}
}
?>
<tr class="Stil1">
<td colspan="4" align="right"><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_SHIPPING') ?> :</td>
<td><?php echo $order_shipping ?></td>
</tr>
<tr class="Stil1">
<td colspan="4" align="right"><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_TOTAL_TAX') ?> :</td>
<td><?php echo $order_tax ?></td>
</tr>
<?php
if ( PAYMENT_DISCOUNT_BEFORE != '1') {
if ($order_discount > 0 || $order_discount < 0) {
?>
<tr class="Stil1">
<td align="right" colspan="4"><?php echo $order_discount_lbl ?>: </td>
<td> <?php echo $order_discount_plusminus .' '. $CURRENCY_DISPLAY->getFullValue(abs($order_discount), '', $db->f('order_currency')) ?></td>
</tr>
<?php
}
if ($coupon_discount > 0 || $coupon_discount < 0) {
?>
<tr class="Stil1">
<td align="right" colspan="4"><?php echo $VM_LANG->_('PHPSHOP_COUPON_DISCOUNT') ?>: </td>
<td><?php echo $coupon_discount_plusminus. ' '.$CURRENCY_DISPLAY->getFullValue(abs($coupon_discount), '', $db->f('order_currency')) ?></td>
</tr>
<?php
}
}
?>
<tr class="Stil1">
<td colspan=4 align=right><b><?php echo $VM_LANG->_('PHPSHOP_CART_TOTAL') .": " ?></b></td>
<td><?php echo $order_total ?></td>
</tr>
</table> </td>
</tr>
<!-- end order items information -->
<!-- begin customer note -->
<tr class="sectiontableheader">
<td colspan="2"><div align="left">
<!-- begin shipto -->
<table width="40%" border="0" cellpadding="2" cellspacing="0" class="Stil1">
<tr>
<td colspan="1"><b><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_SHIP_TO_LBL') ?></b></td>
</tr>
<?php
foreach( $shippingfields as $field ) {
if( $field->name == 'email') $field->name = 'user_email';
if( $field->type == 'delimiter') { ?>
<tr class="Stil1">
<td colspan="1"><div align="left"><?php echo $VM_LANG->_(title) ? $VM_LANG->_(title) : title ?></b></div></td>
</tr>
<?php
} else { ?>
<tr class="Stil1">
<td><?php echo $VM_LANG->_(title) ? $VM_LANG->_(title) : title ?>:</td>
<td><?php
switch($field->name) {
case 'country':
require_once(CLASSPATH.'ps_country.php');
$country = new ps_country();
$dbc = $country->get_country_by_code($dbst->f($field->name));
if( $dbc !== false ) echo $dbc->f('country_name');
break;
default:
echo $dbst->f($field->name);
break;
}
?></td>
</tr>
<?php
} ?>
<?php
}
?>
</table>
<!-- end shipto -->
</div></td>
</tr>
</table>
<br>
<p class="Stil2"></p>
<p class="Stil2">
</td>
<td width="50%"><p class="Stil2"> </p>
</body>
</html>
This is the result:
Tech Store
10 Tech Road
Atlanta, 92630
Thank you for shopping with us. Your order information follows.
Purchase Order
Order Items
Quantity Name SKU Price Subtotal
1 Mac Mini macmini USD699.00 USD699.00
1 Macbook White mbw13 USD999.00 USD999.00
1 Macbook mba13 USD1,299.00 USD1,299.00
1 iMac imac USD1,199.00 USD1,199.00
1 Mac Pro macpro USD2,499.00 USD2,499.00
1 iPhone iphone USD329.00 USD329.00
1 Mighty Mouse 89071 USD59.00 USD59.00
1 Wireless Keyboard 89070 USD69.00 USD69.00
1 Microsoft Mouse 89072 USD54.00 USD54.00
1 Innovation 89073 USD159.00 USD159.00
1 Wireless Access 564655 USD1.99 USD1.99
1 Airport Express 564654 USD99.00 USD99.00
SubTotal : USD7,465.99
Shipping and Handling Fee : USD611.97
Tax Total : USD46.64
Fee: + USD2.00
Total: USD8,079.96
Ship To
title: The Company
title: A surname
title: Some Road
title: Some other address thingy
title: A town
title: whatever
title: United Kingdom
title: EN
A bit neater than that in HTML.
If there is anyone out there who can help, I really would appreciate it.
Kind regards
Paul
PS site is
http://www.yonjaispa.com