Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

NEW! Complete Order Editing Tool!


jhilgeman

Recommended Posts

You were right, djmonkey1. I'm missing some code in my admin/includes/classes/order.php. I have PayPal conrib and Product Description added to the $orders_products_query string, so this is how I modified my query. Please let me know if I'm missing anything.

 

Thanks,

Irina.

If I add p.products_tax_class_id to the $orders_products_query in admin/includes/classes/order.php, I'm getting an error that p.products_tax_class_id doesn't exist. Is it an omission in the database? In the install instructions it just says:

Run the following command on your MySQL database:

 

ALTER TABLE orders ADD shipping_tax DECIMAL( 7, 4 ) DEFAULT '0.000' NOT NULL ;

INSERT into configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) values ('', 'Order Editor- Display Payment Method dropdown?', 'DISPLAY_PAYMENT_METHOD_DROPDOWN', 'true', 'Display Payment Method in Order Editor as dropdown menu (true) or as input field (false)', '1', '21', NULL, '2006-04-02 11:51:01', NULL, 'tep_cfg_select_option(array(\'true\', \'false\'),');

If I remove p.products_tax_class_id from the query, it works ok.
Link to comment
Share on other sites

If I add p.products_tax_class_id to the $orders_products_query in admin/includes/classes/order.php, I'm getting an error that p.products_tax_class_id doesn't exist. Is it an omission in the database? In the install instructions it just says:

If I remove p.products_tax_class_id from the query, it works ok.

 

Try this for the $orders_products_query:

 

//begin PayPal_Shopping_Cart_IPN
$orders_products_query = tep_db_query("select op.orders_products_id, op.products_name, pd.products_description, op.products_model, op.products_price, op.products_tax, op.products_quantity, op.final_price, op.products_id, p.products_tax_class_id from " . TABLE_ORDERS_PRODUCTS . " as op, ". TABLE_PRODUCTS_DESCRIPTION. " as pd on op.products_id = pd.products_id, " . TABLE_PRODUCTS . " as p on op.products_id = p.products_id where orders_id = '" . (int)$order_id . "' and p.products_id=op.products_id and pd.language_id= '" . (int)$languages_id . "' and pd.products_id=op.products_id");
//end PayPal_Shopping_Cart_IPN

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 am having a problem with some overlapping code. DJmonkey can probably help me as he worked on both contributions I am installing. Order Editor and Purchase without account. Busy guy. And two great contributions.

To install purchase without account I need to change line 27 in catalog/admin/includes/classes/order.php from:

