Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

NEW! Complete Order Editing Tool!


jhilgeman

Recommended Posts

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?

 

Did you already read this:

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

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.

 

I think I see what is happening- the 'class' value of your tax total is not "ot_tax", it's something custom like "ot_vat" or "ot_alv". Order Editor sees that as a custom order total amount and throws it in with the final total, and re-calculates tax (6.31) along the way (pretty neat actually, it's working exactly as it's supposed to).

 

Post a screenshot of your table 'orders_total' from an order before it has been edited with Order Editor (make sure you sort by orders_id so we can see all the entries from one order grouped together). I would like to see exactly what is written to the database for an order by the checkout process so I can come up with custom code for you.

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 think I see what is happening- the 'class' value of your tax total is not "ot_tax", it's something custom like "ot_vat" or "ot_alv". Order Editor sees that as a custom order total amount and throws it in with the final total, and re-calculates tax (6.31) along the way (pretty neat actually, it's working exactly as it's supposed to).

 

Post a screenshot of your table 'orders_total' from an order before it has been edited with Order Editor (make sure you sort by orders_id so we can see all the entries from one order grouped together). I would like to see exactly what is written to the database for an order by the checkout process so I can come up with custom code for you.

Ok here is image. Latest order is not opened with OE.

orde_ed3.jpg

Link to comment
Share on other sites

Did you already read this:

 

Thanks A LOT, mate, seems to be working fine now! :D

You're a VERY helpful person... :thumbsup:

Link to comment
Share on other sites

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

The way I had it set, yes, it did help. Can you please tell me how to put it back? :blush:

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.

In that case, why it doesn't happen to all other stores on the same server, just on this one? And only from few days ago? This problem didn't happen before and there have been no changes in the server to justify that. :huh:

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.

Nothing happens. OE still doesn't update the total in the db, just the individual prices. >_<

I'm no programmer, so I don't know how these things work, but I do know there is something somewhere that is preventing OE to update the total in the db. What and where are the main questions now. :blink:

We need to try something else. Please??? :rolleyes:

Patty

Link to comment
Share on other sites

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

Hi djmonkey1. The above query doesn't work for me either. All my orders are messed up now. This is how all my orders are listed now:

Qty. Products Model Product Description Tax Price (ex) Price (inc) Total (ex) Total (inc)

1 x LCD Kit BB-09 cable 0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 AC Adaptor 0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 LCD Module 0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 Controller 0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 Controller 0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 LCD Module 0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 LCD Module 0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 LCD Module 0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 LCD Module 0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 LCD Module 0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 LCD Module 0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 LCD Module 0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 LCD Module 0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 LCD Module 0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 LCD Module 0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 LCD Kit:

* LCD Module

* AC Adaptor

* Serial Cable

 

0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 Controller 0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 AC Adaptor 0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 LCD Module 0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 LCD Kit:

* LCD Module

* AC Adaptor

* Serial Cable

 

0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 LCD Kit:

* LCD Module

* AC Adaptor

* Serial Cable

 

0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 LCD Kit:

* LCD Module

* AC Adaptor

* Serial Cable

 

0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 LCD Kit:

* LCD Module

* AC Adaptor

* Serial Cable

 

0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 LCD Kit:

* LCD Module

* AC Adaptor

* Serial Cable

 

0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 LCD Kit:

* LCD Module

* AC Adaptor

* Serial Cable

 

0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 LCD Kit:

* LCD Module

* AC Adaptor

* Serial Cable

 

0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 LCD Kit:

* LCD Module

* AC Adaptor

* Serial Cable

 

0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 TouchScreen 0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 TouchScreen 0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 AC Adaptor 0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 LCD Module 0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 LCD 0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 LCD 0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 LCD 0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 LCD 0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 LCD 0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 LCD 0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 LCD 0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 LCD 0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 Touch Screen 0.00% $237.00 $237.00 $237.00 $237.00

1 x LCD Kit BB-09 Touch Screen 0.00% $237.00 $237.00 $237.00 $237.00

Sub-Total: $237.00

Handling Fee: $5.00

Federal Express (1 x 2.2lbs) (Ground Service (3 days)): $6.90

Shipping Insurance: $4.20

Total: $253.10

I think there is something to do with p.language_id= '" . (int)$languages_id . "' being removed and I need to have my p.products_description as p not pd. I need to have them both, like I had before:

