funkydunk |
10-31-2003 09:09 AM |
try this: not tested it for a while (BACKUP FIRST) but, new main/history_order.tpl
Code:
{* $Id: history_order.tpl,v 1.25.2.1 2003/04/04 12:08:59 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"}
<form action="order.php" method=post>
<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}/orangespacer.gif[/img]</td>
<td class=Line height="1">[img]{$ImagesDir}/orangespacer.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|escape} #{$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">{if $usertype eq "A" or $usertype eq "P"}<input type=hidden name=prod[{$smarty.section.prod_num.index}] value="{$products[prod_num].productid}"><input type=text name=amount[{$smarty.section.prod_num.index}] value="{$products[prod_num].amount}">
{else}{$products[prod_num].amount} item(s){/if}</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}/orangespacer.gif[/img]</td>
<td class=Line height="1">[img]{$ImagesDir}/orangespacer.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">{if $usertype eq "A" or $usertype eq "P"}<input type=text name=payment_method value="{$order.payment_method}">
{else}{$order.payment_method}{/if}</td>
</tr>
<tr>
<td valign="top">{$lng.lbl_delivery}</td>
<td valign="top">{if $usertype eq "A" or $usertype eq "P"}<input type=text name=shippingid value="{$order.shipping}">
{else}{$order.shipping}{/if}</td>
</tr>
<tr>
<td valign="top">{$lng.lbl_subtotal}</td>
<td valign="top">{if $usertype eq "A" or $usertype eq "P"}<input type=text name=subtotal value="{$order.subtotal}">
{else}{include file="currency.tpl" value=$order.subtotal}{/if}</td>
</tr>
<tr>
<td valign="top">{$lng.lbl_shipping_cost}</td>
<td valign="top">{if $usertype eq "A" or $usertype eq "P"}<input type=text name=shipping value="{$order.shipping_cost}">
{else}{include file="currency.tpl" value=$order.shipping_cost}{/if}</td>
</tr>
<tr>
<td valign="top">{$lng.lbl_tax_cost}</td>
<td valign="top">{if $usertype eq "A" or $usertype eq "P"}<input type=text name=tax value="{$order.tax}">
{else}{include file="currency.tpl" value=$order.tax}{/if}</td>
</tr>
<tr>
<td valign="top">{$lng.lbl_discount}</td>
<td valign="top">{if $usertype eq "A" or $usertype eq "P"}<input type=text name=discount value="{$order.discount}">
{else}{include file="currency.tpl" value=$order.discount}{/if}</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>
{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">{if $usertype eq "A" or $usertype eq "P"}<input type=text name=total value="{$order.total}">
{else}{include file="currency.tpl" value=$order.total}{/if}</td>
</tr>
<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}/orangespacer.gif[/img]</td>
<td class=Line height="1">[img]{$ImagesDir}/orangespacer.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>{if $usertype eq "A" or $usertype eq "P"}<input type=text name=firstname value="{$customer.firstname}">
{else}{$customer.firstname}{/if}</td>
</tr>
<tr valign="top">
<td>{$lng.lbl_last_name}</td>
<td>{if $usertype eq "A" or $usertype eq "P"}<input type=text name=lastname value="{$customer.lastname}">
{else}{$customer.lastname}{/if}</td>
</tr>
<tr valign="top">
<td>{$lng.lbl_company}</td>
<td>{if $usertype eq "A" or $usertype eq "P"}<input type=text name=company value="{$customer.company}">
{else}{$customer.company}{/if}</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">{if $usertype eq "A" or $usertype eq "P"}<input type=text name=b_address value="{$customer.b_address}">
{else}{$customer.b_address}{/if}</td>
</tr>
<tr>
<td valign="top">{$lng.lbl_zip_code}</td>
<td valign="top">{if $usertype eq "A" or $usertype eq "P"}<input type=text name=b_zipcode value="{$customer.b_zipcode}">
{else}{$customer.b_zipcode}{/if}</td>
</tr>
<tr>
<td valign="top">{$lng.lbl_city}</td>
<td valign="top">{if $usertype eq "A" or $usertype eq "P"}<input type=text name=b_city value="{$customer.b_city}">
{else}{$customer.b_city}{/if}</td>
</tr>
<tr>
<td valign="top">{$lng.lbl_state}</td>
<td valign="top">{if $usertype eq "A" or $usertype eq "P"}<input type=text name=b_statename value="{$customer.b_statename}">
{else}{$customer.b_statename}{/if}</td>
</tr>
<tr>
<td valign="top">{$lng.lbl_country}</td>
<td valign="top">{if $usertype eq "A" or $usertype eq "P"}<input type=text name=b_countryname value="{$customer.b_countryname}">
{else}{$customer.b_countryname}{/if}</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">{if $usertype eq "A" or $usertype eq "P"}<input type=text name=s_address value="{$customer.s_address}">
{else}{$customer.s_address}{/if}</td>
</tr>
<tr>
<td valign="top">{$lng.lbl_zip_code}</td>
<td valign="top">{if $usertype eq "A" or $usertype eq "P"}<input type=text name=s_zipcode value="{$customer.s_zipcode}">
{else}{$customer.s_zipcode}{/if}</td>
</tr>
<tr>
<td valign="top">{$lng.lbl_city}</td>
<td valign="top">{if $usertype eq "A" or $usertype eq "P"}<input type=text name=s_city value="{$customer.s_city}">
{else}{$customer.s_city}{/if}</td>
</tr>
<tr>
<td valign="top">{$lng.lbl_state}</td>
<td valign="top">{if $usertype eq "A" or $usertype eq "P"}<input type=text name=s_statename value="{$customer.s_statename}">
{else}{$customer.s_statename}{/if}</td>
</tr>
<tr>
<td valign="top">{$lng.lbl_country}</td>
<td valign="top">{if $usertype eq "A" or $usertype eq "P"}<input type=text name=s_countryname value="{$customer.s_countryname}">
{else}{$customer.s_countryname}{/if}</td>
</tr>
<tr>
<td valign="top">{$lng.lbl_phone}</td>
<td valign="top">{if $usertype eq "A" or $usertype eq "P"}<input type=text name=phone value="{$customer.phone}">
{else}{$customer.phone}{/if}</td>
</tr>
<tr>
<td valign="top">{$lng.lbl_fax}</td>
<td valign="top">{if $usertype eq "A" or $usertype eq "P"}<input type=text name=fax value="{$customer.fax}">
{else}{$customer.fax}{/if}</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">{if $usertype eq "A" or $usertype eq "P"}<input type=text name=email value="{$customer.email}">
{else}{$customer.email}{/if}</td>
</tr>
<tr>
<td colspan="2" valign="top" height="10"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="1" valign="top"><span>
{$lng.lbl_status}:
{if $usertype eq "A"}
<select name=status>
<option {if $order.status eq "I"}selected{/if} value="I">{$lng.lbl_not_finished}</option>
<option {if $order.status eq "Q"}selected{/if} value="Q">{$lng.lbl_queued}</option>
<option {if $order.status eq "P"}selected{/if} value="P">{$lng.lbl_processed}</option>
<option {if $order.status eq "D"}selected{/if} value="D">{$lng.lbl_declined}</option>
<option {if $order.status eq "B"}selected{/if} value="B">{$lng.lbl_backordered}</option>
<option {if $order.status eq "F"}selected{/if} value="F">{$lng.lbl_failed}</option>
<option {if $order.status eq "C"}selected{/if} value="C">{$lng.lbl_complete}</option>
</select>
{else}
{if $order.status eq "I"}{$lng.lbl_not_finished}{elseif $order.status eq "Q"}{$lng.lbl_queued}{elseif $order.status eq "P"}{$lng.lbl_processed}{elseif $order.status eq "D"}{$lng.lbl_declined}{elseif $order.status eq "B"}{$lng.lbl_backordered}{elseif $order.status eq "F"}{$lng.lbl_failed}{elseif $order.status eq "C"}{$lng.lbl_complete}{/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}</textarea>
{/if}
{if $usertype ne "C"}
{$lng.lbl_order_notes}:
<textarea name=notes cols=60 rows=5>{$order.notes}</textarea>
{/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%"}
new include/order.php:
Code:
<?
/*****************************************************************************\
+-----------------------------------------------------------------------------+
| X-Cart |
| Copyright (c) 2001-2002 Ruslan R. Fazliev. All rights reserved. |
+-----------------------------------------------------------------------------+
| The Ruslan R. Fazliev forbids, under any circumstances, the unauthorized |
| reproduction of software or use of illegally obtained software. Making |
| illegal copies of software is prohibited. Individuals who violate copyright |
| law and software licensing agreements may be subject to criminal or civil |
| action by the owner of the copyright. |
| |
| 1. It is illegal to copy a software, and install that single program for |
| simultaneous use on multiple machines. |
| |
| 2. Unauthorized copies of software may not be used in any way. This applies |
| even though you yourself may not have made the illegal copy. |
| |
| 3. Purchase of the appropriate number of copies of a software is necessary |
| for maintaining legal status. |
| |
| DISCLAIMER |
| |
| THIS SOFTWARE IS PROVIDED BY Ruslan R. Fazliev ``AS IS'' AND ANY |
| EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| DISCLAIMED. IN NO EVENT SHALL Ruslan R. Fazliev OR ITS |
| CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
| OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
| ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| |
| The Initial Developer of the Original Code is Ruslan R. Fazliev. |
| Portions created by Ruslan R. Fazliev are Copyright (C) 2001-2002 |
| Ruslan R. Fazliev. All Rights Reserved. |
+-----------------------------------------------------------------------------+
\*****************************************************************************/
#
# $Id: order.php,v 1.19 2002/12/10 08:57:10 sdg Exp $
#
require "../smarty.php";
require "../config.php";
require "./auth.php";
require "../include/security.php";
#
# Collect infos about ordered products
#
require "../include/history_order.php";
$order = $order_data["order"];
$userinfo = $order_data["userinfo"];
$products = $order_data["products"];
$giftcerts = $order_data["giftcerts"];
if ($mode == "status_change") {
# Update order
#
func_change_order_status($orderid, $status);
// db_query("update $sql_tbl[orders] set tracking='$tracking', notes='$notes', details='".text_crypt($details)."' where orderid='$orderid'");
db_query("update $sql_tbl[orders] set tracking='$tracking', total='$total', subtotal='$subtotal', discount='$discount', shipping_cost='$shipping', tax='$tax', firstname='$firstname', lastname='$lastname', company='$company', b_address='$b_address', b_city='$b_city', b_state='$b_state', b_country='$b_country', b_zipcode='$b_zipcode', s_address='$s_address', s_city='$s_city', s_state='$s_state', s_country='$s_country', s_zipcode='$s_zipcode', phone='$phone', email='$email', fax='$fax', notes='$notes', details='".text_crypt($details)."' where orderid='$orderid'");
// echo "update $sql_tbl[orders] set tracking='$tracking', total='$total', subtotal='$subtotal', discount='$discount', shipping_cost='$shipping', tax='$tax', firstname='$firstname', lastname='$lastname', company='$company', b_address='$b_address', b_city='$b_city', b_state='$b_state', b_country='$b_country', b_zipcode='$b_zipcode', s_address='$s_address', s_city='$s_city', s_state='$s_state', s_country='$s_country', s_zipcode='$s_zipcode', phone='$phone', email='$email', fax='$fax', notes='$notes', details='".text_crypt($details)."' where orderid='$orderid'";
// loop through the products and amend the quantity
for ($n=0; $n <= count($prod);$n++){
db_query ("update $sql_tbl[order_details] set amount = '$amount[$n] ' where orderid = '$orderid' AND productid = '$prod[$n]'");
}
header("Location: order.php?orderid=$orderid&mode=status_changed");
exit;
}
#
# Delete order
#
if ($mode=="delete") {
db_query("DELETE FROM $sql_tbl[orders] WHERE orderid='$orderid'");
db_query("DELETE FROM $sql_tbl[order_details] WHERE orderid='$orderid'");
db_query("DELETE FROM $sql_tbl[giftcerts] WHERE orderid='$orderid'");
db_query("DELETE FROM $sql_tbl[partner_payment] WHERE orderid='$orderid'");
db_query("DELETE FROM $sql_tbl[subscription_customers] WHERE orderid='$orderid'");
header("Location: orders.php?".$query_string);
exit;
}
$smarty->assign("main","history_order");
@include "../modules/gold_display.php";
$smarty->display("admin/home.tpl");
?>
|