Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Step-By-Step Manual Order


frankl

Recommended Posts

Hello Gentlemen,

 

I was just searching the forum and found that you guys are getting the same error that I was.. I'm not sure about you guys but I only get the error when I attempt to change the Payment Method when I haven't added any items to the order.  I'm looking around the code to see if I can fix it so that the error wont happen when the order is empty.  In the meantime, just make sure you add products before you change the Paymetn Method and you should be cool..

 

Good Luck!

 

Rich Morgan

DB Microfiber

Premium Grade Microfiber for Your Home or Car

www.dbmicrofiber.com

 

Hey Y'All,

 

I'm getting the same thing. Rich, you are right that if you add products first, it doesn't give you that error. Still, it's a pain.

 

Any ideas on this problem would be greatly appreciated.

 

Regards,

 

GoFish

Link to comment
Share on other sites

  • Replies 476
  • Created
  • Last Reply

Top Posters In This Topic

To avoid the error when no products have ben added, I updated file edit_orders.php to skip the product update when no products have been added.

 

Around line 255 you'll find ...

 

  // Update Products
 $RunningSubTotal = 0;
 $RunningTax = 0;

After this I added....

 

        $products_exist=false;
       if (is_array($update_products)) {
         $products_exist = (count($update_products) > 0 ? $products_exist=true : $products_exist=false);
       }

       if($products_exist==true) {

The next line is...

 

 	 foreach($update_products as $orders_products_id => $products_details)
	 {
   // Update orders_products Table

Then *BEFORE*...

 

if ($order_updated)

around line 378 I closed the if statement with...

 

}

Link to comment
Share on other sites

hello every1 i just started using this mod but i have one question that im not sure what to do with... i want to be able to process credit cards imidietly over the phone...i use check2out feature....

 

im a bit a newbie

 

the only thing i see in my manual order is as follows

-bank transfer payments

-paypal

-check money order

-purchase order

 

-how do i add credit card on the list for live processing???i hope some1 can help...

this feature has helped me a lot and alot of my customers are showing it by making me more money :D

 

chahine

Pegasus Polo Gear is a shop commited to achieving excellence in providing the finest polo products, equipements and apparell at the best price. We guaranty a superior quality, value and service.
Link to comment
Share on other sites

  • 3 weeks later...
After further testing, I found my problem. I removed the languages that I dont use and it appeared to solve my problem. I guess my question is different now. Is there a setting for language to use with this mod? (Just in case I do support other languages... at the moment it's no biggie)

 

Thanks,

 

M

 

 

Have same problem, but my problem was NOT solved removing the language files I'm not using. It's a great contribution, but this problem is very strange!! Hope someone can really find the error!!

 

Best Regard

Lars

Link to comment
Share on other sites

  • 3 weeks later...

My problem (which I saw others present on another thread) is after installing version 1.60. This was supposed to be posted because of the product selection problems.

 

When I try to edit an order, I get this error:

 

1146 - Table 'crystal_storedb.orders_ship_methods' doesn't exist

 

select ship_method from orders_ship_methods

 

[TEP STOP]

 

Is version 1.60 made for the CRE loaded oscommerce version only???? I say that because the zip file is named "OrderEditor1.60cre6.1a".

 

I'm going to revert back to 1.59, but could someone please fix the Add Products section and then repost?

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...
Hi,

 

I have just loaded this contrib and the associated Order Editor.  I have one concern.  The file in step #9 form_check.js.php did not exist in the download.  Do I need it?  If so, where can I get it from? Thanks.

 

 

Hey - I found the problem all on my own. I'm all set!

Link to comment
Share on other sites

My oh MY What a great contrib. Thanks to all of you that made the initiall package and all those who worked to get the fixes right.

 

I do have an issue though that I have not seen in this thread. The contrib works great...no issues. Except that now when a user creates an account on there own (through the usual avenues not admin). The welcome email it sends out appears to have actually appended itself to the welcome email being generated with the Password in it from admin. I do not know why it has done this. The email below was generated after making an account through the store. But it started to double up like this when I installed this contribution. Any one having this issue or have a suggestion for me?

Thanks

 

 

Dear Testy

 

We welcome you to Famous Fashions Found.

 

You can now take part in the various services we have to offer you. Some of these services include:

 

 

Permanent Cart - Any products added to your online cart remain there until you remove them, or check them out.

 

Address Book - We can now deliver your products to another address other than yours! This is perfect to send birthday gifts direct to the birthday-person themselves.

 

Order History - View your history of purchases that you have made with us.

 

Products Reviews - Share your opinions on products with our other customers.

 

For help with any of our online services, please email the store-owner: [email protected].

 

Note: This email address was given to us by one of our customers. If you did not signup to be a member, please send an email to [email protected].

We welcome you to Famous Fashions Found.

 

You can now take part in the various services we have to offer you. Some of these services include:

 

notice here it repeats

 

Permanent Cart - Any products added to your online cart remain there until you remove them, or check them out.

 

Address Book - We can now deliver your products to another address other than yours! This is perfect to send birthday gifts direct to the birthday-person themselves.

 

Order History - View your history of purchases that you have made with us.

 

Products Reviews - Share your opinions on products with our other customers.

 

For help with any of our online services, please email the store-owner: [email protected].

 

Note: This email address was given to us by one of our customers. If you did not signup to be a member, please send an email to [email protected].

 

Thanks for any hellp you can give

Thanks in advance for your help!

Stephen

Link to comment
Share on other sites

Hello all,

 

I just installed your contribution step-by-step manual entry. I can manually add customers and orders. It all works fine ... except.

 

I have one download product. Now, with every order for, say a hat, each Order Confirmation Page for every product includes a link, example "hat," that links to my download item!!!

 

Any suggestions????

 

Marty

Link to comment
Share on other sites

Get this error trying to create an account:

 

1054 - Unknown column 'new_value' in 'field list'

 

insert into orders_status_history (orders_id, new_value, orders_status_id, date_added) values ('78', '1', '1', now())

 

[TEP STOP]

Link to comment
Share on other sites

Please help,

I have browsed through this thread and seen this error arise in a couple of situations... I f someone has fixed this error

Fatal error: Cannot redeclare tep_db_connect() (previously declared in /var/www/html/store/admin/includes/functions/database.php:13) in /var/www/html/store/admin/includes/functions/database.php on line 13

 

I sure could use a fix for it.

 

I have a live shop and it has been up and running fine. I have added sevearal mod\contribs...one of which is this one. I have had no problems so far. it installed nicely and worked great. a couple of weeks ago. I am afraid the store owner was trying to modify his stores php files (but he does not have a clue). I now have that error and cannot for the life of me. locate an issue. I have read other places that this could be caused by a call to application top more than once in a php file, does any one agree? I cant seem to find anything that looks strange. Help please.....

 

:(

 

Stephen

moewebdesign.com

abilityonline.com

Thanks in advance for your help!

Stephen

Link to comment
Share on other sites

Stephen,

 

Lines 13 and 14 should read as follows:

 

function tep_db_connect($server = DB_SERVER, $username = DB_SERVER_USERNAME, $password = DB_SERVER_PASSWORD, $database = DB_DATABASE, $link = 'db_link') {

  global $$link;

 

do they?

Edited by RooconHosting
Link to comment
Share on other sites

Stephen,

 

Lines 13 and 14 should read as follows:

do they?

 

 

thanks for the quick reply, here is line 13-14

 

function tep_db_connect($server = DB_SERVER, $username = DB_SERVER_USERNAME, $password = DB_SERVER_PASSWORD, $database = DB_DATABASE, $link = 'db_link') {
   global $$link;

 

thanks again

Thanks in advance for your help!

Stephen

Link to comment
Share on other sites

  • 2 weeks later...

i just installed this contrib, and every seemed to go well. however when i logged into the admin and clicked on create account, it came up with a blank screen. same for create order. now, i'm very new to php, and i tried to follow the install text to the letter.

 

does anyone know what i did wrong? :(

Link to comment
Share on other sites

When adding a Manual Order it places the NOTIFICATION as "X" for NONE.

 

In order to NOTIFY the member you must do an extra step, like place comments then UPDATE.

 

Kind of inconvenient...

 

Suggestion: On initial Manual Order entry - autonotify the member.

Link to comment
Share on other sites

with basic php/htlm knowledge u can quickly change that. I do not have access to my site via ftp tonight, otherwise Id tell ya how, but its very simple to change the default appearance of any option on a form. If you open up the appropriate page, it should be realatively easy to figure out with minimal php knowledge.

Link to comment
Share on other sites

Hello,

 

I have just updated to ver 1.61 - no problems there and all works great. However, I'm still trying to figure out how (as admin & owner of the store) to login as a customer to complete the order? Maybe I'm missing something completely here, and probably very simple!

 

Back on page 5 of this thread, I followed the code inserts by MaryAnn, and throughout most of the thread and not getting it.

 

I understand the security issues, but after creating an account, how do I log back in and compete the sale? One way is to create the customer account, and use the admin's email as customer's email, but when you process phone orders all the time, this is not always possible. Is there a default password for newly created accounts? I still want the customer to receive the welcome email and all that jazz, but when I process 3 out of 5 orders over the phone, this is a life saver.

 

Any ideas please?

 

Thanks,

Greg

Link to comment
Share on other sites

  • 4 weeks later...

Hi Folks,

 

Great contribution. After reading through all posts, i don't seem to find a fix for the prob i am experiencing(Everything else is working fine).

 

I am able to add a new cistomer manually without a hitch but when adding an order and clicking the 'UPDATE' (To View CC Fields or View PO Fields ) submit, the address 'Suburb' value disappears from all the addresses and subsequently does not sppear on invoices and packing slip.

 

Has someone experienced this before and know why this is happening?

 

Many thanks in advance.

 

Regards,

 

Brad

Link to comment
Share on other sites

The contribution includes a link to 'Add a new product' to an order, has anyone modified the contribution to allow the deletion of products/product options?

 

I know this is an old post but for the record ,if it is the same as edit orders then, to delete a product just set the quantity to zero.

Edited by radders
Link to comment
Share on other sites

Same thing is happening with me. I thought maybe I did something wrong but I guess its part of the contribution. I would like to know if anyone found a fix for the funky page in admin (breaking out of the links box in the admin) thanks

 

 

Just a note on this mod.  Very usefull and working great!  Added a few extra things along the way as well like many of you.

 

I did however have one thing happen (which still does happen but it is so minor it was not worth investigating any further) when running on an SSL connection.

 

Has anyone had the Create Order make the screen go real funky??  I did, and the fix was to change the HTTPS = 'on' to 'off' in both the Creat_Account.php and the Create_Order.php files.  It does not affect the proccessing and the sstem still stys on my SSL cert.

 

Additionally, the minor issue mentioned above has to do with the border and background color for the column_left.php file.  It's like it's not using the stylesheet, but I know it is.  So like I said it aint no big thang!

 

Just thought I'd mention it.

 

Good work to all who took part in this mod.  Wonderfull thing this net of ours!

Link to comment
Share on other sites

:) Does anyone know how I could do this?

Would it be an easy change to do the following to the manual order process?

 

Right now the default dropdown boxes are:

 

----------------------------------------------------------

FOR "PAYMENT METHODS":

 

    (1) 'Bank Transfer Payments'

    (2) 'PayPal'

    (3) 'Check/Money Order'

    (4) 'Purchase Order'

 

FOR "SHIPPING METHODS":

 

    (1) 'FedEx Priority to Canada'

    (2) 'FedEx Priority to USA'

    (3) 'FedEx Priority International'

    (4) 'Canada Xpresspost Post shipping'

    (5) 'Canada USA Xpresspost shipping USA'

    (6) 'Canada Post Standard Airmail shipping'

-----------------------------------------------------------

 

Those don't apply to our store.  Can you change them to:

 

"PAYMENT METHODS":

 

    (1) 'Credit Card'

    (2) 'Check/Money Order'

    (3) 'Wire/Bank Transfer'

    (4) 'PayPal'

 

FOR "SHIPPING METHODS":

 

    (1) 'MANUAL ORDER - UPS Ground'

    (2) 'MANUAL ORDER - UPS 3 Day Select'

    (3) 'MANUAL ORDER - UPS 2nd Day Air'

    (4) 'MANUAL ORDER - UPS Next Day Air Saver'

    (5) 'MANUAL ORDER - USPS Priority Mail'

    (6) 'MANUAL ORDER - USPS Express Mail'

 

----------------------------------------------------------------------

this is a request from a client that is using this contribution.. Very pleased with it I might add. If any one has the knowledge they would like to share you can email me. Please, and thank you in advance

 

[email protected]

Thanks in advance for your help!

Stephen

Link to comment
Share on other sites

Hi folks,

 

Hope someone can assist.

 

After adding a product manually and clicking 'Update', I am losing the 'Suburb' field. After reading through the posts this doesn't seem to be a common problem thus is likely to be as a result of a mod.

 

Can anyone perhaps advise where I should look to resolve this issue? I'd really appreciate any guidance/advice.

 

Below is my current edit_order.php:

 

<?php

/*

$Id: edit_orders.php,v 1.2 2003/08/08 13:50:00 jwh Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

 

Written by Jonathan Hilgeman of SiteCreative.com ([email protected])

 

Version History

---------------------------------------------------------------

08/08/03

1.2a - Fixed a query problem on osC 2.1 stores.

 

08/08/03

1.2 - Added more recommendations to the instructions.

Added "Customer" fields for editing on osC 2.2.

Corrected "Billing" fields so they update correctly.

Added Company and Suburb Fields.

Added optional shipping tax variable.

First (and hopefully last) fix for currency formatting.

 

08/08/03

1.1 - Added status editing (fixed order status bug from 1.0).

Added comments editing. (with compatibility for osC 2.1)

Added customer notifications.

Added some additional information to the instructions file.

Fixed bug with product names containing single quotes.

 

08/07/03

1.0 - Original Release.

 

To Do in Version 1.3

---------------------------------------------------------------

 

Note from the author

---------------------------------------------------------------

This tool was designed and tested on osC 2.2 Milestone 2.2,

but may work for other versions, as well. Most database changes

were minor, so getting it to work on other versions may just

need some tweaking. Hope this helps make your life easier!

 

- Jonathan Hilgeman, August 7th, 2003

*/

 

require('includes/application_top.php');

 

require(DIR_WS_CLASSES . 'currencies.php');

$currencies = new currencies();

 

include(DIR_WS_CLASSES . 'order.php');

 

// New "Status History" table has different format.

$OldNewStatusValues = (tep_field_exists(TABLE_ORDERS_STATUS_HISTORY, "old_value") && tep_field_exists(TABLE_ORDERS_STATUS_HISTORY, "new_value"));

$CommentsWithStatus = tep_field_exists(TABLE_ORDERS_STATUS_HISTORY, "comments");

$SeparateBillingFields = tep_field_exists(TABLE_ORDERS, "billing_name");

 

// Optional Tax Rate/Percent

$AddShippingTax = "0.0"; // e.g. shipping tax of 17.5% is "17.5"

 

$orders_statuses = array();

$orders_status_array = array();

$orders_status_query = tep_db_query("select orders_status_id, orders_status_name from " . TABLE_ORDERS_STATUS . " where language_id = '" . (int)$languages_id . "'");

while ($orders_status = tep_db_fetch_array($orders_status_query)) {

$orders_statuses[] = array('id' => $orders_status['orders_status_id'],

'text' => $orders_status['orders_status_name']);

$orders_status_array[$orders_status['orders_status_id']] = $orders_status['orders_status_name'];

}

 

$orders_ship_method = array();

$orders_ship_method_array = array();

$orders_ship_method_query = tep_db_query("select ship_method from orders_ship_methods");

while ($orders_ship_methods = tep_db_fetch_array($orders_ship_method_query)) {

$orders_ship_method[] = array('id' => $orders_ship_methods['ship_method'],

'text' => $orders_ship_methods['ship_method']);

$orders_ship_method_array[$orders_ship_methods['ship_method']] = $orders_ship_methods['ship_method'];

}

 

$orders_pay_method = array();

$orders_pay_method_array = array();

$orders_pay_method_query = tep_db_query("select pay_method from orders_pay_methods");

while ($orders_pay_methods = tep_db_fetch_array($orders_pay_method_query)) {

$orders_pay_method[] = array('id' => $orders_pay_methods['pay_method'],

'text' => $orders_pay_methods['pay_method']);

$orders_pay_method_array[$orders_pay_methods['pay_method']] = $orders_pay_methods['pay_method'];

}

 

$action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : 'edit');

 

if (tep_not_null($action)) {

switch ($action) {

 

// Update Order

case 'update_order':

 

$oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);

$order = new order($oID);

$status = tep_db_prepare_input($HTTP_POST_VARS['status']);

$comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);

 

 

// Update Order Info

$UpdateOrders = "update " . TABLE_ORDERS . " set

customers_name = '" . tep_db_input(stripslashes($update_customer_name)) . "',

customers_company = '" . tep_db_input(stripslashes($update_customer_company)) . "',

customers_street_address = '" . tep_db_input(stripslashes($update_customer_street_address)) . "',

customers_suburb = '" . tep_db_input(stripslashes($update_customer_suburb)) . "',

customers_city = '" . tep_db_input(stripslashes($update_customer_city)) . "',

customers_state = '" . tep_db_input(stripslashes($update_customer_state)) . "',

customers_postcode = '" . tep_db_input($update_customer_postcode) . "',

customers_country = '" . tep_db_input(stripslashes($update_customer_country)) . "',

customers_telephone = '" . tep_db_input($update_customer_telephone) . "',

customers_email_address = '" . tep_db_input($update_customer_email_address) . "',";

 

if($SeparateBillingFields)

{

$UpdateOrders .= "billing_name = '" . tep_db_input(stripslashes($update_billing_name)) . "',

billing_company = '" . tep_db_input(stripslashes($update_billing_company)) . "',

billing_street_address = '" . tep_db_input(stripslashes($update_billing_street_address)) . "',

billing_suburb = '" . tep_db_input(stripslashes($update_billing_suburb)) . "',

billing_city = '" . tep_db_input(stripslashes($update_billing_city)) . "',

billing_state = '" . tep_db_input(stripslashes($update_billing_state)) . "',

billing_postcode = '" . tep_db_input($update_billing_postcode) . "',

billing_country = '" . tep_db_input(stripslashes($update_billing_country)) . "',";

}

 

$UpdateOrders .= "delivery_name = '" . tep_db_input(stripslashes($update_delivery_name)) . "',

delivery_company = '" . tep_db_input(stripslashes($update_delivery_company)) . "',

delivery_street_address = '" . tep_db_input(stripslashes($update_delivery_street_address)) . "',

delivery_suburb = '" . tep_db_input(stripslashes($update_delivery_suburb)) . "',

delivery_city = '" . tep_db_input(stripslashes($update_delivery_city)) . "',

delivery_state = '" . tep_db_input(stripslashes($update_delivery_state)) . "',

delivery_postcode = '" . tep_db_input($update_delivery_postcode) . "',

delivery_country = '" . tep_db_input(stripslashes($update_delivery_country)) . "',

payment_method = '" . tep_db_input($update_info_payment_method) . "',

account_name = '" . tep_db_input($account_name) . "',

account_number = '" . tep_db_input($account_number) . "',

po_number = '" . tep_db_input($po_number) . "',

cc_type = '" . tep_db_input($update_info_cc_type) . "',

cc_owner = '" . tep_db_input($update_info_cc_owner) . "',";

 

if(substr($update_info_cc_number,0,8) != "(Last 4)")

$UpdateOrders .= "cc_number = '$update_info_cc_number',";

 

$UpdateOrders .= "cc_expires = '$update_info_cc_expires',

orders_status = '" . tep_db_input($status) . "'";

 

if(!$CommentsWithStatus)

{

$UpdateOrders .= ", comments = '" . tep_db_input($comments) . "'";

}

 

$UpdateOrders .= " where orders_id = '" . tep_db_input($oID) . "';";

 

tep_db_query($UpdateOrders);

 

 

$Query1 = "update orders set last_modified = now() where orders_id = '" . tep_db_input($oID) . "';";

tep_db_query($Query1);

 

$order_updated = true;

 

 

$check_status_query = tep_db_query("select customers_name, customers_email_address, orders_status, date_purchased from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");

$check_status = tep_db_fetch_array($check_status_query);

 

// Update Status History & Email Customer if Necessary

if ($order->info['orders_status'] != $status)

{

// Notify Customer

$customer_notified = '0';

if (isset($HTTP_POST_VARS['notify']) && ($HTTP_POST_VARS['notify'] == 'on'))

{

$notify_comments = '';

if (isset($HTTP_POST_VARS['notify_comments']) && ($HTTP_POST_VARS['notify_comments'] == 'on')) {

$notify_comments = sprintf(EMAIL_TEXT_COMMENTS_UPDATE, $comments) . "\n\n";

}

$email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);

tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

$customer_notified = '1';

}

 

// "Status History" table has gone through a few

// different changes, so here are different versions of

// the status update.

 

// NOTE: Theoretically, there shouldn't be a

// orders_status field in the ORDERS table. It

// should really just use the latest value from

// this status history table.

 

if($CommentsWithStatus)

{

tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . "

(orders_id, orders_status_id, date_added, customer_notified, comments)

values ('" . tep_db_input($oID) . "', '" . tep_db_input($status) . "', now(), " . tep_db_input($customer_notified) . ", '" . tep_db_input($comments) . "')");

}

else

{

if($OldNewStatusValues)

{

tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . "

(orders_id, new_value, old_value, date_added, customer_notified)

values ('" . tep_db_input($oID) . "', '" . tep_db_input($status) . "', '" . $order->info['orders_status'] . "', now(), " . tep_db_input($customer_notified) . ")");

}

else

{

tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . "

(orders_id, orders_status_id, date_added, customer_notified)

values ('" . tep_db_input($oID) . "', '" . tep_db_input($status) . "', now(), " . tep_db_input($customer_notified) . ")");

}

}

}

 

// Update Products

$RunningSubTotal = 0;

$RunningTax = 0;

foreach($update_products as $orders_products_id => $products_details)

{

// Update orders_products Table

if($products_details["qty"] > 0)

{

$Query = "update " . TABLE_ORDERS_PRODUCTS . " set

products_model = '" . $products_details["model"] . "',

products_name = '" . str_replace("'", "'", $products_details["name"]) . "',

final_price = '" . $products_details["final_price"] . "',

products_tax = '" . $products_details["tax"] . "',

products_quantity = '" . $products_details["qty"] . "'

where orders_products_id = '$orders_products_id';";

tep_db_query($Query);

 

// Update Tax and Subtotals

$RunningSubTotal += $products_details["qty"] * $products_details["final_price"];

$RunningTax += (($products_details["tax"]/100) * ($products_details["qty"] * $products_details["final_price"]));

 

// Update Any Attributes

if(IsSet($products_details[attributes]))

{

foreach($products_details["attributes"] as $orders_products_attributes_id => $attributes_details)

{

$Query = "update " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " set

products_options = '" . $attributes_details["option"] . "',

products_options_values = '" . $attributes_details["value"] . "'

where orders_products_attributes_id = '$orders_products_attributes_id';";

tep_db_query($Query);

}

}

}

else

{

// 0 Quantity = Delete

$Query = "delete from " . TABLE_ORDERS_PRODUCTS . " where orders_products_id = '$orders_products_id';";

tep_db_query($Query);

$Query = "delete from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_products_id = '$orders_products_id';";

tep_db_query($Query);

}

}

 

// Shipping Tax

foreach($update_totals as $total_index => $total_details)

{

extract($total_details,EXTR_PREFIX_ALL,"ot");

if($ot_class == "ot_shipping")

{

$RunningTax += (($AddShippingTax / 100) * $ot_value);

}

}

 

// Update Totals

 

$RunningTotal = 0;

$sort_order = 0;

 

// Do pre-check for Tax field existence

$ot_tax_found = 0;

foreach($update_totals as $total_details)

{

extract($total_details,EXTR_PREFIX_ALL,"ot");

if($ot_class == "ot_tax")

{

$ot_tax_found = 1;

break;

}

}

 

foreach($update_totals as $total_index => $total_details)

{

extract($total_details,EXTR_PREFIX_ALL,"ot");

 

if( trim(strtolower($ot_title)) == "tax" || trim(strtolower($ot_title)) == "tax:" )

{

if($ot_class != "ot_tax" && $ot_tax_found == 0)

{

// Inserting Tax

$ot_class = "ot_tax";

$ot_value = "x"; // This gets updated in the next step

$ot_tax_found = 1;

}

}

 

if( trim($ot_title) && trim($ot_value) )

{

$sort_order++;

 

// Update ot_subtotal, ot_tax, and ot_total classes

if($ot_class == "ot_subtotal")

$ot_value = $RunningSubTotal;

 

if($ot_class == "ot_tax")

{

$ot_value = $RunningTax;

// print "ot_value = $ot_value<br>\n";

}

 

if($ot_class == "ot_total")

$ot_value = $RunningTotal;

 

// Set $ot_text (display-formatted value)

// $ot_text = "\$" . number_format($ot_value, 2, '.', ',');

 

$order = new order($oID);

$ot_text = $currencies->format($ot_value, true, $order->info['currency'], $order->info['currency_value']);

 

if($ot_class == "ot_total")

$ot_text = "<b>" . $ot_text . "</b>";

 

if($ot_total_id > 0)

{

// In Database Already - Update

//print "ot_title = $ot_title<br>\n";

//print "ot_text = $ot_text<br>\n";

//print "ot_value = $ot_value<br>\n";

//print "sort_order = $sort_order<br>\n";

 

$Query = "update " . TABLE_ORDERS_TOTAL . " set

title = '$ot_title',

text = '$ot_text',

value = '$ot_value',

sort_order = '$sort_order'

where orders_total_id = '$ot_total_id'";

tep_db_query($Query);

}

else

{

 

// New Insert

$Query = "insert into " . TABLE_ORDERS_TOTAL . " set

orders_id = '$oID',

title = '$ot_title',

text = '$ot_text',

value = '$ot_value',

class = '$ot_class',

sort_order = '$sort_order'";

tep_db_query($Query);

}

 

$RunningTotal += $ot_value;

}

elseif($ot_total_id > 0)

{

// Delete Total Piece

$Query = "delete from " . TABLE_ORDERS_TOTAL . " where orders_total_id = '$ot_total_id'";

tep_db_query($Query);

}

 

}

 

if ($order_updated)

{

$messageStack->add_session(SUCCESS_ORDER_UPDATED, 'success');

}

 

tep_redirect(tep_href_link("edit_orders.php", tep_get_all_get_params(array('action')) . 'action=edit'));

 

break;

 

// Add a Product

case 'add_product':

if($step == 5)

{

// Get Order Info

$oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);

$order = new order($oID);

 

$AddedOptionsPrice = 0;

 

// Get Product Attribute Info

if(IsSet($add_product_options))

{

foreach($add_product_options as $option_id => $option_value_id)

{

$result = tep_db_query("SELECT * FROM " . TABLE_PRODUCTS_ATTRIBUTES . " pa LEFT JOIN " . TABLE_PRODUCTS_OPTIONS . " po ON po.products_options_id=pa.options_id LEFT JOIN " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov ON pov.products_options_values_id=pa.options_values_id WHERE products_id='$add_product_products_id' and options_id=$option_id and options_values_id=$option_value_id");

$row = tep_db_fetch_array($result);

extract($row, EXTR_PREFIX_ALL, "opt");

$AddedOptionsPrice += $opt_options_values_price;

$option_value_details[$option_id][$option_value_id] = array ("options_values_price" => $opt_options_values_price);

$option_names[$option_id] = $opt_products_options_name;

$option_values_names[$option_value_id] = $opt_products_options_values_name;

}

}

 

// Get Product Info

$InfoQuery = "select p.products_model,p.products_price,pd.products_name,p.products_tax_class_id from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on pd.products_id=p.products_id where p.products_id='$add_product_products_id'";

$result = tep_db_query($InfoQuery);

$row = tep_db_fetch_array($result);

extract($row, EXTR_PREFIX_ALL, "p");

 

// Following functions are defined at the bottom of this file

$CountryID = tep_get_country_id($order->delivery["country"]);

$ZoneID = tep_get_zone_id($CountryID, $order->delivery["state"]);

 

$ProductsTax = tep_get_tax_rate($p_products_tax_class_id, $CountryID, $ZoneID);

 

$Query = "insert into " . TABLE_ORDERS_PRODUCTS . " set

orders_id = $oID,

products_id = $add_product_products_id,

products_model = '$p_products_model',

products_name = '" . str_replace("'", "'", $p_products_name) . "',

products_price = '$p_products_price',

final_price = '" . ($p_products_price + $AddedOptionsPrice) . "',

products_tax = '$ProductsTax',

products_quantity = $add_product_quantity;";

tep_db_query($Query);

$new_product_id = tep_db_insert_id();

 

 

if(IsSet($add_product_options))

{

foreach($add_product_options as $option_id => $option_value_id)

{

$Query = "insert into " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " set

orders_id = $oID,

orders_products_id = $new_product_id,

products_options = '" . $option_names[$option_id] . "',

products_options_values = '" . $option_values_names[$option_value_id] . "',

options_values_price = '" . $option_value_details[$option_id][$option_value_id]["options_values_price"] . "',

price_prefix = '+';";

tep_db_query($Query);

}

}

 

// Stock Update

$stock_chk_query = tep_db_query("select products_quantity from products where products_id = '" . $add_product_products_id . "'");

$stock_chk_values = tep_db_fetch_array($stock_chk_query);

$stock_chk_left = $stock_chk_values['products_quantity'] - $add_product_quantity;

tep_db_query("update products set products_quantity = '" . $stock_chk_left . "' where products_id = '" . $add_product_products_id . "'");

 

// Update products_ordered (for bestsellers list)

tep_db_query("update products set products_ordered = products_ordered + " . $add_product_quantity . " where products_id = '" . $add_product_products_id . "'");

 

 

// Calculate Tax and Sub-Totals

$order = new order($oID);

$RunningSubTotal = 0;

$RunningTax = 0;

 

for ($i=0; $i<sizeof($order->products); $i++)

{

$RunningSubTotal += ($order->products[$i]['qty'] * $order->products[$i]['final_price']);

$RunningTax += (($order->products[$i]['tax'] / 100) * ($order->products[$i]['qty'] * $order->products[$i]['final_price']));

}

 

 

// Tax

$Query = "update " . TABLE_ORDERS_TOTAL . " set

text = '".DEFAULT_CURRENCY . number_format($RunningTax, 2, '.', ',') . "',

value = '" . $RunningTax . "'

where class='ot_tax' and orders_id=$oID";

tep_db_query($Query);

 

// Sub-Total

$Query = "update " . TABLE_ORDERS_TOTAL . " set

text = '".DEFAULT_CURRENCY . number_format($RunningSubTotal, 2, '.', ',') . "',

value = '" . $RunningSubTotal . "'

where class='ot_subtotal' and orders_id=$oID";

tep_db_query($Query);

 

// Total

$Query = "select sum(value) as total_value from " . TABLE_ORDERS_TOTAL . " where class != 'ot_total' and orders_id=$oID";

$result = tep_db_query($Query);

$row = tep_db_fetch_array($result);

$Total = $row["total_value"];

 

$Query = "update " . TABLE_ORDERS_TOTAL . " set

text = '<b>".DEFAULT_CURRENCY . number_format($Total, 2, '.', ',') . "</b>',

value = '" . $Total . "'

where class='ot_total' and orders_id=$oID";

tep_db_query($Query);

 

tep_redirect(tep_href_link("edit_orders.php", tep_get_all_get_params(array('action')) . 'action=edit'));

 

}

break;

}

}

 

if (($action == 'edit') && isset($HTTP_GET_VARS['oID'])) {

$oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);

 

$orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");

$order_exists = true;

if (!tep_db_num_rows($orders_query)) {

$order_exists = false;

$messageStack->add(sprintf(ERROR_ORDER_DOES_NOT_EXIST, $oID), 'error');

}

}

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">