TABLE_PRODUCTS_DESCRIPTION. " as p where orders_id = '" . (int)$order_id . "' and p.language_id= '" . (int)$languages_id . "' and p.products_id=op.products_id");

Any other ideas?

Link to comment
Share on other sites

Ok here is image. Latest order is not opened with OE.

 

Ok- do a find and replace for the term "ot_tax" in your Order Editor file. For every instance of the term "ot_tax" replace it with "ot_total_moms".

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 djmonkey1. The above query doesn't work for me either. All my orders are messed up now. This is how all my orders are listed now:

 

I think there is something to do with p.language_id= '" . (int)$languages_id . "' being removed and I need to have my p.products_description as p not pd. I need to have them both, like I had before:

 

Any other ideas?

 

Irina-

 

The little letters can be any letters, as long as they're used consistently.

 

This is progress- at least you're not getting a syntax error!

 

Anyway, try this:

 

$index = 0;
//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 = pd.products_id
 join " . TABLE_PRODUCTS . " p
on op.products_id = p.products_id
 where orders_id = '" . (int)$order_id . "'
and pd.language_id= '" . (int)$languages_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

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

 

Go to admin->configuration->My store and set the Order Editor Payment Method Dropdown option to 'false'.

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

The way I had it set, yes, it did help. Can you please tell me how to put it back? :blush:

 

In that case, why it doesn't happen to all other stores on the same server, just on this one? And only from few days ago? This problem didn't happen before and there have been no changes in the server to justify that. :huh:

 

Nothing happens. OE still doesn't update the total in the db, just the individual prices. >_<

I'm no programmer, so I don't know how these things work, but I do know there is something somewhere that is preventing OE to update the total in the db. What and where are the main questions now. :blink:

We need to try something else. Please??? :rolleyes:

 

Try adding a product or two to an order to see how the order totals change. I'm willing to bet that they will, but the 'value' field will be rounded down. OE is not being prevented from updating the database, however it's calculations are being rounded. All of the form inputs for products prices are straight data input, there is no PHP calculation done on any of them (JavaScript, yes, but that is displayed in real time, not submitted to the server). Subtotal, etc, are all calculated by the PHP code.

 

Also at about line 459 change

 

value = '" . $ot_value . "',

 

to

 

value = '" . sprintf("%f", $ot_value) . "',

 

Keep the same change for the SubTotal for now. See if this affects anything.

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

Irina-

 

The little letters can be any letters, as long as they're used consistently.

 

This is progress- at least you're not getting a syntax error!

 

Anyway, try this:

 

$index = 0;
//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 = pd.products_id
 join " . TABLE_PRODUCTS . " p
on op.products_id = p.products_id
 where orders_id = '" . (int)$order_id . "'
and pd.language_id= '" . (int)$languages_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

Hi djmonkey1. It works great this time :thumbsup: Thanks a lot for your help. I'm looking forward for any new updates to this great contribution :rolleyes:

Link to comment
Share on other sites

Ok- do a find and replace for the term "ot_tax" in your Order Editor file. For every instance of the term "ot_tax" replace it with "ot_total_moms".

 

Here is result:

First it showed that tax (alv%) again in same amount than total

orde_ed4.jpg

 

then i went and again removed one item and now it seemed correct that but tax was wrong

orde_ed5.jpg

 

ok i forget to manually add tax so i did and hitted update button this happend. Now it calculates that tax wrongly. There is correct amount in side.

orde_ed6.jpg

Link to comment
Share on other sites

Here is result:

First it showed that tax (alv%) again in same amount than total

 

then i went and again removed one item and now it seemed correct that but tax was wrong

 

ok i forget to manually add tax so i did and hitted update button this happend. Now it calculates that tax wrongly. There is correct amount in side.

 

I'm going to take a wild stab at this and say what is missing from the tax total is the tax on Postienakko (22% of 3,00 Euros = 0,66 Euros) and that the class for this is always ot_fixed_payment_chg.

 

Find this code at about line 316:

// 1.4.0.1 Shipping Tax

		if (is_array ($_POST['update_totals'])){
		foreach($_POST['update_totals'] as $total_index => $total_details)
		{
			extract($total_details,EXTR_PREFIX_ALL,"ot");
			if($ot_class == "ot_shipping")
			{
				if (DISPLAY_PRICE_WITH_TAX == 'true') {
		//the value of ot_shipping already includes tax, so we have to extract the base value then redo the tax calcs
		$RunningTax[$default_tax_name] += ($ot_value * $_POST['update_shipping_tax']) / ($_POST['update_shipping_tax'] + 100);
				} else {
$RunningTax[$default_tax_name] += (($_POST['update_shipping_tax'] / 100) * $ot_value);
				}
			}
		  }
		}

 

Change the line that reads

if($ot_class == "ot_shipping")

to

if($ot_class == "ot_shipping" || $ot_class == "ot_fixed_payment_chg")

 

 

Then find this section of code at about line 640:

//just adding in shipping tax, don't mind me
		$ot_shipping_query = tep_db_query("select value as value from " . TABLE_ORDERS_TOTAL . " where class= 'ot_shipping' and orders_id = '" . (int)$oID . "'");
		$ot_shipping_value = tep_db_fetch_array($ot_shipping_query);


	if (DISPLAY_PRICE_WITH_TAX == 'true') {
		$RunningTax[$default_tax_name] += ($ot_shipping_value['value'] / (($order->info['shipping_tax'] / 100) + 1)) * ($order->info['shipping_tax'] / 100);
			} else {
		$RunningTax[$default_tax_name] += (($order->info['shipping_tax'] / 100) * $ot_shipping_value['value']);
				}

 

and add this directly below it:

//custom mod for fixed_payment_chg
		$ot_fixed_payment_query = tep_db_query("select value as value from " . TABLE_ORDERS_TOTAL . " where class= 'ot_fixed_payment_chg' and orders_id = '" . (int)$oID . "'");
		$ot_fixed_payment_value = tep_db_fetch_array($ot_fixed_payment_query);


	if (DISPLAY_PRICE_WITH_TAX == 'true') {
		$RunningTax[$default_tax_name] += ($ot_fixed_payment_value['value'] / (($order->info['shipping_tax'] / 100) + 1)) * ($order->info['shipping_tax'] / 100);
			} else {
		$RunningTax[$default_tax_name] += (($order->info['shipping_tax'] / 100) * $ot_fixed_payment_value['value']);
				}
//end fixed_payment_chg

 

And that should do it....

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 going to take a wild stab at this and say what is missing from the tax total is the tax on Postienakko (22% of 3,00 Euros = 0,66 Euros) and that the class for this is always ot_fixed_payment_chg.

 

Find this code at about line 316:

// 1.4.0.1 Shipping Tax

		if (is_array ($_POST['update_totals'])){
		foreach($_POST['update_totals'] as $total_index => $total_details)
		{
			extract($total_details,EXTR_PREFIX_ALL,"ot");
			if($ot_class == "ot_shipping")
			{
				if (DISPLAY_PRICE_WITH_TAX == 'true') {
		//the value of ot_shipping already includes tax, so we have to extract the base value then redo the tax calcs
		$RunningTax[$default_tax_name] += ($ot_value * $_POST['update_shipping_tax']) / ($_POST['update_shipping_tax'] + 100);
				} else {
$RunningTax[$default_tax_name] += (($_POST['update_shipping_tax'] / 100) * $ot_value);
				}
			}
		  }
		}

 

Change the line that reads

if($ot_class == "ot_shipping")

to

if($ot_class == "ot_shipping" || $ot_class == "ot_fixed_payment_chg")

Then find this section of code at about line 640:

//just adding in shipping tax, don't mind me
		$ot_shipping_query = tep_db_query("select value as value from " . TABLE_ORDERS_TOTAL . " where class= 'ot_shipping' and orders_id = '" . (int)$oID . "'");
		$ot_shipping_value = tep_db_fetch_array($ot_shipping_query);


	if (DISPLAY_PRICE_WITH_TAX == 'true') {
		$RunningTax[$default_tax_name] += ($ot_shipping_value['value'] / (($order->info['shipping_tax'] / 100) + 1)) * ($order->info['shipping_tax'] / 100);
			} else {
		$RunningTax[$default_tax_name] += (($order->info['shipping_tax'] / 100) * $ot_shipping_value['value']);
				}

 

and add this directly below it:

