Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

NEW! Complete Order Editing Tool!


jhilgeman

Recommended Posts

Hi Mike,

 

this was something I forgot to remove which was specific to my shipping module. edit oe_order.php

 

you will see online 113 (around there)

 

p.products_weight_type,

p.products_dim_type,

p.products_length,

p.products_width,

p.products_height,

p.products_ready_to_ship,

 

remove this section

 

as well as on line 136 (around there)

 

'weight_type' => $products['products_weight_type'],

'dim_type' => $products['products_dim_type'],

'length' => $products['products_length'],

'width' => $products['products_width'],

'height' => $products['products_height'],

'ready_to_ship' => $products['products_ready_to_ship'],

 

remove this section as well

 

Worked exactly like you said it would, thanks so much! :thumbsup:

Link to comment
Share on other sites

BAH!

 

Slight error in 4.0.2

 

OPEN admin/edit_orders.php

 

Find near line 575

						$Query = "UPDATE " . TABLE_ORDERS_TOTAL . " SET
						title = '" . $shipping['title'] . "'
						WHERE class = 'ot_tax'
						AND orders_id = '" . (int)$oID . "'";
					tep_db_query($Query);

 

Replace with

						$Query = "UPDATE " . TABLE_ORDERS_TOTAL . " SET
						title = '" . $shipping['title'] . "'
						WHERE class = 'ot_shipping'
						AND orders_id = '" . (int)$oID . "'";
					tep_db_query($Query);

 

My bad on that

 

J

Link to comment
Share on other sites

ok I found the module Austpost 3.01 in the contributions.. released recently..

 

it seems there are a lot of module files that need to be modified ... not just one..

 

you have these files (i hope you copied all of them) ... 4 that begin with austpost and 4 that begin with insured

 

you need to copy all of these over as well as their respective language files.. all your icons and gifs must also be copied over..

 

after that you have to do all the modifications i told you to above.. and do those mods in each of those 8 files that you have copied to your admin/modules/shipping folder

 

specifically the changes you need to make is change all your

 