<script language="javascript" src="includes/general.js"></script>

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">

<!-- header //-->

<?php

require(DIR_WS_INCLUDES . 'header.php');

?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="2" cellpadding="2">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">

<?php

if (($action == 'edit') && ($order_exists == true)) {

$order = new order($oID);

?>

<tr>

<td width="100%">

<table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo HEADING_TITLE; ?> #<?php echo $oID; ?></td>

<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>

<td class="pageHeading" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action'))) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>

</tr>

</table></td>

</tr>

 

 

<!-- Begin Addresses Block -->

<tr><?php echo tep_draw_form('edit_order', "edit_orders.php", tep_get_all_get_params(array('action','paycc')) . 'action=update_order'); ?>

<td><table width="100%" border="0" cellspacing="0" cellpadding="2">

<tr>

<td colspan="2"><?php echo tep_draw_separator(); ?></td>

</tr>

<tr>

<td valign="top">

<!-- Customer Info Block -->

<table border="0" cellspacing="0" cellpadding="2">

<tr>

<td colspan='2' class="main" valign="top"><b><?php echo ENTRY_CUSTOMER; ?></b></td>

<td colspan='2' class="main" valign="top"><b><?php echo ENTRY_BILLING_ADDRESS; ?></b></td>

</tr>

<tr>

<td colspan='2' class="main">

<table border="0" cellspacing="0" cellpadding="2" class="infoBox">

<tr>

<td><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>Name: </b></font></td>

<td><input name='update_customer_name' size='37' value='<?php echo tep_html_quotes($order->customer['name']); ?>'></td>

</tr>

<tr>

<td><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>Company: </b></font></td>

<td><input name='update_customer_company' size='37' value='<?php echo tep_html_quotes($order->customer['company']); ?>'></td>

</tr>

<tr>

<td><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>Address: </b></font></td>

<td><input name='update_customer_street_address' size='37' value='<?php echo tep_html_quotes($order->customer['street_address']); ?>'></td>

</tr>

<tr>

<td><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>Suburb: </b></font></td>

<td><input name='update_customer_surburb' size='37' value='<?php echo tep_html_quotes($order->customer['suburb']); ?>'></td>

</tr>

<tr>

<td><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>City: </b></font></td>

<td><input name='update_customer_city' size='15' value='<?php echo tep_html_quotes($order->customer['city']); ?>'> </td>

</tr>

<tr>

<td><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>County: </b></font></td>

<td><input name='update_customer_state' size='15' value='<?php echo tep_html_quotes($order->customer['state']); ?>'> </td>

</tr>

<tr>

<td><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>Post Code: </b></font></td>

<td><input name='update_customer_postcode' size='5' value='<?php echo $order->customer['postcode']; ?>'></td>

</tr>

<tr>

<td><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>Country: </b></font></td>

<td><input name='update_customer_country' size='37' value='<?php echo tep_html_quotes($order->customer['country']); ?>'></td>

</tr>

</table>

</td>

 

 

<? if($SeparateBillingFields) { ?>

<td>

<!-- Billing Address Block -->

<table border="0" cellspacing="0" cellpadding="2">

 

<tr>

<td colspan='2' class="main">

<table border="0" cellspacing="0" cellpadding="2" class="infoBox">

<tr>

<td><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>Name: </b></font></td>

<td><input name='update_billing_name' size='37' value='<?php echo tep_html_quotes($order->billing['name']); ?>'></td>

</tr>

<tr>

<td><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>Company: </b></font></td>

<td><input name='update_billing_company' size='37' value='<?php echo tep_html_quotes($order->billing['company']); ?>'></td>

</tr>

<tr>

<td><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>Address: </b></font></td>

<td><input name='update_billing_street_address' size='37' value='<?php echo tep_html_quotes($order->billing['street_address']); ?>'></td>

</tr>

<tr>

<td><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>Suburb: </b></font></td>

<td><input name='update_billing_surburb' size='37' value='<?php echo tep_html_quotes($order->billing['suburb']); ?>'></td>

</tr>

<tr>

<td><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>City: </b></font></td>

<td><input name='update_billing_city' size='15' value='<?php echo tep_html_quotes($order->billing['city']); ?>'> </td>

</tr>

<tr>

<td><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>State: </b></font></td>

<td><input name='update_billing_state' size='15' value='<?php echo tep_html_quotes($order->billing['state']); ?>'> </td>

</tr>

<tr>

<td><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>Post Code: </b></font></td>

<td><input name='update_billing_postcode' size='5' value='<?php echo $order->billing['postcode']; ?>'></td>

</tr>

<tr>

<td><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>Country: </b></font></td>

<td><input name='update_billing_country' size='37' value='<?php echo tep_html_quotes($order->billing['country']); ?>'></td>

</tr>

</table>

</td>

</tr>

</table>

</td>

<? } ?>

 

</tr>

</table>

</td>

</tr>

<tr>

<td valign="top">

<!-- Shipping Address Block -->

<table border="0" cellspacing="0" cellpadding="2">

<tr>

<td class="main" valign="top"><b><?php echo ENTRY_SHIPPING_ADDRESS; ?></b></td>

</tr>

<tr>

<td colspan='1' class="main">

<table border="0" cellspacing="0" cellpadding="2" class="infoBox">

<tr>

<td><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>Name: </b></font></td>

<td><input name='update_delivery_name' size='37' value='<?php echo tep_html_quotes($order->delivery['name']); ?>'></td>

</tr>

<tr>

<td><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>Company: </b></font></td>

<td><input name='update_delivery_company' size='37' value='<?php echo tep_html_quotes($order->delivery['company']); ?>'></td>

</tr>

<tr>

<td><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>Address: </b></font></td>

<td><input name='update_delivery_street_address' size='37' value='<?php echo tep_html_quotes($order->delivery['street_address']); ?>'></td>

</tr>

<tr>

<td><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>Suburb: </b></font></td>

<td><input name='update_delivery_surburb' size='37' value='<?php echo tep_html_quotes($order->delivery['suburb']); ?>'></td>

</tr>

<tr>

<td><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>City: </b></font></td>

<td><input name='update_delivery_city' size='15' value='<?php echo tep_html_quotes($order->delivery['city']); ?>'> </td>

</tr>

<tr>

<td><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>State: </b></font></td>

<td><input name='update_delivery_state' size='15' value='<?php echo tep_html_quotes($order->delivery['state']); ?>'> </td>

</tr>

<tr>

<td><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>Post Code: </b></font></td>

<td><input name='update_delivery_postcode' size='5' value='<?php echo $order->delivery['postcode']; ?>'></td>

</tr>

<tr>

<td><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>Country: </b></font></td>

<td><input name='update_delivery_country' size='37' value='<?php echo tep_html_quotes($order->delivery['country']); ?>'></td>

</tr>

</table>

</td>

<td class="main" align="center" valign="middle">

<font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" color="red"><b>!!! INSTRUCTIONS !!!</b></font><br><br>

Note: If you edit the orders product quanities<br>

they will not update your stock levels with the<br>

changes. So make sure you update them after this<br>

edit section.<br>

 

</td>

</tr>

</table>

</td>

</tr>

</table></td>

</tr>

<!-- End Addresses Block -->

 

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

 

<!-- Begin Phone/Email Block -->

<tr>

<td><table border="0" cellspacing="0" cellpadding="2" class="infoBox">

<tr>

<td class="main"><b><?php echo ENTRY_TELEPHONE_NUMBER; ?></b></td>

<td class="main"><input name='update_customer_telephone' size='15' value='<?php echo $order->customer['telephone']; ?>'></td>

</tr>

<tr>

<td class="main"><b><?php echo ENTRY_EMAIL_ADDRESS; ?></b></td>

<td class="main"><input name='update_customer_email_address' size='35' value='<?php echo $order->customer['email_address']; ?>'></td>

</tr>

</table></td>

</tr>

<!-- End Phone/Email Block -->

 

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

 

<!-- Begin Payment Block -->

<tr>

<td><table border="0" cellspacing="0" cellpadding="2" class="infoBox">

<tr valine="middle">

<td class="main"><b><?php echo ENTRY_PAYMENT_METHOD; ?></b></td>

<td class="main"><?php echo tep_draw_pull_down_menu('update_info_payment_method', $orders_pay_method, $order->info['payment_method']); ?>

<?php echo tep_image_submit('button_update.gif', IMAGE_UPDATE); ?>

<?php

if($order->info['payment_method'] != "Credit Card")

echo ' To View CC Fields';

?>

<?php

if($order->info['payment_method'] != "Purchase Order")

echo ' or View PO Fields';

?>

</td>

</tr>

 

<?php if ($order->info['cc_type'] || $order->info['cc_owner'] || $order->info['payment_method'] == "Credit Card" || $order->info['cc_number']) { ?>

<!-- Begin Credit Card Info Block -->

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr>

<td class="main"><?php echo ENTRY_CREDIT_CARD_TYPE; ?></td>

<td class="main"><input name='update_info_cc_type' size='10' value='<?php echo $order->info['cc_type']; ?>'></td>

</tr>

<tr>

<td class="main"><?php echo ENTRY_CREDIT_CARD_OWNER; ?></td>

<td class="main"><input name='update_info_cc_owner' size='20' value='<?php echo $order->info['cc_owner']; ?>'></td>

</tr>

<tr>

<td class="main"><?php echo ENTRY_CREDIT_CARD_NUMBER; ?></td>

<td class="main"><input name='update_info_cc_number' size='20' value='<?php echo "(Last 4) " . substr($order->info['cc_number'],-4); ?>'></td>

</tr>

<tr>

<td class="main"><?php echo ENTRY_CREDIT_CARD_EXPIRES; ?></td>

<td class="main"><input name='update_info_cc_expires' size='4' value='<?php echo $order->info['cc_expires']; ?>'></td>

</tr>

<!-- End Credit Card Info Block -->

 

 

<?php

// purchaseorder start

} else if( (($order->info['account_name']) || ($order->info['account_number']) || $order->info['payment_method'] == "Purchase Order"|| ($order->info['po_number'])) ) {

?>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr>

<td class="main" valign="top" align="left"><b>PO Information:</b></td>

<td>

<table border="0" cellspacing="0" cellpadding="2">

<tr>

<td width="10"><img src="images/pixel_trans.gif" border="0" alt="" width="10" height="1"></td>

<td class="main">Account name:</td>

<td><img src="images/pixel_trans.gif" border="0" alt="" width="10" height="1"></td>

<td class="main"><input type="text" name="account_name" value='<?php echo $order->info['account_name']; ?>'></td></td>

<td width="10"><img src="images/pixel_trans.gif" border="0" alt="" width="10" height="1"></td>

</tr>

<tr>

<td width="10"><img src="images/pixel_trans.gif" border="0" alt="" width="10" height="1"></td>

<td class="main">Account number:</td>

<td><img src="images/pixel_trans.gif" border="0" alt="" width="10" height="1"></td>

<td class="main"><input type="text" name="account_number" value='<?php echo $order->info['account_number']; ?>'></td>

<td width="10"><img src="images/pixel_trans.gif" border="0" alt="" width="10" height="1"></td>

</tr>

<tr>

<td width="10"><img src="images/pixel_trans.gif" border="0" alt="" width="10" height="1"></td>

<td class="main">Purchase Order Nr:</td>

<td><img src="images/pixel_trans.gif" border="0" alt="" width="10" height="1"></td>

<td class="main"><input type="text" name="po_number" value='<?php echo $order->info['po_number']; ?>'></td>

<td width="10"><img src="images/pixel_trans.gif" border="0" alt="" width="10" height="1"></td>

</tr>

</table>

</td>

</tr>

 

 

 

 

 

 

<?php } ?>

</table></td>

</tr>

<!-- End Payment Block -->

 

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

 

<!-- Begin Products Listing Block -->

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr class="dataTableHeadingRow">

<td class="dataTableHeadingContent" colspan="2"><?php echo TABLE_HEADING_PRODUCTS; ?></td>

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td>

<td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_TAX; ?></td>

<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_UNIT_PRICE; ?></td>

<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_PRICE; ?></td>

</tr>

 

<!-- Begin Products Listings Block -->

<?

// Override order.php Class's Field Limitations

$index = 0;

$order->products = array();

$orders_products_query = tep_db_query("select * from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$oID . "'");

while ($orders_products = tep_db_fetch_array($orders_products_query)) {

$order->products[$index] = array('qty' => $orders_products['products_quantity'],

'name' => str_replace("'", "'", $orders_products['products_name']),

'model' => $orders_products['products_model'],

'tax' => $orders_products['products_tax'],

'price' => $orders_products['products_price'],

'final_price' => $orders_products['final_price'],

'orders_products_id' => $orders_products['orders_products_id']);

 

$subindex = 0;

$attributes_query_string = "select * from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$oID . "' and orders_products_id = '" . (int)$orders_products['orders_products_id'] . "'";

$attributes_query = tep_db_query($attributes_query_string);

 

if (tep_db_num_rows($attributes_query)) {

while ($attributes = tep_db_fetch_array($attributes_query)) {

$order->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'],

'value' => $attributes['products_options_values'],

'prefix' => $attributes['price_prefix'],

'price' => $attributes['options_values_price'],

'orders_products_attributes_id' => $attributes['orders_products_attributes_id']);

$subindex++;

}

}

$index++;

}

 

for ($i=0; $i<sizeof($order->products); $i++) {

$orders_products_id = $order->products[$i]['orders_products_id'];

 

$RowStyle = "dataTableContent";

 

echo ' <tr class="dataTableRow">' . "\n" .

' <td class="' . $RowStyle . '" valign="top" align="right">' . "<input name='update_products[$orders_products_id][qty]' size='2' value='" . $order->products[$i]['qty'] . "'> x</td>\n" .

' <td class="' . $RowStyle . '" valign="top">' . "<input name='update_products[$orders_products_id][name]' size='25' value='" . $order->products[$i]['name'] . "'>";

 

// Has Attributes?

if (sizeof($order->products[$i]['attributes']) > 0) {

for ($j=0; $j<sizeof($order->products[$i]['attributes']); $j++) {

$orders_products_attributes_id = $order->products[$i]['attributes'][$j]['orders_products_attributes_id'];

echo '<br><nobr><small> <i> - ' . "<input name='update_products[$orders_products_id][attributes][$orders_products_attributes_id][option]' size='6' value='" . $order->products[$i]['attributes'][$j]['option'] . "'>" . ': ' . "<input name='update_products[$orders_products_id][attributes][$orders_products_attributes_id][value]' size='10' value='" . $order->products[$i]['attributes'][$j]['value'] . "'>";

echo '</i></small></nobr>';

}

}

 

echo ' </td>' . "\n" .

' <td class="' . $RowStyle . '" valign="top">' . "<input name='update_products[$orders_products_id][model]' size='12' value='" . $order->products[$i]['model'] . "'>" . '</td>' . "\n" .

' <td class="' . $RowStyle . '" align="center" valign="top">' . "<input name='update_products[$orders_products_id][tax]' size='3' value='" . tep_display_tax_value($order->products[$i]['tax']) . "'>" . '%</td>' . "\n" .

' <td class="' . $RowStyle . '" align="right" valign="top">' . "<input name='update_products[$orders_products_id][final_price]' size='5' value='" . number_format($order->products[$i]['final_price'], 2, '.', '') . "'>" . '</td>' . "\n" .

' <td class="' . $RowStyle . '" align="right" valign="top">' . $currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</td>' . "\n" .

' </tr>' . "\n";

}

?>

<!-- End Products Listings Block -->

 

<!-- Begin Order Total Block -->

<tr>

<td align="right" colspan="6">

<table border="0" cellspacing="0" cellpadding="2" width="100%">

<tr>

<td align='center' valign='top'><br><a href="<? print $PHP_SELF . "?oID=$oID&action=add_product&step=1"; ?>"><u><b><font size='3'>ADD A NEW PRODUCT</font></b></u></a></td>

<td align='right'>

<table border="0" cellspacing="0" cellpadding="2">

<?php

 

// Override order.php Class's Field Limitations

$totals_query = tep_db_query("select * from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$oID . "' order by sort_order");

$order->totals = array();

while ($totals = tep_db_fetch_array($totals_query)) { $order->totals[] = array('title' => $totals['title'], 'text' => $totals['text'], 'class' => $totals['class'], 'value' => $totals['value'], 'orders_total_id' => $totals['orders_total_id']); }

 

$TotalsArray = array();

for ($i=0; $i<sizeof($order->totals); $i++) {

$TotalsArray[] = array("Name" => $order->totals[$i]['title'], "Price" => number_format($order->totals[$i]['value'], 2, '.', ''), "Class" => $order->totals[$i]['class'], "TotalID" => $order->totals[$i]['orders_total_id']);

$TotalsArray[] = array("Name" => " ", "Price" => "", "Class" => "ot_custom", "TotalID" => "0");

}

 

array_pop($TotalsArray);

foreach($TotalsArray as $TotalIndex => $TotalDetails)

{

$TotalStyle = "smallText";

if(($TotalDetails["Class"] == "ot_subtotal") || ($TotalDetails["Class"] == "ot_total"))

{

echo ' <tr>' . "\n" .

' <td class="main" align="right"><b>' . $TotalDetails["Name"] . '</b></td>' .

' <td class="main"><b>' . $TotalDetails["Price"] .

"<input name='update_totals[$TotalIndex][title]' type='hidden' value='" . trim($TotalDetails["Name"]) . "' >" .

"<input name='update_totals[$TotalIndex][value]' type='hidden' value='" . $TotalDetails["Price"] . "' size='6' >" .

"<input name='update_totals[$TotalIndex][class]' type='hidden' value='" . $TotalDetails["Class"] . "'>\n" .

"<input type='hidden' name='update_totals[$TotalIndex][total_id]' value='" . $TotalDetails["TotalID"] . "'>" . '</b></td>' .

' </tr>' . "\n";

}

elseif($TotalDetails["Class"] == "ot_customer_discount")

{

echo ' <tr>' . "\n" .

' <td class="main" align="right"><b>' . $TotalDetails["Name"] . '</b></td>' .

' <td align="right" class="' . $TotalStyle . '">' . "<input name='update_totals[$TotalIndex][value]' size='6' value='&quo

Link to comment
Share on other sites

I got it working to send an email but when click on the link in the email

http://domain.net/account_history_info.php?order_id=71

and try to log in I get a 404 file not found

 

https://secure.nocdirect.com/account_histor...3e9195443efac38

 

If I click the back button I am logged in but when I go to view order history account_history.php, there is no order.

 

does anyone know how to fix this?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...