//custom mod for fixed_payment_chg
		$ot_fixed_payment_query = tep_db_query("select value as value from " . TABLE_ORDERS_TOTAL . " where class= 'ot_fixed_payment_chg' and orders_id = '" . (int)$oID . "'");
		$ot_fixed_payment_value = tep_db_fetch_array($ot_fixed_payment_query);


	if (DISPLAY_PRICE_WITH_TAX == 'true') {
		$RunningTax[$default_tax_name] += ($ot_fixed_payment_value['value'] / (($order->info['shipping_tax'] / 100) + 1)) * ($order->info['shipping_tax'] / 100);
			} else {
		$RunningTax[$default_tax_name] += (($order->info['shipping_tax'] / 100) * $ot_fixed_payment_value['value']);
				}
//end fixed_payment_chg

 

And that should do it....

 

I think we are (or actually you are) getting close. Now it seemed calculate it right when i removed this one item (yet still there is in very first time i open OE that total amount in tax row). But when i tried to add product i got this:

Warning: Cannot use a scalar value as an array in /****/edit_orders.php on line 676

 

Warning: Cannot modify header information - headers already sent by (output started at /****/admin/edit_orders.php:676) in /****/admin/includes/functions/general.php on line 20

 

So its pointing into this last addition. Any ideas?

Link to comment
Share on other sites

I think we are (or actually you are) getting close. Now it seemed calculate it right when i removed this one item (yet still there is in very first time i open OE that total amount in tax row). But when i tried to add product i got this:

Warning: Cannot use a scalar value as an array in /****/edit_orders.php on line 676

 

Warning: Cannot modify header information - headers already sent by (output started at /****/admin/edit_orders.php:676) in /****/admin/includes/functions/general.php on line 20

 

So its pointing into this last addition. Any ideas?

 

I just set up this exact scenario on my test store and it worked fine, no errors. The whole section in question should look like this:

 

//just adding in shipping tax, don't mind me
		$ot_shipping_query = tep_db_query("select value as value from " . TABLE_ORDERS_TOTAL . " where class= 'ot_shipping' and orders_id = '" . (int)$oID . "'");
		$ot_shipping_value = tep_db_fetch_array($ot_shipping_query);


	if (DISPLAY_PRICE_WITH_TAX == 'true') {
		$RunningTax[$default_tax_name] += ($ot_shipping_value['value'] / (($order->info['shipping_tax'] / 100) + 1)) * ($order->info['shipping_tax'] / 100);
			} else {
		$RunningTax[$default_tax_name] += (($order->info['shipping_tax'] / 100) * $ot_shipping_value['value']);
				}

				//custom mod for fixed_payment_chg
$ot_fixed_payment_query = tep_db_query("select value as value from " . TABLE_ORDERS_TOTAL . " where class= 'ot_fixed_payment_chg' and orders_id = '" . (int)$oID . "'");
$ot_fixed_payment_value = tep_db_fetch_array($ot_fixed_payment_query);


if (DISPLAY_PRICE_WITH_TAX == 'true') {
$RunningTax[$default_tax_name] += ($ot_fixed_payment_value['value'] / (($order->info['shipping_tax'] / 100) + 1)) * ($order->info['shipping_tax'] / 100);
} else {
$RunningTax[$default_tax_name] += (($order->info['shipping_tax'] / 100) * $ot_fixed_payment_value['value']);
}
//end fixed_payment_chg
	// end shipping tax calcs

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 think we are (or actually you are) getting close. Now it seemed calculate it right when i removed this one item (yet still there is in very first time i open OE that total amount in tax row). But when i tried to add product i got this:

Warning: Cannot use a scalar value as an array in /****/edit_orders.php on line 676

 

Warning: Cannot modify header information - headers already sent by (output started at /****/admin/edit_orders.php:676) in /****/admin/includes/functions/general.php on line 20

 

So its pointing into this last addition. Any ideas?

 

For the problem of the total value sometimes appearing in the tax field, it's possible this is caused by a bug in your checkout process. In the last screenshot of your 'orders_totals' table, you have a line item (orders_totals_id #272) where the 'text' of ALV is 12,49 Euros but the 'value' is 69.2500, same as the total.

 

When you first open Order Editor, it is displaying exactly what is in the database for those values. Therefore, that is what was written to the database by the checkout 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

I just set up this exact scenario on my test store and it worked fine, no errors. The whole section in question should look like this:

 