$order_query = tep_db_query("select customers_name, customers_company.....

to:

$order_query = tep_db_query("select customers_id, customers_name, .....

BUT, order editor has already altered that line to:

$order_query = tep_db_query("select * from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");

Can someone help me fix this? I am relatively new to php and OSC. I would also like to know what the "*" stands for in the order editor line.

Thank you very much,

Todd

 

"*" is a wildcard that tells the query to pull every field from the db- just use the "*". and you'll never have to edit that line again.

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

Hello... I just installed version 2.3 of the order editing tool and get the following error message when I try to edit an order:

 

Fatal error: Call to a member function on a non-object in /home/xxxxxxx/includes/modules/payment/freeofcharge.php on line 42

 

This is the line in the freeofcharge module that dynamically turnes this contrib off if the sum total of the order is <.01:

 

if ($cart->show_total() >= 0.01) {

$this->enabled = false;

 

Why would this cause it to be incompatible with the order editor?

 

Any thoughts?

 

Thanks!

 

Scott

 

How long ago did you install this payment module? What version of PHP are you running?

 

At this point I don't think it's likely that the problem you've described is caused by Order Editor. Payment modules live on the catalog side, and Order Editor lives on the admin side, and rarely do the twain meet.

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.... there are! :blink:

And I didn't change anything, except the language file to Portuguese.

Check it out:

oe.gif

 

There must be some kind of poltergeist around here, for I couldn't figure out the rounding problem yet and I found out that my test store on my local server is having the same problem! :o

 

I uploaded a fix for the help buttons, 2.4.1. For your poltergeist, maybe you should call Ghostbusters? :)

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

Hello again.

 

Just updated to v2.4. It didn't fix the problem I'm having with the rounded values, but now it shows the correct price for product in the product_price, but all other values are rounded down.

 

I had to correct all subtotals and totals manually on phpMyAdmin because OE is not updating the calculations, although it does corrects the prices. Is this a known bug?

 

I was searching the forums and found a thread about a PHP bug related to rounding numbers, maybe it has something to do with my problem? http://www.oscommerce.com/forums/index.php?showtopic=173656&st=0

 

Another thing I noticed in the new version is that nothing happens when I click on the help buttons. There's a javascript error on the page.

 

This isn't something that Order Editor will do in any normal situation- it does all it's own calculations. A PHP or server configuration bug seems like the most likely explanation at this point. What version of PHP is running on your server, and has it been changed recently?

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

Damn! The edit feature vanishes too fast!! :angry:

 

What about OE not recalculating the corrected values and keeping the same order total from before the correction?? Isn't OE supposed to recalculate the new values?

 

After you've edited an order using Order Editor and you see that the total is being rounded compare the entries for 'value' and 'text' in the table 'orders_total' for that line item. Are they both rounded, or just one of them?

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

Just updated to v2.4. It didn't fix the problem I'm having with the rounded values, but now it shows the correct price for product in the product_price, but all other values are rounded down.

 

product_price is not a calculated value- it's whatever the catalog price for that item was at the time of checkout. So if you have a rounding bug (it sounds like you do), final_price, a calculated value, is being rounded.

 

Order Editor doesn't change anything in the db unless you press "Update". When you first open an order using Order Editor, it's showing you exactly what's in the database for those values.

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

How long ago did you install this payment module? What version of PHP are you running?

 

At this point I don't think it's likely that the problem you've described is caused by Order Editor. Payment modules live on the catalog side, and Order Editor lives on the admin side, and rarely do the twain meet.

 

Thanks for the reply... It's been installed for about 1 year. PHP Version 4.4.3-dev and PHP 5.1.2 are both listed on my server.

 

Scott

Link to comment
Share on other sites

I uploaded a fix for the help buttons, 2.4.1. For your poltergeist, maybe you should call Ghostbusters? :)

I guess I have no other option at this point. :rolleyes:

Tks for the fix, but now there are no hints or help texts whatsoever. :(

 

This isn't something that Order Editor will do in any normal situation- it does all it's own calculations. A PHP or server configuration bug seems like the most likely explanation at this point. What version of PHP is running on your server, and has it been changed recently?

My client's store is on a Linux with PHP version 4.3.11 and MySQL version 4.1.18-standard-log. That PHP version was installed back in October. The problem started to happen on Mar 29 as far as I can tell.

My local server is a WinXP Pro with PHP version 4.4.1 and MySQL version 5.0.18.

 

So I guess that PHP bug or server issues are not the case here. I've added some contributions to my client's store and to my own test store in the last few days, but for the life of me I can't find anything on them that would affect the calculation or the db for that matter. I even tried installing them one by one on another hosted test store and can't replicate the problem. I have other stores hosted on the same server, same version, and none of them have this problem.

 

I really don't know what to do at this point...

 

After you've edited an order using Order Editor and you see that the total is being rounded compare the entries for 'value' and 'text' in the table 'orders_total' for that line item. Are they both rounded, or just one of them?

 

Just the 'value' is rounded. text is the right amount, the original sum. I guess that's what's being sent on the confirmation email and that's why it shows the correct values and calculations. But when it comes to see them on admin, that's when the rounded numbers show.

 

01.gif

 

02.gif

 

 

product_price is not a calculated value- it's whatever the catalog price for that item was at the time of checkout. So if you have a rounding bug (it sounds like you do), final_price, a calculated value, is being rounded.

 

Order Editor doesn't change anything in the db unless you press "Update". When you first open an order using Order Editor, it's showing you exactly what's in the database for those values.

 

I know OE is not causing this, because I don't have it on my local test store that is having the same rounding problem. But maybe you can help me find what's causing this, since it seems to be related to whatever is preventing OE to update the values on the db after fixing the prices. You see, OE does change the prices for the products on the db. So if it does that, the calculation should be updated too, but it's not. Like I said above, the 'value' amount is the rounded one and it's not being changed by OE, so I figure that's why the total is not being corrected on OE (although it stands corrected on the details page. Maybe details is getting its total from 'text' while OE is getting it from 'value"?)

 

If you feel like having some fun :rolleyes: , I can zip my test store and db and send it to you, so you can dig in and try to find what can be wrong. Let me know. One thing though: the store is all adapted to Portuguese and there's no English version in it. :-"

Edited by Patty

Patty

Link to comment
Share on other sites

Try this for the $orders_products_query:

 

//begin PayPal_Shopping_Cart_IPN
$orders_products_query = tep_db_query("select op.orders_products_id, op.products_name, pd.products_description, op.products_model, op.products_price, op.products_tax, op.products_quantity, op.final_price, op.products_id, p.products_tax_class_id from " . TABLE_ORDERS_PRODUCTS . " as op, ". TABLE_PRODUCTS_DESCRIPTION. " as pd on op.products_id = pd.products_id, " . TABLE_PRODUCTS . " as p on op.products_id = p.products_id where orders_id = '" . (int)$order_id . "' and p.products_id=op.products_id and pd.language_id= '" . (int)$languages_id . "' and pd.products_id=op.products_id");
//end PayPal_Shopping_Cart_IPN

When I run the above query in my order.php, I'm getting the following error in edit_orders.php:

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'on op.products_id = pd.products_id, products as p on op.products

 

select op.orders_products_id, op.products_name, p.products_description, op.products_model, op.products_price, op.products_tax, op.products_quantity, op.final_price, op.products_id, p.products_tax_class_id from orders_products as op, products_description as p on op.products_id = pd.products_id, products as p on op.products_id = p.products_id where orders_id = '135' and p.products_id=op.products_id and pd.language_id= '1' and pd.products_id=op.products_id

 

[TEP STOP]

What else can I try?

 

Thanks,

Irin.

Link to comment
Share on other sites

Please don't hotlink to images in password protected directories.

 

For your problem, post your shop setting of Display Prices with Tax as well as how many tax classes you use, with the number of tax rates in each class.

 

Sorry about image!

 

i dont understand what you mean by "diplay prices.." settings? At "my store" there is selection

Display Prices with Tax and it is set true.

So that is set true. I only use one tax class. That is 22%. And its valid for every customer. Then i have posting what is also taxed with 22%. Then there is one payment method (COD) what adds 3.60? into orders and that is also taxed with 22%.

if you need to see that image give me intructions where to mail it or how to post it.

Link to comment
Share on other sites

When I run the above query in my order.php, I'm getting the following error in edit_orders.php:

What else can I try?

 

Thanks,

Irin.

 

Sorry about that. Use this for the query:

$orders_products_query = tep_db_query("
 select 
 op.orders_products_id, 
 op.products_name, 
 op.products_model, 
 op.products_price,
 op.products_tax, 
 op.products_quantity, 
 op.final_price, 
 p.products_tax_class_id,
 pd.products_description
 from " . TABLE_ORDERS_PRODUCTS . " op
 join " . TABLE_PRODUCTS . " p
on op.products_id = p.products_id
 join " . TABLE_PRODUCTS_DESCRIPTION . " pd
on op.products_id = pd.products_id
where orders_id = '" . (int)$order_id . "'");

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

Hi,

 

I also have the Paypal IPN 3.15 installed, and my fundctions/order.php of the orders_products_query section and of the attributes_query look like this:

 

//begin PayPal_Shopping_Cart_IPN
$orders_products_query = tep_db_query("select orders_products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price, products_id from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'");
//end PayPal_Shopping_Cart_IPN
  while ($orders_products = tep_db_fetch_array($orders_products_query)) {
	$this->products[$index] = array('qty' => $orders_products['products_quantity'],
//begin PayPal_Shopping_Cart_IPN
								'id' => $orders_products['products_id'],
								'orders_products_id' => $orders_products['orders_products_id'],
//end PayPal_Shopping_Cart_IPN
									'name' => $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']);

	$subindex = 0;

//begin PayPal_Shopping_Cart_IPN
$attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix, products_options_id, products_options_values_id from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$order_id . "' and orders_products_id = '" . (int)$orders_products['orders_products_id'] . "'");
//end PayPal_Shopping_Cart_IPN

	if (tep_db_num_rows($attributes_query)) {
	  while ($attributes = tep_db_fetch_array($attributes_query)) {
		$this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'],
//begin PayPal_Shopping_Cart_IPN
														'option_id' => $attributes['products_options_id'],
														'value_id' => $attributes['products_options_values_id'],
//end PayPal_Shopping_Cart_IPN
																 'value' => $attributes['products_options_values'],
																 'prefix' => $attributes['price_prefix'],
																 'price' => $attributes['options_values_price']);

		$subindex++;
	  }
	}
	$index++;
  }
}
 }

 