$order->delivery['country']['id] to $order->delivery['country_id']

 

as well as

 

$dest_country = tep_get_countries_iso($order->delivery['country_id'], true);

 

you need add this part .. just take a look at the modifications suggested above.. and make sure its consistent with each file.. nearly all files look the same.. so it should be clear where you have to put those mods and what lines you need to change..

 

let me know

 

J

 

Hey J,

 

well I updated all the files I have installed btw I am using Australia Post 2.02c_2 as my postage includes insurance in postage total and I don't need to separate it, as the latest release allows a choice, I dont want that option avail, so I have checked & re-checked all 3 files I am using auspost.php auspostair.php & auspostexpress.php mod files + graphics & language files all in place (ps ausposteconomy no longer used in aust, so is deleted)

 

I am still not getting Request Real-Time Shipping Quotes:

 

and continually get the following error:

AusPOST International Parcel Post - AIR

AusPOST International Parcel Post - AIR

ERROR: The delivery rate for this option cannot be determined at this time

If you prefer to use this option as your shipping method, please contact the store owner.

 

(the auspost graphic does show!)

 

I also have a fourth option installed - dly.php for local delivery but that has never shown up in the option drop down (so problem with that too i expect)

The OSC flat rate when installed works fine!

 

I haven't touched the dly.php yet - no point until AustPost is working...

 

Any further ideas on this problem??

Cheers

Link to comment
Share on other sites

Hey J,

 

well I updated all the files I have installed btw I am using Australia Post 2.02c_2 as my postage includes insurance in postage total and I don't need to separate it, as the latest release allows a choice, I dont want that option avail, so I have checked & re-checked all 3 files I am using auspost.php auspostair.php & auspostexpress.php mod files + graphics & language files all in place (ps ausposteconomy no longer used in aust, so is deleted)

 

I am still not getting Request Real-Time Shipping Quotes:

 

and continually get the following error:

AusPOST International Parcel Post - AIR

AusPOST International Parcel Post - AIR

ERROR: The delivery rate for this option cannot be determined at this time

If you prefer to use this option as your shipping method, please contact the store owner.

 

(the auspost graphic does show!)

 

I also have a fourth option installed - dly.php for local delivery but that has never shown up in the option drop down (so problem with that too i expect)

The OSC flat rate when installed works fine!

 

I haven't touched the dly.php yet - no point until AustPost is working...

 

Any further ideas on this problem??

Cheers

 

hmm.. so you modified the 4 files

 

austpost.php

austpostair.php

austpostexpress.php

austpostsea.php

 

hmm well the only suggestion i have for right now is to double check all your uses of 'iso_code_2' specifically where you changed your code from $order->delivery['country']['iso_code_2'] to something like $dest_country['countries_iso_code_2'] .. you need to use 'countries_iso_code_2' and not just 'iso_code_2' .. I checked the files and austpost.php has 1 occurance of 'iso_code_2' .. air and sea have 3 and express has 2 i think.. but just double check make sure everything that needs to be changed was .. if still no progress then ill look into installing it..

 

last thing i suggest is to use some echo's and see what the values are

 

for example just put in an echo line under your $dest_country.... line..

 

echo $dest_country['countries_iso_code_2'] . 'hello' ;

 

... see if it prints out something .. or just prints hello.. maybe thats telling you that the value is not getting there and something above it is going wrong.. that would help me to understand where the problem is happening also.

 

J

Link to comment
Share on other sites

hey J,

 

well... update... checked & rechecked every line of code posted and found 1 line not commented!! so i think, excellent here we go! but then went to edit an order and I get an error

Error: No such order.

 

so im looking at the code in orders as this appears all good on the site, I realized I am using another contribution - Improved Order Number

The functionality is added by changing places the "ORDER_ID" is printed, and replacing int with the output from an added function "tep_trans_id($raw_date,$order_id)"

 

The function for this is: (in case it helps)

 

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

 

// Output Transaction_ID = YYMMDD-SSmmHH-0001

// $raw_date needs to be in this format: YYYY-MM-DD HH:MM:SS

// $order_id is passed from the customer order

function tep_trans_id($raw_date,$order_id) {

if ( ($raw_date == '0000-00-00 00:00:00') || ($raw_date == '') ) return false;

 

$year = (int)substr($raw_date, 2, 2);

$month = (int)substr($raw_date, 5, 2);

$day = (int)substr($raw_date, 8, 2);

$hour = (int)substr($raw_date, 11, 2);

$minute = (int)substr($raw_date, 14, 2);

$second = (int)substr($raw_date, 17, 2);

 

$cart_id=sprintf("%02d%02d%02d-%02d%02d%02d-%04d",$year,$month,$day,$second,$minute,$hour,$order_id);

 

return $cart_id;

}

 

////

 

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

 

 

so now to get into even see the edit order it has to recognize the order id which it doesn't. It seems I have narrowed it down to this section of code in eo php

 

if ($order->info['shipping_method'] == null) {

$Query = "SELECT title FROM " . TABLE_ORDERS_TOTAL . "

WHERE class = 'ot_shipping'

AND orders_id = '" . (int)$oID . "'";

$result = tep_db_query($Query);

$row = tep_db_fetch_array($result);

 

$order->info['shipping_method'] = $row['title'];

}

 

I also do not get the order id back in the error just --> Error: No such order.

 

if (!$order->exists) {

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

}

 

Am i right that it has something to do with the -> AND orders_id = '" . (int)$oID . "'";

or do i need to make more changes through the whole edit_orders.php for this to all work?

 

Thanks for any help you can give mate.

Link to comment
Share on other sites

hey J,

 

well... update... checked & rechecked every line of code posted and found 1 line not commented!! so i think, excellent here we go! but then went to edit an order and I get an error

Error: No such order.

 

so im looking at the code in orders as this appears all good on the site, I realized I am using another contribution - Improved Order Number

The functionality is added by changing places the "ORDER_ID" is printed, and replacing int with the output from an added function "tep_trans_id($raw_date,$order_id)"

 

The function for this is: (in case it helps)

 

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

 

// Output Transaction_ID = YYMMDD-SSmmHH-0001

// $raw_date needs to be in this format: YYYY-MM-DD HH:MM:SS

// $order_id is passed from the customer order

function tep_trans_id($raw_date,$order_id) {

if ( ($raw_date == '0000-00-00 00:00:00') || ($raw_date == '') ) return false;

 

$year = (int)substr($raw_date, 2, 2);

$month = (int)substr($raw_date, 5, 2);

$day = (int)substr($raw_date, 8, 2);

$hour = (int)substr($raw_date, 11, 2);

$minute = (int)substr($raw_date, 14, 2);

$second = (int)substr($raw_date, 17, 2);

 

$cart_id=sprintf("%02d%02d%02d-%02d%02d%02d-%04d",$year,$month,$day,$second,$minute,$hour,$order_id);

 

return $cart_id;

}

 

////

 

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

so now to get into even see the edit order it has to recognize the order id which it doesn't. It seems I have narrowed it down to this section of code in eo php

 

if ($order->info['shipping_method'] == null) {

$Query = "SELECT title FROM " . TABLE_ORDERS_TOTAL . "

WHERE class = 'ot_shipping'

AND orders_id = '" . (int)$oID . "'";

$result = tep_db_query($Query);

$row = tep_db_fetch_array($result);

 

$order->info['shipping_method'] = $row['title'];

}

 

I also do not get the order id back in the error just --> Error: No such order.

 

if (!$order->exists) {

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

}

 

Am i right that it has something to do with the -> AND orders_id = '" . (int)$oID . "'";

or do i need to make more changes through the whole edit_orders.php for this to all work?

 

Thanks for any help you can give mate.

 

 

yup that sounds it exactly.. you need to change that everywhere $oID is used.. and that isnt just edit_orders.php .. might have to edit order_cart.php as well .. but basically take a look at the files in the contribtion.. but start with just edit_order.php and test that.. if it still not functioning as it should.. then go to the other files..

 

$oID is used in a lot of places so you have to change all of them

 

J

Link to comment
Share on other sites

basically your going to have to install that order number contribution into the admin side as well.. you probably already did modify some files but yes youre going to have to modify edit_orders.php in pretty much the same way you did the other files.

 

J

Link to comment
Share on other sites

"

basically your going to have to install that order number contribution into the admin side as well.. you probably already did modify some files but yes youre going to have to modify edit_orders.php in pretty much the same way you did the other files.

 

J

 

Well at least im on the right track... though to be honest i don't have a clue what changes need to be made, for this to get the order id or how to call the functions properly, I did try to follow the similar code as the initial install but im still getting the same error.. Error: No such order.

 

from the contribution the following has been changed:

 

\account.php

\account_history.php

\account_history_info.php

\admin\invoice.php

\admin\orders.php

\admin\packingslip.php

\includes\functions\general.php

\admin\includes\functions\general.php

 

The functionality is added by changing places the

"ORDER_ID" is printed, and replacing int with the

output from an added function "tep_trans_id($raw_date,$order_id)

 

any pointers you can give would be great as far as format of the code, as i know $oID needs to be changed but just don't know how to call the data, does $oID have to be redefined somehow, im just lost on this!!!

 

cheers

Link to comment
Share on other sites

"

 

Well at least im on the right track... though to be honest i don't have a clue what changes need to be made, for this to get the order id or how to call the functions properly, I did try to follow the similar code as the initial install but im still getting the same error.. Error: No such order.

 

from the contribution the following has been changed:

 

\account.php

\account_history.php

\account_history_info.php

\admin\invoice.php

\admin\orders.php

\admin\packingslip.php

\includes\functions\general.php

\admin\includes\functions\general.php

 

The functionality is added by changing places the

"ORDER_ID" is printed, and replacing int with the

output from an added function "tep_trans_id($raw_date,$order_id)

 

any pointers you can give would be great as far as format of the code, as i know $oID needs to be changed but just don't know how to call the data, does $oID have to be redefined somehow, im just lost on this!!!

 

cheers

 

well if you look at edit_orders.php .. at the very top you will see a lot of $oID .. they might be in $_POST[$oID]

 

you need to change these to your function tep_trans_id($raw_date, $oID);

 

or like tep_trans_id($raw_date, $_POST[$oID]);

 

however their may be a simpler way of doing this..

 

first a couple questions.. are you editing orders created by the customer or orders created from the order create in admin?

 

if you are editing orders created by the customer.. then when edit_orders.php is loaded .. it already has the order id.. its usually in the URL

 

something like http://www.something.com/catalog/admin/edi...ders.php?oID=12 (for example)

 

try editing an order and seeing what the URL has in it. if it says order id not found and you have something simple like oID=12 then your order_id in orders.php isnt being loaded correctly.. if it something like oID=1243545 (date combined) .. then edit_orders isnt reading that order_id from the database correctly..

 

another question is.. what is the order number being stored in the database.. is it a simple number like 12 or is it complex.. if it is complex.. then the query to the database should include a complex number.. I dont see why edit_orders.php would have a problem with that order_id that you have.. but take a look and post what you see

 

J

Link to comment
Share on other sites

This is a screenshot of Order Editor 5.0 BETA 1:

 

screenshot.jpg

 

This is the same screenshot that will be included with the contribution. I plan to have the package available for download within the next few hours.

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

love the look and feel of that.. did you use any of the code from my updated version? or is this completely your own update..

 

I will take a look at it when its available..

 

I nearly have the payment modules working.. and would be a nice addition as well

 

J

Edited by insaini
Link to comment
Share on other sites

love the look and feel of that.. did you use any of the code from my updated version? or is this completely your own update..

 

I will take a look at it when its available..

 

I nearly have the payment modules working.. and would be a nice addition as well

 

J

 

I've been working on this for a long time. I used the order editor from the MOECTOE suite as my base file and went nuts from there. The major revisions besides real-time shipping quotes (you beat me to that) are that all the updates are done via AJAX thereby making the "update" button unneccessary (although it is still used on javascript impaired browsers) and most of the order totalling is done using the order total modules.

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

Order Editor 5.0 BETA 1, for public testing, has been released.

 

Features of Order Editor 5.0:

-Fully integrated AJAX interface allows for near real-time updating of the database without use of the update button. In order to update a field the user need only type the new information in the appropriate box then press the tab button or otherwise move the cursor and the appropriate change will be accomplished without reloading the page.

-Real-time shipping quotes using the catalog side shipping modules, refreshed as necessary during the update process.

-Order total process using the catalog side order total modules with order totals refreshed as necessary during the update process.

-Updated HTML layout does away with many of the nested tables found in previous versions.

-Advanced Add a Product function allows for searching by categories, subcategories, name, or model.

 

Bring on the bug reports....

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

Order Editor 5.0 BETA 1, for public testing, has been released.

 

Features of Order Editor 5.0:

-Fully integrated AJAX interface allows for near real-time updating of the database without use of the update button. In order to update a field the user need only type the new information in the appropriate box then press the tab button or otherwise move the cursor and the appropriate change will be accomplished without reloading the page.

-Real-time shipping quotes using the catalog side shipping modules, refreshed as necessary during the update process.

-Order total process using the catalog side order total modules with order totals refreshed as necessary during the update process.

-Updated HTML layout does away with many of the nested tables found in previous versions.

-Advanced Add a Product function allows for searching by categories, subcategories, name, or model.

 

Bring on the bug reports....

 

nice.. ill start testing this myself soon.. AJAX is definitely worthwhile bonus.. how does this work with multiple taxes ? that was actually the main reason for me updating the entire package in the first place.. taxes were being grouped together and I wanted them separate..

 

 

J

Edited by insaini
Link to comment
Share on other sites

nice.. ill start testing this myself soon.. AJAX is definitely worthwhile bonus.. how does this work with multiple taxes ? that was actually the main reason for me updating the entire package in the first place.. taxes were being grouped together and I wanted them separate..

J

 

That would have to do with the way the ot_tax module works, and to some degree as well the function tep_get_tax_description.

 

The function tep_get_tax_description that is included with 5.0 looks like this:

  function tep_get_tax_description($class_id, $country_id, $zone_id) {
 $tax_query = tep_db_query("select tax_description from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za on (tr.tax_zone_id = za.geo_zone_id) left join " . TABLE_GEO_ZONES . " tz on (tz.geo_zone_id = tr.tax_zone_id) where (za.zone_country_id is null or za.zone_country_id = '0' or za.zone_country_id = '" . (int)$country_id . "') and (za.zone_id is null or za.zone_id = '0' or za.zone_id = '" . (int)$zone_id . "') and tr.tax_class_id = '" . (int)$class_id . "' order by tr.tax_priority");
 if (tep_db_num_rows($tax_query)) {
   $tax_description = '';
   while ($tax = tep_db_fetch_array($tax_query)) {
	 $tax_description .= $tax['tax_description'] . ' + ';
   }
   $tax_description = substr($tax_description, 0, -3);

   return $tax_description;
 } else {
   return ENTRY_TAX;
 }
  }

 

It is for all intents and purposes identical to the function of the same name found in catalog/includes/functions/general.php (as far as I know there is no such function provided in the admin side with a stock install).

 

Given that 5.0 uses the output of the order total modules for doing most of the order total business, if you already have a modified ot_tax module that uses the taxes on separate lines, theoretically all you would need to do is modify the functions tep_get_tax_description and oe_get_tax_description in admin/order_editor/functions.php (the two functions are identical except in name; I wanted to give all the custom functions oe_ prefixes to tell them apart but the Low Order Fee module uses tep_get_tax_description. I'll probably end up getting rid of the oe_ version and moving the tep_ version to the standard general functions file since it should be in there anyway) to match whatever is used in place of tep_get_tax_description on the catalog side.

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

well if you look at edit_orders.php .. at the very top you will see a lot of $oID .. they might be in $_POST[$oID]

 

you need to change these to your function tep_trans_id($raw_date, $oID);

 

or like tep_trans_id($raw_date, $_POST[$oID]);

 

however their may be a simpler way of doing this..

 

first a couple questions.. are you editing orders created by the customer or orders created from the order create in admin?

 

if you are editing orders created by the customer.. then when edit_orders.php is loaded .. it already has the order id.. its usually in the URL

 

something like http://www.something.com/catalog/admin/edi...ders.php?oID=12 (for example)

 

try editing an order and seeing what the URL has in it. if it says order id not found and you have something simple like oID=12 then your order_id in orders.php isnt being loaded correctly.. if it something like oID=1243545 (date combined) .. then edit_orders isnt reading that order_id from the database correctly..

 

another question is.. what is the order number being stored in the database.. is it a simple number like 12 or is it complex.. if it is complex.. then the query to the database should include a complex number.. I dont see why edit_orders.php would have a problem with that order_id that you have.. but take a look and post what you see

 

J

 

in answer to your questions - Atm just orders created by customer and i get ...edit_orders.php?oID=3&osCAdminID=9e7... The order number is 3 so not a complex number

I checked the database via myphp and the order number is showing as a simple number 3 also, i believe the order number contribution just outputs the order id with the purchased date.

 

When i load the order it shows as Order Number: 260607-061856-0003 with no problems - gets retrieved to the invoice and packing slip no problems, just when i go to edit order thats when i get the error, so basically i need a hand with retrieving the order id to edit but that also changes the number into the format 260607-061856-0003. I will try the example you have given me above this evening and see how i travel, but will check back here in case you have any further ideas!!

I presume i will have the same problem with Order Editor 5.0 so might just get this version working first before updating or would you recommend upgrading to Order Editor 5.0 first!

 

Cheers,

M

Link to comment
Share on other sites

nice.. ill start testing this myself soon.. AJAX is definitely worthwhile bonus.. how does this work with multiple taxes ? that was actually the main reason for me updating the entire package in the first place.. taxes were being grouped together and I wanted them separate..

 

 

J

 

Looking at it further, it seems like all you would have to do is install your function tep_get_tax_rate_description (from your Separated Taxes Display contribution) into admin/order_editor/functions.php, then open admin/order_editor/order.php and change

		'tax_description' => 
		 oe_get_tax_description($orders_products['products_tax_class_id'], $this->delivery["country_id"], $this->delivery["zone_id"]),

to

		'tax_description' => 
		 tep_get_tax_rate_description($orders_products['products_tax_class_id'], $this->delivery["country_id"], $this->delivery["zone_id"]),

 

If you get a chance to test this theory let me know how it goes; if that is the case (seems too easy, right?) it would be simple to include the one extra function and have a switch that is confgurable in admin to select how to display taxes.

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

in answer to your questions - Atm just orders created by customer and i get ...edit_orders.php?oID=3&osCAdminID=9e7... The order number is 3 so not a complex number

I checked the database via myphp and the order number is showing as a simple number 3 also, i believe the order number contribution just outputs the order id with the purchased date.

 

When i load the order it shows as Order Number: 260607-061856-0003 with no problems - gets retrieved to the invoice and packing slip no problems, just when i go to edit order thats when i get the error, so basically i need a hand with retrieving the order id to edit but that also changes the number into the format 260607-061856-0003. I will try the example you have given me above this evening and see how i travel, but will check back here in case you have any further ideas!!

I presume i will have the same problem with Order Editor 5.0 so might just get this version working first before updating or would you recommend upgrading to Order Editor 5.0 first!

 

Cheers,

M

 

I don't understand why you are having this problem at all. The contribution you mentioned does not change the way the order number is stored in the database, just the way it's displayed.

 

When you view the orders page (admin/orders.php) how does the address appear in the browser window address bar? It should still be something like http://www.something.com/admin/orders.php?oID=12

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

I'm running into a problem with integrating the new Order Editor 5.0 BETA 1 with the Credit Class & Gift Voucher contribution http://www.oscommerce.com/community/contributions,282.

 

Once in the order editor, I'm attempting to delete a product. I get the javascript confirmation and the product IS deleted. However, once deleted it is trying to calculate the new total of my order and I receive the following error inside the products section.

 

 

Fatal error: Call to a member function get_products() on a non-object in /home/crossove/public_html/stage/includes/modules/order_total/ot_coupon.php on line 429

 

Line 429 is inside the function get_order_total()...see snippet below.

 

function get_order_total() {
global $order, $cart, $customer_id, $cc_id;
       //$cc_id = $_SESSION['cc_id']; //Fred commented out, do not use $_SESSION[] due to backward comp. Reference the global var instead.
       $order_total = $order->info['total'];
       // Check if gift voucher is in cart and adjust total
       $products = $cart->get_products();                                          // LINE 429
       for ($i=0; $i<sizeof($products); $i++) {
               $t_prid = tep_get_prid($products[$i]['id']);
               $gv_query = tep_db_query("select products_price, products_tax_class_id, products_model from " . TABLE_PRODUCTS . " where products_id = '" . $t_prid . "'");
               $gv_result = tep_db_fetch_array($gv_query);
               if (ereg('^GIFT', addslashes($gv_result['products_model']))) {
                       $qty = $cart->get_quantity($t_prid);
                       $products_tax = tep_get_tax_rate($gv_result['products_tax_class_id']);
                       if ($this->include_tax =='false') {
                               $gv_amount = $gv_result['products_price'] * $qty;
                       } else {
                               $gv_amount = ($gv_result['products_price'] + tep_calculate_tax($gv_result['products_price'],$products_tax)) * $qty;
                       }
                       $order_total=$order_total - $gv_amount;
               }
       }

 

 

Any ideas? Other than that, the module looks and works great! Nice job!!

Link to comment
Share on other sites

Looking at it further, it seems like all you would have to do is install your function tep_get_tax_rate_description (from your Separated Taxes Display contribution) into admin/order_editor/functions.php, then open admin/order_editor/order.php and change
		'tax_description' => 
		 oe_get_tax_description($orders_products['products_tax_class_id'], $this->delivery["country_id"], $this->delivery["zone_id"]),

to

		'tax_description' => 
		 tep_get_tax_rate_description($orders_products['products_tax_class_id'], $this->delivery["country_id"], $this->delivery["zone_id"]),

 

If you get a chance to test this theory let me know how it goes; if that is the case (seems too easy, right?) it would be simple to include the one extra function and have a switch that is confgurable in admin to select how to display taxes.

 

yeah that is too easy.. actually the function i created returns an array .. tax_description would no longer just be a description but an array with a rate and description.. it does require some modification in the edit_orders.php file. ot_tax does not require any modification but ot_shipping and ot_loworderfee do

then of course oe_order.php needs to be modified

 

this is pretty much the change

 

ot_shipping.php

Line 52

		  $shipping_tax = tep_get_tax_rate($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
	  $shipping_tax_description = tep_get_tax_description($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
	  $order->info['tax'] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);
	  $order->info['tax_groups']["$shipping_tax_description"] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);

	  $order->info['total'] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);

 

TO

 

		  $shipping_tax = tep_get_tax_rate($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
	  // $shipping_tax_description = tep_get_tax_description($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
	  $shipping_tax_description = tep_get_tax_rate_description($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id'], array());

	  $order->info['tax'] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);
	  // $order->info['tax_groups']["$shipping_tax_description"] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);
	  foreach($shipping_tax_description as $desc => $tax_rate) {
		if($tax_rate != 0) {
	   	   $order->info['tax_groups']["$desc"] += tep_calculate_tax($order->info['shipping_cost'], $tax_rate);
		}
	  }

	  $order->info['total'] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);

 

you can see the basic way it functions with the foreach .. the function i created is also compounded taxes safe

Link to comment
Share on other sites

I don't understand why you are having this problem at all. The contribution you mentioned does not change the way the order number is stored in the database, just the way it's displayed.

 

When you view the orders page (admin/orders.php) how does the address appear in the browser window address bar? It should still be something like http://www.something.com/admin/orders.php?oID=12

 

Agreed, kang you shouldnt be having any problems at all.. it seems that contribution you added only outputs the orderid in a different way but has nothing to do with the way it is stored.. in which case it should be causing any problems at all..

 

however.. there may be someplace (one or more) where you are actually assigning that value to the $oID. That would definitely cause some problems..

 

if anywhere you have $oID = tep_trans_id($raw_date, $oID); or something to that effect.. then this would definitely cause that problem.. i would look for that..

 

J

Link to comment
Share on other sites

I'm running into a problem with integrating the new Order Editor 5.0 BETA 1 with the Credit Class & Gift Voucher contribution http://www.oscommerce.com/community/contributions,282.

 

Once in the order editor, I'm attempting to delete a product. I get the javascript confirmation and the product IS deleted. However, once deleted it is trying to calculate the new total of my order and I receive the following error inside the products section.

 

Fatal error: Call to a member function get_products() on a non-object in /home/crossove/public_html/stage/includes/modules/order_total/ot_coupon.php on line 429

 

Line 429 is inside the function get_order_total()...see snippet below.

 

 

Any ideas? Other than that, the module looks and works great! Nice job!!

 

Interesting. Try this- in admin/edit_orders_ajax.php find at about line 154

		$order = new manualOrder($oID);


	  //this is where we call the order total modules
	 require( 'order_editor/order_total.php');
	 $order_total_modules = new order_total();
	 $order_totals = $order_total_modules->process();

and change it to

		$order = new manualOrder($oID);

	 $cart = new manualCart();
	 $cart->restore_contents($oID);
	 $total_count = $cart->count_contents();
	 $total_weight = $cart->show_weight();

	  //this is where we call the order total modules
	 require( 'order_editor/order_total.php');
	 $order_total_modules = new order_total();
	 $order_totals = $order_total_modules->process();

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

yeah that is too easy.. actually the function i created returns an array .. tax_description would no longer just be a description but an array with a rate and description.. it does require some modification in the edit_orders.php file. ot_tax does not require any modification but ot_shipping and ot_loworderfee do

then of course oe_order.php needs to be modified

 

this is pretty much the change

 

ot_shipping.php

Line 52

		  $shipping_tax = tep_get_tax_rate($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
		  $shipping_tax_description = tep_get_tax_description($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
		  $order->info['tax'] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);
		  $order->info['tax_groups']["$shipping_tax_description"] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);

		  $order->info['total'] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);

 

TO

 

		  $shipping_tax = tep_get_tax_rate($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
		  // $shipping_tax_description = tep_get_tax_description($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
		  $shipping_tax_description = tep_get_tax_rate_description($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id'], array());

		  $order->info['tax'] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);
		  // $order->info['tax_groups']["$shipping_tax_description"] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);
		  foreach($shipping_tax_description as $desc => $tax_rate) {
			if($tax_rate != 0) {
				  $order->info['tax_groups']["$desc"] += tep_calculate_tax($order->info['shipping_cost'], $tax_rate);
			}
		  }

		  $order->info['total'] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);

 

you can see the basic way it functions with the foreach .. the function i created is also compounded taxes safe

 

So how about find in admin/order_editor/order.php find

		'tax_description' => 
			oe_get_tax_description($orders_products['products_tax_class_id'],  $this->delivery["country_id"], $this->delivery["zone_id"]),

and change it to

		'tax_description' => 
  tep_get_tax_rate_description($orders_products['products_tax_class_id'], $this->delivery["country_id"], $this->delivery["zone_id"], array()),

 

Then further down in the same file find

		  if (isset($this->info['tax_groups']["$products_tax_description"])) {
		 $this->info['tax_groups']["$products_tax_description"] += $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));
	   } else {
		 $this->info['tax_groups']["$products_tax_description"] = $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));
	   }
	 } else {
	   $this->info['tax'] += ($products_tax / 100) * $shown_price;
	   if (isset($this->info['tax_groups']["$products_tax_description"])) {
		 $this->info['tax_groups']["$products_tax_description"] += ($products_tax / 100) * $shown_price;
	   } else {
		 $this->info['tax_groups']["$products_tax_description"] = ($products_tax / 100) * $shown_price;
	   }
	 }