//just adding in shipping tax, don't mind me
		$ot_shipping_query = tep_db_query("select value as value from " . TABLE_ORDERS_TOTAL . " where class= 'ot_shipping' and orders_id = '" . (int)$oID . "'");
		$ot_shipping_value = tep_db_fetch_array($ot_shipping_query);


	if (DISPLAY_PRICE_WITH_TAX == 'true') {
		$RunningTax[$default_tax_name] += ($ot_shipping_value['value'] / (($order->info['shipping_tax'] / 100) + 1)) * ($order->info['shipping_tax'] / 100);
			} else {
		$RunningTax[$default_tax_name] += (($order->info['shipping_tax'] / 100) * $ot_shipping_value['value']);
				}

				//custom mod for fixed_payment_chg
$ot_fixed_payment_query = tep_db_query("select value as value from " . TABLE_ORDERS_TOTAL . " where class= 'ot_fixed_payment_chg' and orders_id = '" . (int)$oID . "'");
$ot_fixed_payment_value = tep_db_fetch_array($ot_fixed_payment_query);
if (DISPLAY_PRICE_WITH_TAX == 'true') {
$RunningTax[$default_tax_name] += ($ot_fixed_payment_value['value'] / (($order->info['shipping_tax'] / 100) + 1)) * ($order->info['shipping_tax'] / 100);
} else {
$RunningTax[$default_tax_name] += (($order->info['shipping_tax'] / 100) * $ot_fixed_payment_value['value']);
}
//end fixed_payment_chg
	// end shipping tax calcs

 

this is how mine looks now:

//just adding in shipping tax, don't mind me

$ot_shipping_query = tep_db_query("select value as value from " . TABLE_ORDERS_TOTAL . " where class= 'ot_shipping' and orders_id = '" . (int)$oID . "'");

$ot_shipping_value = tep_db_fetch_array($ot_shipping_query);

 

 

if (DISPLAY_PRICE_WITH_TAX == 'true') {

$RunningTax[$default_tax_name] += ($ot_shipping_value['value'] / (($order->info['shipping_tax'] / 100) + 1)) * ($order->info['shipping_tax'] / 100);

} else {

$RunningTax[$default_tax_name] += (($order->info['shipping_tax'] / 100) * $ot_shipping_value['value']);

}

 

//custom mod for fixed_payment_chg

$ot_fixed_payment_query = tep_db_query("select value as value from " . TABLE_ORDERS_TOTAL . " where class= 'ot_fixed_payment_chg' and orders_id = '" . (int)$oID . "'");

$ot_fixed_payment_value = tep_db_fetch_array($ot_fixed_payment_query);

 

 

if (DISPLAY_PRICE_WITH_TAX == 'true') {

$RunningTax[$default_tax_name] += ($ot_fixed_payment_value['value'] / (($order->info['shipping_tax'] / 100) + 1)) * ($order->info['shipping_tax'] / 100);

} else {

$RunningTax[$default_tax_name] += (($order->info['shipping_tax'] / 100) * $ot_fixed_payment_value['value']);

}

//end fixed_payment_chg

// end shipping tax calcs

//custom mod for fixed_payment_chg lis?tty fix

$ot_fixed_payment_query = tep_db_query("select value as value from " . TABLE_ORDERS_TOTAL . " where class= 'ot_fixed_payment_chg' and orders_id = '" . (int)$oID . "'");

$ot_fixed_payment_value = tep_db_fetch_array($ot_fixed_payment_query);

 

 

if (DISPLAY_PRICE_WITH_TAX == 'true') {

$RunningTax[$default_tax_name] += ($ot_fixed_payment_value['value'] / (($order->info['shipping_tax'] / 100) + 1)) * ($order->info['shipping_tax'] / 100);

} else {

$RunningTax[$default_tax_name] += (($order->info['shipping_tax'] / 100) * $ot_fixed_payment_value['value']);

}

//end fixed_payment_chg

// end shipping tax calcs

 

It should be now same i copied from this message and still it gives me following errors:

Warning: Cannot use a scalar value as an array in /****/admin/edit_orders.php on line 666

 

Warning: Cannot use a scalar value as an array in /****/admin/edit_orders.php on line 677

 

Warning: Cannot use a scalar value as an array in ****/admin/edit_orders.php on line 689

 

Warning: Cannot modify header information - headers already sent by (output started at /****/admin/edit_orders.php:666) in /****/admin/includes/functions/general.php on line 20

Link to comment
Share on other sites

Order Editor

 

I can only edit prices in netto (without tax) - What has to be changed to edit brutto prices (including tax) ????

 