I read the reply about how to edit the orders_products_query

How should I edit the attributes_query section to make it work with the order editor 2.4?

 

TIA :-)

Mikey

Edited by dr_lucas
Link to comment
Share on other sites

Sorry about image!

 

i dont understand what you mean by "diplay prices.." settings? At "my store" there is selection

Display Prices with Tax and it is set true.

So that is set true. I only use one tax class. That is 22%. And its valid for every customer. Then i have posting what is also taxed with 22%. Then there is one payment method (COD) what adds 3.60? into orders and that is also taxed with 22%.

if you need to see that image give me intructions where to mail it or how to post it.

 

An image is the best way to go because I don't understand what the problem is.

 

You can hotlink to screenshots in a public directory (Patty did it a few posts up), just don't hotlink to something in a password protected directory. It doesn't do anyone any good.

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

An image is the best way to go because I don't understand what the problem is.

 

You can hotlink to screenshots in a public directory (Patty did it a few posts up), just don't hotlink to something in a password protected directory. It doesn't do anyone any good.

 

Ok.

Here it is.

orde_ed.jpg

Link to comment
Share on other sites

Hi,

 

I also have the Paypal IPN 3.15 installed, and my fundctions/order.php of the orders_products_query section and of the attributes_query look like this:

 

//begin PayPal_Shopping_Cart_IPN
$orders_products_query = tep_db_query("select orders_products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price, products_id from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'");
//end PayPal_Shopping_Cart_IPN
  while ($orders_products = tep_db_fetch_array($orders_products_query)) {
	$this->products[$index] = array('qty' => $orders_products['products_quantity'],
//begin PayPal_Shopping_Cart_IPN
								'id' => $orders_products['products_id'],
								'orders_products_id' => $orders_products['orders_products_id'],
//end PayPal_Shopping_Cart_IPN
									'name' => $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']);

	$subindex = 0;

//begin PayPal_Shopping_Cart_IPN
$attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix, products_options_id, products_options_values_id from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$order_id . "' and orders_products_id = '" . (int)$orders_products['orders_products_id'] . "'");
//end PayPal_Shopping_Cart_IPN

	if (tep_db_num_rows($attributes_query)) {
	  while ($attributes = tep_db_fetch_array($attributes_query)) {
		$this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'],
//begin PayPal_Shopping_Cart_IPN
														'option_id' => $attributes['products_options_id'],
														'value_id' => $attributes['products_options_values_id'],
//end PayPal_Shopping_Cart_IPN
																 'value' => $attributes['products_options_values'],
																 'prefix' => $attributes['price_prefix'],
																 'price' => $attributes['options_values_price']);

		$subindex++;
	  }
	}
	$index++;
  }
}
 }

 

