X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Auto Generated Emails (https://forum.x-cart.com/showthread.php?t=5195)

enge919 11-11-2003 09:35 PM

Auto Generated Emails
 
After doing some pretty cool mods for order control in the orders.tpl and history_orders.tpl, I have added some order status selections to improve handleing between me and our warehouse.

What I would like to do is when I change the status to "W" Sent To Warehouse, I would like to set it up so it auto generates an email that is sent to our warehouse person notifing him there are new orders he need to ship just as when an order is placed "P" Processed or "C" Complete.

I does not have to be anything fancy, again, just a email to notify the person in the warehouse he needs to log on and process an order.

Here is my history_order.tpl

Code:

{* $Id: history_order.tpl,v 1.28.2.1 2003/08/26 11:11:49 svowl Exp $ *}
{ include file="location.tpl" last_location=$lng.lbl_your_orders}
{capture name=dialog}
{if $smarty.get.mode eq "status_changed"}
{$lng.lbl_order} #{$order.orderid} {$lng.txt_has_been_changed}



{include file="buttons/go_back.tpl"}
{else}
<table border=0 width=100%>
 <tr>
<td valign="top">
  <div align="left">{$lng.lbl_order} #{$order.orderid}
{$lng.lbl_date}: {$order.date|date_format:"%d.%m.%Y %H:%M"}</div>



{if $usertype eq "P"}
{$lng.lbl_print_order} {include file="buttons/go.tpl"}
 
 
{/if}
{$lng.lbl_print_invoice} {include file="buttons/go.tpl"}



<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
  <td valign="top" class="ProductDetailsTitle">{$lng.lbl_product_info}</td>
  <td valign="top" class="ProductDetailsTitle"></td>
</tr>
<tr>
  <td class=Line height="1">[img]{$ImagesDir}/spacer.gif[/img]</td>
  <td class=Line height="1">[img]{$ImagesDir}/spacer.gif[/img]</td>
</tr>
<tr>
  <td valign="top" class=ProductDetails height="10"> </td>
  <td valign="top" class=ProductPriceSmall height="10"> </td>
</tr>
{section name=prod_num loop=$products}
<tr>
  <td colspan="2" valign="top" class="ProductTitle">{$products[prod_num].product} #{$products[prod_num].productid}</td>
</tr>
<tr>
  <td valign="top"> </td>
  <td valign="top"> </td>
</tr>
<tr>
  <td valign="top">{$lng.lbl_sku}</td>
  <td valign="top">{$products[prod_num].productcode}</td>
</tr>
<tr>
  <td valign="top">{$lng.lbl_provider}</td>
  <td valign="top">{$products[prod_num].provider}</td>
</tr>
<tr>
  <td valign="top">{$lng.lbl_price}</td>
  <td valign="top">{include file="currency.tpl" value=$products[prod_num].price}</td>
</tr>
<tr>
  <td valign="top">{$lng.lbl_quantity}</td>
  <td valign="top">{$products[prod_num].amount} item(s)</td>
</tr>
{if $products[prod_num].product_options ne ""}
<tr>
  <td valign="top">{$lng.lbl_selected_options}</td>
  <td valign="top">{$products[prod_num].product_options|replace:"\n":"
\n"}</td>
</tr>
{/if}
<tr>
  <td valign="top" class=ProductDetails height="14"> </td>
  <td valign="top" class=ProductDetails height="14"> </td>
</tr>
{/section}
{section name=giftcert loop=$giftcerts}
<tr>
  <td colspan="2" valign="top" class="ProductTitle">{$lng.lbl_gift_certificate}</td>
</tr>
<tr>
  <td valign="top"> </td>
  <td valign="top"> </td>
</tr>
<tr>
  <td valign="top">{$lng.lbl_gc_id}</td>
  <td valign="top">{$giftcerts[giftcert].gcid}</td>
</tr>
<tr>
  <td valign="top">{$lng.lbl_amount}</td>
  <td valign="top">{include file="currency.tpl" value=$giftcerts[giftcert].amount}</td>
</tr>
<tr>
  <td valign="top">{$lng.lbl_recipient}</td>
  <td valign="top">{$giftcerts[giftcert].recipient}</td>
</tr>
{if $giftcerts[giftcert].send_via eq "P"}
<tr>
  <td colspan=2>{$lng.lbl_gc_send_via_postal_mail}</td>
</tr>
<tr>
  <td valign="top" class="LabelStyle">{$lng.lbl_mail_address}</td>
  <td valign="top">
{$giftcerts[giftcert].recipient_firstname} {$giftcerts[giftcert].recipient_lastname}

{$giftcerts[giftcert].recipient_address}, {$giftcerts[giftcert].recipient_city},

{$giftcerts[giftcert].recipient_state} {$giftcerts[giftcert].recipient_country}, {$giftcerts[giftcert].recipient_zipcode}
</td>
</tr>
<tr>
  <td valign="top" class="LabelStyle">{$lng.lbl_phone}</td>
  <td valign="top">{$giftcerts[giftcert].recipient_phone}</td>
</tr>
{else}
<tr>
  <td valign="top">{$lng.lbl_recipient_email}</td>
  <td valign="top">{$giftcerts[giftcert].recipient_email}</td>
</tr>
{/if}
<tr>
  <td valign="top" class=ProductDetails height="14"> </td>
  <td valign="top" class=ProductDetails height="14"> </td>
</tr>
{/section}
<tr>
  <td valign="top" class="ProductDetailsTitle">{$lng.lbl_order_info}</td>
  <td valign="top" class="ProductDetailsTitle"></td>
</tr>
<tr>
  <td class=Line height="1">[img]{$ImagesDir}/spacer.gif[/img]</td>
  <td class=Line height="1">[img]{$ImagesDir}/spacer.gif[/img]</td>
</tr>
<tr>
  <td valign="top" class=ProductDetails height="14"> </td>
  <td valign="top" class=ProductDetails height="14"> </td>
</tr>
<tr>
  <td valign="top">{$lng.lbl_payment_method}</td>
  <td valign="top">{$order.payment_method}</td>
</tr>
<tr>
  <td valign="top">{$lng.lbl_delivery}</td>
  <td valign="top">{$order.shipping}</td>
</tr>
<tr>
  <td valign="top">{$lng.lbl_subtotal}</td>
  <td valign="top">{include file="currency.tpl" value=$order.subtotal}</td>
</tr>
<tr>
  <td valign="top">{$lng.lbl_discount}</td>
  <td valign="top">{include file="currency.tpl" value=$order.discount}</td>
</tr>
<tr>
  <td valign="top">{$lng.lbl_coupon_saving}</td>
  <td valign="top">{include file="currency.tpl" value=$order.coupon_discount} ({$order.coupon})</td>
</tr>
<tr>
  <td valign="top">{$lng.lbl_shipping_cost}</td>
  <td valign="top">{include file="currency.tpl" value=$order.shipping_cost}</td>
</tr>
{if $order.applied_taxes.V}
<tr>
  <td valign="top">{$lng.lbl_including_vat_cart_total}</td>
  <td valign="top">{include file="currency.tpl" value=$order.total_vat}</td>
</tr>
{/if}
{if $order.applied_taxes.G}
<tr>
  <td valign="top">{$lng.lbl_tax_cost}</td>
  <td valign="top">{include file="currency.tpl" value=$order.tax}</td>
</tr>
{/if}
{if $order.applied_taxes.C}
<tr>
  <td valign="top">{$lng.lbl_gst}</td>
  <td valign="top">{include file="currency.tpl" value=$order.tax_gst}</td>
</tr>
<tr>
  <td valign="top">{$lng.lbl_pst}</td>
  <td valign="top">{include file="currency.tpl" value=$order.tax_pst}</td>
</tr>
{/if}
{if $order.giftcert_discount gt 0}
<tr>
  <td valign="top" class="LabelStyle" nowrap>{$lng.lbl_giftcert_discount}</td>
  <td valign="top">{include file="currency.tpl" value=$order.giftcert_discount}</td>
</tr>
{/if}
<tr>
  <td valign="top">{$lng.lbl_total}</td>
  <td valign="top">{include file="currency.tpl" value=$order.total}</td>
</tr>
{section name=rn loop=$order.reg_numbers}
{if %rn.first%}
<tr><td valign="top" colspan=2 class="LabelStyle" nowrap>
{$lng.lbl_registration_number}:
</td></tr>
{/if}
<tr><td valign="top" colspan=2 nowrap>
  {$order.reg_numbers[rn]}
</td></tr>
{/section}
<tr>
  <td valign="top" class=ProductDetails height="14"> </td>
  <td valign="top" class=ProductDetails height="14"> </td>
</tr>
{if $order.applied_giftcerts}
<tr>
  <td colspan=2 class="LabelStyle">{$lng.lbl_applied_giftcerts}:</td>
</tr>
{section name=gc loop=$order.applied_giftcerts}
<tr>
  <td valign="top">{$order.applied_giftcerts[gc].giftcert_id}:</td>
  <td valign="top">{include file="currency.tpl" value=$order.applied_giftcerts[gc].giftcert_cost}</td>
</tr>
{/section}
<tr>
  <td colspan=2 height="10"> </td>
</tr>
{/if}
<tr>
  <td valign="top" class="ProductDetailsTitle">{$lng.lbl_customer_info}</td>
  <td valign="top" class="ProductDetailsTitle"> </td>
</tr>
<tr>
  <td class=Line height="1">[img]{$ImagesDir}/spacer.gif[/img]</td>
  <td class=Line height="1">[img]{$ImagesDir}/spacer.gif[/img]</td>
</tr>
<tr>
  <td valign="top" class=ProductDetails></td>
  <td valign="top" class=ProductPriceSmall></td>
</tr>
<tr>
  <td valign="top" class=ProductDetails height="10"> </td>
  <td valign="top" class=ProductPriceSmall height="10"> </td>
</tr>
<tr valign="top">
  <td>{$lng.lbl_title}</td>
  <td>{$customer.title}</td>
</tr>
<tr valign="top">
  <td>{$lng.lbl_first_name}</td>
  <td>{$customer.firstname}</td>
</tr>
<tr valign="top">
  <td>{$lng.lbl_last_name}</td>
  <td>{$customer.lastname}</td>
</tr>
<tr valign="top">
  <td>{$lng.lbl_company}</td>
  <td>{$customer.company}</td>
</tr>
<tr valign="top">
  <td colspan=2>{$lng.lbl_billing_address}:</a></td>
</tr>
<tr>
  <td valign="top">  {$lng.lbl_address}</td>
  <td valign="top">{$customer.b_address}</td>
</tr>
<tr>
  <td valign="top">  {$lng.lbl_zip_code}</td>
  <td valign="top">{$customer.b_zipcode}</td>
</tr>
<tr>
  <td valign="top">  {$lng.lbl_city}</td>
  <td valign="top">{$customer.b_city}</td>
</tr>
<tr>
  <td valign="top">  {$lng.lbl_state}</td>
  <td valign="top">{$customer.b_statename}</td>
</tr>
<tr>
  <td valign="top">  {$lng.lbl_country}</td>
  <td valign="top">{$customer.b_countryname}</td>
</tr>
<tr valign="top">
  <td colspan=2>{$lng.lbl_shipping_address}:</a></td>
</tr>
<tr>
  <td valign="top">  {$lng.lbl_address}</td>
  <td valign="top">{$customer.s_address}</td>
</tr>
<tr>
  <td valign="top">  {$lng.lbl_zip_code}</td>
  <td valign="top">{$customer.s_zipcode}</td>
</tr>
<tr>
  <td valign="top">  {$lng.lbl_city}</td>
  <td valign="top">{$customer.s_city}</td>
</tr>
<tr>
  <td valign="top">  {$lng.lbl_state}</td>
  <td valign="top">{$customer.s_statename}</td>
</tr>
<tr>
  <td valign="top">  {$lng.lbl_country}</td>
  <td valign="top">{$customer.s_countryname}</td>
</tr>
<tr>
  <td valign="top">{$lng.lbl_phone}</td>
  <td valign="top">{$customer.phone}</td>
</tr>
<tr>
  <td valign="top">{$lng.lbl_fax}</td>
  <td valign="top">{$customer.fax}</td>
</tr>
<tr>
  <td valign="top">{$lng.lbl_web_site}</td>
  <td valign="top">{$customer.url}</td>
</tr>
<tr>
  <td valign="top">{$lng.lbl_email}</td>
  <td valign="top">{$customer.email}</td>
</tr>
<tr>
  <td colspan="2" valign="top" height="10"> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="1" valign="top"><span>
<form action="order.php" method=post>



{$lng.lbl_status}:

{if $usertype eq "A"}
<select name=status>
<option {if $order.status eq "P"}selected{/if} value="P">{$lng.lbl_processed}</option>
<option {if $order.status eq "Q"}selected{/if} value="Q">{$lng.lbl_queued}</option>
<option {if $order.status eq "w"}selected{/if} value="w">{$lng.lbl_warehouse1}</option>
<option {if $order.status eq "wR"}selected{/if} value="wR">{$lng.lbl_warehouse2}</option>
<option {if $order.status eq "S"}selected{/if} value="S">{$lng.lbl_shipped}</option>
<option {if $order.status eq "B"}selected{/if} value="B">{$lng.lbl_backordered}</option>
<option {if $order.status eq "C"}selected{/if} value="C">{$lng.lbl_complete}</option>
<option {if $order.status eq "H"}selected{/if} value="H">{$lng.lbl_hold}</option>
<option {if $order.status eq "CA"}selected{/if} value="CA">{$lng.lbl_cancelled}</option>
<option {if $order.status eq "I"}selected{/if} value="I">{$lng.lbl_not_finished}</option>
<option {if $order.status eq "F"}selected{/if} value="F">{$lng.lbl_failed}</option>
<option {if $order.status eq "D"}selected{/if} value="D">{$lng.lbl_declined}</option></select>
{else}
{if $order.status eq "P"}{$lng.lbl_processed}{elseif $order.status eq "Q"}{$lng.lbl_queued}{elseif $order.status eq "W"}{$lng.lbl_warehouse1}{elseif $order.status eq "WR"}{$lng.lbl_warehouse2}{elseif $order.status eq "S"}{$lng.lbl_shipped}{elseif $order.status eq "B"}{$lng.lbl_backordered}{elseif $order.status eq "C"}{$lng.lbl_complete}{elseif $order.status eq "H"}{$lng.lbl_hold}{elseif $order.status eq "CA"}{$lng.lbl_cancelled}{elseif $order.status eq "I"}{$lng.lbl_not_finished}{elseif $order.status eq "F"}{$lng.lbl_failed}{elseif $order.status eq "D"}{$lng.lbl_declined}{/if}
{/if}



{$lng.lbl_tracking_number}:

<input type=text name=tracking value="{$order.tracking}">
{if $usertype eq "A"}



{$lng.lbl_order_details}:

<textarea name=details cols=60 rows=5>{$order.details}</text>
{/if}
{if $usertype ne "C"}



{$lng.lbl_order_notes}:

<textarea name=notes cols=60 rows=5>{$order.notes}</text>
{/if}
{if $usertype eq "A"}



<input type=submit value="{$lng.lbl_apply_changes}">

{$lng.txt_change_order_status}
{/if}
{if $usertype eq "P"}



<input type=submit value="{$lng.lbl_apply_changes}">

{$lng.txt_apply_changes}
{/if}
<input type=hidden name=mode value="status_change">
<input type=hidden name=orderid value={$order.orderid}>
</form>
{if $usertype eq "P" and $order.status ne "C"}
<form action="order.php" method=post>
<input type=hidden name=mode value="complete_order">
<input type=submit value="Complete order">

{$lng.txt_complete_order}
<input type=hidden name=orderid value={$order.orderid}>
</form>
{/if}
{assign var="postal_service" value=$order.shipping|truncate:3:"":true}
{if $active_modules.Order_Tracking ne ""}
{if $postal_service eq "UPS"}
{include file="modules/Order_Tracking/ups.tpl"}
{elseif $postal_service eq "USP"}
{include file="modules/Order_Tracking/usps.tpl"}
{elseif $postal_service eq "Fed"}
{include file="modules/Order_Tracking/fedex.tpl"}
{/if}
{/if}
</span>
</td>
</tr>
</table>
{/if}
{/capture}
{include file="dialog.tpl" title=$lng.lbl_order_details_label content=$smarty.capture.dialog extra="width=100%"}


Any thoughts are greatly appreciated!

B00MER 11-24-2003 09:44 PM

Your in the right direction,

Now you just need to edit func.php and update func_change_status() to adapt to these new statuses, especially if your needing to restock on a custom order status, send an email, etc.

anyhow, kudos! ;)

enge919 11-27-2003 09:59 PM

Thanks for the reply B00mer. I hope that I can find some time to actually try to implement it..

leon 12-13-2003 01:21 AM

Have you tested this out yet ?

enge919 12-13-2003 10:16 AM

I have not. The direction of things changed since this post and my partner pulled out so I again am the warehouse person and back to a 1 man operation (so no need to send myself a email) so I have not continued with this mod.

I'm sure if you continue with this post someone will help, I just havent got that far nor can I even find the time right now to figure it out.

If I come up with something I will definately post it here.

leon 12-13-2003 11:10 AM

It would be nice if you could finish the mod, think about the future, if everything is successful you will be needing it anyway, and you will have less time to finish it. :)

Anyway, even if you do recieve self mailed information, they are always great for tracking purposes, and to make sure applications are effectively running good.


All times are GMT -8. The time now is 08:45 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.