:(

OSC Webmakers Edition modiefied with many other contribs and enhancements.

+ STS 4.5.7 for 2.2MS2 and RC1

Link to comment
Share on other sites

Try adding a product or two to an order to see how the order totals change. I'm willing to bet that they will, but the 'value' field will be rounded down. OE is not being prevented from updating the database, however it's calculations are being rounded. All of the form inputs for products prices are straight data input, there is no PHP calculation done on any of them (JavaScript, yes, but that is displayed in real time, not submitted to the server). Subtotal, etc, are all calculated by the PHP code.

 

Also at about line 459 change

 

value = '" . $ot_value . "',

 

to

 

value = '" . sprintf("%f", $ot_value) . "',

 

Keep the same change for the SubTotal for now. See if this affects anything.

 

Yeap, you're right! When I added a product on OE priced $0.50, the base price showed the right price, the others were rounded. Another product priced $1.00 was added and calculated right. So the problem still exists. The store is still rounding down the prices.

 

BTW, by changing the code like you suggested above, OE won't correct the shipping price anymore.

 

Sooooo...... anymore ideas of what could be causing the rounding? (Forget about server issues. Like I said before, I have other same version stores on this server that don't have this problem).

 

Anyway, I want to thank you for your time and efforts in helping out not only me but anybody who comes here looking for help. That's really very nice of you. :)

Patty

Link to comment
Share on other sites

Hello... is there a way to have this calculate the weight and shipping when adding the products to the order?

 

I am always on the phone taking orders and having to manually calculate the weight and shipping for each order... it is a nightmare.

 

It would be great to be able to tap into the shipping modules that are activated. or maybe at least figure the weight value.

 

Thanks in advance for any help.

 

Lyle

Link to comment
Share on other sites

Hello... is there a way to have this calculate the weight and shipping when adding the products to the order?

 

I am always on the phone taking orders and having to manually calculate the weight and shipping for each order... it is a nightmare.

 

It would be great to be able to tap into the shipping modules that are activated. or maybe at least figure the weight value.

 

Thanks in advance for any help.

 

Lyle

 

That's an interesting idea. I'll take a look at doing something like this in a future release.

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

Yeap, you're right! When I added a product on OE priced $0.50, the base price showed the right price, the others were rounded. Another product priced $1.00 was added and calculated right. So the problem still exists. The store is still rounding down the prices.

 

BTW, by changing the code like you suggested above, OE won't correct the shipping price anymore.

 

Sooooo...... anymore ideas of what could be causing the rounding? (Forget about server issues. Like I said before, I have other same version stores on this server that don't have this problem).

 

Anyway, I want to thank you for your time and efforts in helping out not only me but anybody who comes here looking for help. That's really very nice of you. :)

 

The only idea I have is that something on your website and/or server is rounding down the calculated values. I have no other explanation at this point. As we've seen it's only done to PHP calculated values, not data input, and happens during checkout as well as when using OE, both of which I think support my theory. I appreciate your kind words, unfortunately there isn't anything else I can do for you on this. I recommend posting a new thread in the forums with a detailed description of your problem. Perhaps someone else can shed some light on this one.

 

Good luck,

Stew

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

 

I can only edit prices in netto (without tax) - What has to be changed to edit brutto prices (including tax) ????

 

:(

 

Current versions, 2.2 and up, have this feature, unless your browser doesn't support JavaScript.

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

this is how mine looks now:

 

It should be now same i copied from this message and still it gives me following errors:

 

The section of code you posted is not the same as the one I posted, yours has an entire extra (duplicate) section.

 

Maybe you missed something during the install? The changes to admin/includes/classes/order.php or admin/includes/functions/general.php?

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

The only idea I have is that something on your website and/or server is rounding down the calculated values. I have no other explanation at this point. As we've seen it's only done to PHP calculated values, not data input, and happens during checkout as well as when using OE, both of which I think support my theory. I appreciate your kind words, unfortunately there isn't anything else I can do for you on this. I recommend posting a new thread in the forums with a detailed description of your problem. Perhaps someone else can shed some light on this one.

 

Good luck,

Stew

 

Yeah, I've posted on other 4 threads about this. So far no replies. :(

 

Anyway, I thank you for your help and sorry for taking so much of your time. Keep up the good work. You're doing a great job! :thumbsup:

Patty

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