I read the reply about how to edit the orders_products_query

How should I edit the attributes_query section to make it work with the order editor 2.4?

 

TIA :-)

Mikey

 

//modifed for Order Editor 2.4 and PayPal IPN 3.15
$orders_products_query = tep_db_query("
 select 
 op.orders_products_id, 
op.products_id,
 op.products_name, 
 op.products_model, 
 op.products_price,
 op.products_tax, 
 op.products_quantity, 
 op.final_price, 
 p.products_tax_class_id,
 from " . TABLE_ORDERS_PRODUCTS . " op
 join " . TABLE_PRODUCTS . " p
on op.products_id = p.products_id
 where orders_id = '" . (int)$order_id . "'");

while ($orders_products = tep_db_fetch_array($orders_products_query)) {
	 $this->products[$index] = array('qty' => $orders_products['products_quantity'],
									 'id' => $orders_products['products_id'],
									 'name' => $orders_products['products_name'],
									 'model' => $orders_products['products_model'],
									 'tax' => $orders_products['products_tax'],
	'tax_description' => tep_get_tax_rates_description($orders_products['products_tax_class_id']),
									 'price' => $orders_products['products_price'],
									 'final_price' => $orders_products['final_price'],
							   'orders_products_id' => $orders_products['orders_products_id']);

$subindex = 0;
	$attributes_query = tep_db_query("select * from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$order_id . "' and orders_products_id = '" . (int)$orders_products['orders_products_id'] . "'");
	if (tep_db_num_rows($attributes_query)) {
	  while ($attributes = tep_db_fetch_array($attributes_query)) {
		$this->products[$index]['attributes'][$subindex] = 
		array('option' => $attributes['products_options'],
			  'value' => $attributes['products_options_values'],
					 'option_id' => $attributes['products_options_id'],
				 'value_id' => $attributes['products_options_values_id'],
			  'prefix' => $attributes['price_prefix'],
			 'price' => $attributes['options_values_price'],
	  'orders_products_attributes_id' => $attributes['orders_products_attributes_id']);

		$subindex++;
	  }
	}
	$index++;
  }
}
 }