and change it to

if (isset($this->info['tax_groups']["$products_tax_description"])) {
  foreach($products_tax_rate_description as $desc => $tax_rate) {
	  if ($tax_rate != 0) {
		  $this->info['tax_groups']["$desc"] += ($tax_rate / 100) * $shown_price;
	  }
  }
 } else {
	  foreach($products_tax_rate_description as $desc => $tax_rate) {
	  if ($tax_rate != 0) {
		  $this->info['tax_groups']["$desc"] = ($tax_rate / 100) * $shown_price;
	  }
	  }
 }

 

(or something along those lines, I'm not sure I'm modifying all the correct ifs and elses there)

 

Modifying the edit_orders.php file of 5.0 for this shouldn't be necessary. It doesn't do any calculating, it just takes the output of the order total modules, compares it to whatever is in $_POST['update_totals'], figures out what goes where, and writes it to the database. The only place within the code that uses the function tep_get_tax_description (aka oe_get_tax_description) is the one time in admin/order_editor/order.php.

Edited by djmonkey1

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

So how about find in admin/order_editor/order.php find
		'tax_description' => 
			oe_get_tax_description($orders_products['products_tax_class_id'],  $this->delivery["country_id"], $this->delivery["zone_id"]),

and change it to

		'tax_description' => 
  tep_get_tax_rate_description($orders_products['products_tax_class_id'], $this->delivery["country_id"], $this->delivery["zone_id"], array()),

 

