Author Topic: Email Confirmation Question  (Read 2790 times)

Paul2301

  • Beginner
  • *
  • Posts: 8
Email Confirmation Question
« on: August 19, 2009, 21:00:59 pm »
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:
Code: [Select]
<?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">&nbsp;</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">&nbsp;&nbsp;</td>
          <td>&nbsp;</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 || $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 || $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 || $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 || $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">&nbsp;</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
 



MikeUK

  • Global Moderator
  • Full Member
  • *
  • Posts: 1344
Re: Email Confirmation Question
« Reply #1 on: August 19, 2009, 23:21:09 pm »
I think this would need to be done by having the php (calculations, data gathering) creating arrays (the data), then after that being passed to a template for x number of products (whatever fits on A4), repeating that until all products are sent. In other words, rewriting it so it calls a template however many times it needs to depending on the space available for products.
Get answers faster:

I can build your online shop, setup or customize Virtuemart or help your existing shop maximize its potential. Email / PM for info

Paul2301

  • Beginner
  • *
  • Posts: 8
Re: Email Confirmation Question
« Reply #2 on: August 20, 2009, 00:51:33 am »
Hi Mike,

Thanks for the thought. What you say seems to make sense. I originally created a table with a specific size for the products but it seemed the email came back with one product ordered per table size I had created. Pretty impressive email considering I added 20 products, I gave up reading it at week 4 there abouts.

I pressume you code Mike and if so, could you write this and how much would it cost. I can provide the exact template from the old shop which fits the printing system exactly.