//End Order Editor and PayPal IPN

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

Ok.

Here it is.

 

It looks fine to me. Enter 22 into the shipping tax box and hit update.

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

You were right, djmonkey1. I'm missing some code in my admin/includes/classes/order.php. I have PayPal conrib and Product Description added to the $orders_products_query string, so this is how I modified my query. Please let me know if I'm missing anything.

 

Thanks,

Irina.

 

Irina- my previous post containing a proposed $orders_query was missing a field. Use this for the whole thing:

 

//modifed for Order Editor 2.4, Products Description, and PayPal IPN
$orders_products_query = tep_db_query("
 select 
 op.orders_products_id, 
op.products_id,
 op.products_name, 
 op.products_model, 
 op.products_price,
 op.products_tax, 
 op.products_quantity, 
 op.final_price, 
 p.products_tax_class_id,
pd.products_description
 from " . TABLE_ORDERS_PRODUCTS . " op
join " . TABLE_PRODUCTS_DESCRIPTION . " pd
on op.products_id = p.products_id
 join " . TABLE_PRODUCTS . " p
on op.products_id = p.products_id
 where orders_id = '" . (int)$order_id . "'");

while ($orders_products = tep_db_fetch_array($orders_products_query)) {
	 $this->products[$index] = array('qty' => $orders_products['products_quantity'],
									 'id' => $orders_products['products_id'],
									 'name' => $orders_products['products_name'],
									 'model' => $orders_products['products_model'],
									 'tax' => $orders_products['products_tax'],
									'description' => $orders_products['products_description'],
	'tax_description' => tep_get_tax_rates_description($orders_products['products_tax_class_id']),
									 'price' => $orders_products['products_price'],
									 'final_price' => $orders_products['final_price'],
							   'orders_products_id' => $orders_products['orders_products_id']);

$subindex = 0;
 $attributes_query = tep_db_query("select * from " .  TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" .  (int)$order_id . "' and orders_products_id = '" .  (int)$orders_products['orders_products_id'] . "'");
	if (tep_db_num_rows($attributes_query)) {
	  while ($attributes = tep_db_fetch_array($attributes_query)) {
		$this->products[$index]['attributes'][$subindex] = 
		array('option' => $attributes['products_options'],
			  'value' => $attributes['products_options_values'],
					 'option_id' => $attributes['products_options_id'],
				 'value_id' => $attributes['products_options_values_id'],
			  'prefix' => $attributes['price_prefix'],
			 'price' => $attributes['options_values_price'],
	  'orders_products_attributes_id' => $attributes['orders_products_attributes_id']);

		$subindex++;
	  }
	}
	$index++;
  }
}
 }
//End Order Editor, Products Description and PayPal IPN

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

Ok.

Here it is.

 

Wait- it's entering the total into the tax field? That's absurd. Are you seeing this before of after using Order Editor to update the order?

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

Hi,

 

I also have the Paypal IPN 3.15 installed, and my fundctions/order.php of the orders_products_query section and of the attributes_query look like this:

 

I read the reply about how to edit the orders_products_query

How should I edit the attributes_query section to make it work with the order editor 2.4?

 

TIA :-)

Mikey

 

Mikey- there is an error in my last post regarding this (no more early morning coding sessions for Stew!).

 

The line

p.products_tax_class_id,

is incorrect, there should not be a comma.

 

That line should just be

p.products_tax_class_id

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

Wait- it's entering the total into the tax field? That's absurd. Are you seeing this before of after using Order Editor to update the order?

This is just when i first time open OE. When i hit update it adds that total from tax line into new total so its about douple.

Here is shot after i remove one item from this order.

orde_ed2.jpg

Link to comment
Share on other sites