Then further down in the same file find

		  if (isset($this->info['tax_groups']["$products_tax_description"])) {
		 $this->info['tax_groups']["$products_tax_description"] += $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));
	   } else {
		 $this->info['tax_groups']["$products_tax_description"] = $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));
	   }
	 } else {
	   $this->info['tax'] += ($products_tax / 100) * $shown_price;
	   if (isset($this->info['tax_groups']["$products_tax_description"])) {
		 $this->info['tax_groups']["$products_tax_description"] += ($products_tax / 100) * $shown_price;
	   } else {
		 $this->info['tax_groups']["$products_tax_description"] = ($products_tax / 100) * $shown_price;
	   }
	 }

and change it to

if (isset($this->info['tax_groups']["$products_tax_description"])) {
  foreach($products_tax_rate_description as $desc => $tax_rate) {
	  if ($tax_rate != 0) {
		  $this->info['tax_groups']["$desc"] += ($tax_rate / 100) * $shown_price;
	  }
  }
 } else {
	  foreach($products_tax_rate_description as $desc => $tax_rate) {
	  if ($tax_rate != 0) {
		  $this->info['tax_groups']["$desc"] = ($tax_rate / 100) * $shown_price;
	  }
	  }
 }

 

(or something along those lines, I'm not sure I'm modifying all the correct ifs and elses there)

 

Modifying the edit_orders.php file of 5.0 for this shouldn't be necessary. It doesn't do any calculating, it just takes the output of the order total modules, compares it to whatever is in $_POST['update_totals'], figures out what goes where, and writes it to the database. The only place within the code that uses the function tep_get_tax_description (aka oe_get_tax_description) is the one time in admin/order_editor/order.php.

 

thats it exactly.. no its not used for calculations.. the tep_get_tax_rate is used for calculations.. but the function i created can be used for that I just didnt feel like doing so much recoding.. but its still perfect for having the tax descriptions seperate along with the individual tax rates..

Edited by insaini
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...