//modifed for Order Editor 2.4 and PayPal IPN 3.15
$orders_products_query = tep_db_query("
 select 
 op.orders_products_id, 
op.products_id,
 op.products_name, 
 op.products_model, 
 op.products_price,
 op.products_tax, 
 op.products_quantity, 
 op.final_price, 
 p.products_tax_class_id,
 from " . TABLE_ORDERS_PRODUCTS . " op
 join " . TABLE_PRODUCTS . " p
on op.products_id = p.products_id
 where orders_id = '" . (int)$order_id . "'");

while ($orders_products = tep_db_fetch_array($orders_products_query)) {
	 $this->products[$index] = array('qty' => $orders_products['products_quantity'],
									 'id' => $orders_products['products_id'],
									 'name' => $orders_products['products_name'],
									 'model' => $orders_products['products_model'],
									 'tax' => $orders_products['products_tax'],
	'tax_description' => tep_get_tax_rates_description($orders_products['products_tax_class_id']),
									 'price' => $orders_products['products_price'],
									 'final_price' => $orders_products['final_price'],
							   'orders_products_id' => $orders_products['orders_products_id']);

$subindex = 0;
	$attributes_query = tep_db_query("select * from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$order_id . "' and orders_products_id = '" . (int)$orders_products['orders_products_id'] . "'");
	if (tep_db_num_rows($attributes_query)) {
	  while ($attributes = tep_db_fetch_array($attributes_query)) {
		$this->products[$index]['attributes'][$subindex] = 
		array('option' => $attributes['products_options'],
			  'value' => $attributes['products_options_values'],
					 'option_id' => $attributes['products_options_id'],
				 'value_id' => $attributes['products_options_values_id'],
			  'prefix' => $attributes['price_prefix'],
			 'price' => $attributes['options_values_price'],
	  'orders_products_attributes_id' => $attributes['orders_products_attributes_id']);

		$subindex++;
	  }
	}
	$index++;
  }
}
 }
//End Order Editor and PayPal IPN

 

Thanks for the quick response.

I tried this code and I am now getting the following SQL error:

1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'from orders_products op join products p on op.products_id = p.p

 

select op.orders_products_id, op.products_id, op.products_name, op.products_model, op.products_price, op.products_tax, op.products_quantity, op.final_price, p.products_tax_class_id, from orders_products op join products p on op.products_id = p.products_id where orders_id = '14225'

 

How can I fix that?

Link to comment
Share on other sites

I guess I have no other option at this point. :rolleyes:

Tks for the fix, but now there are no hints or help texts whatsoever. :(

Well, were they that much of a help in the first place? :)

 

My client's store is on a Linux with PHP version 4.3.11 and MySQL version 4.1.18-standard-log. That PHP version was installed back in October. The problem started to happen on Mar 29 as far as I can tell.

My local server is a WinXP Pro with PHP version 4.4.1 and MySQL version 5.0.18.

 

So I guess that PHP bug or server issues are not the case here. I've added some contributions to my client's store and to my own test store in the last few days, but for the life of me I can't find anything on them that would affect the calculation or the db for that matter. I even tried installing them one by one on another hosted test store and can't replicate the problem. I have other stores hosted on the same server, same version, and none of them have this problem.

 

I really don't know what to do at this point...

I'm pretty flummoxed here too. As we see below, all the values are being rounded down, which is the very specific result of using the float command "floor()" in PHP or "Math.floor()" in JavaScript, neither of which are used in Order Editor, therefore once again leading me to believe it's a server issue, whether or not it's happening on two different servers at the same time.

 

Just the 'value' is rounded. text is the right amount, the original sum. I guess that's what's being sent on the confirmation email and that's why it shows the correct values and calculations. But when it comes to see them on admin, that's when the rounded numbers show.

 

01.gif

 

02.gif

 

 

I know OE is not causing this, because I don't have it on my local test store that is having the same rounding problem. But maybe you can help me find what's causing this, since it seems to be related to whatever is preventing OE to update the values on the db after fixing the prices. You see, OE does change the prices for the products on the db. So if it does that, the calculation should be updated too, but it's not. Like I said above, the 'value' amount is the rounded one and it's not being changed by OE, so I figure that's why the total is not being corrected on OE (although it stands corrected on the details page. Maybe details is getting its total from 'text' while OE is getting it from 'value"?)

 

The answer to that last question is "Yes". Also, because text is the formatted display of the value field, we know that Order Editor is calculating the prices correctly.

 

If you feel like having some fun :rolleyes: , I can zip my test store and db and send it to you, so you can dig in and try to find what can be wrong. Let me know. One thing though: the store is all adapted to Portuguese and there's no English version in it. :-"

 

Sorry- I'm mono-linguistic.

 

Try this:

 

Find at about line 429 the code that sets the ot_value for the subtotal that is written to the db:

 

$ot_value = $RunningSubTotal;

 

and change it to this:

 

$ot_value = sprintf("%f", $RunningSubTotal);

 

and see what happens when you update the order with Order Editor.

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

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...