Zen Cart Logo
Forums / Addon Admin Tools / Edit Orders v4.0 Support Thread

Edit Orders v4.0 Support Thread

Views: 345,912

Results 181 to 200 of 1,927
20 Jun 2013, 16:23
#181
lhungil avatar

lhungil

Totally Zenned

Join Date:
Feb 2012
Location:
mostly harmless
Posts:
1,818
Plugin Contributions:
4

Edit Orders v4.0 Support Thread

mcelmac:

...
When I add a product, or change qty. and click the update button the Sub-Total and Tota are changed to 0.00 after the page refreshes. Even the order in the client site is set to 0.
A quick search of this thread found the following: Edit Orders 4.1 subtotal is 0 and Edit Orders 4.1 subtotal is 0 fix.

26 Jun 2013, 02:13
#182
angry_bill avatar

angry_bill

New Zenner

Join Date:
Jan 2011
Posts:
6
Plugin Contributions:
0

Re: Edit Orders v4.0 Support Thread

Used the fix zero subtotal copy/paste. THANKS !!. I have Ceon Manual CC installed with a surcharge. The edit order doesn't include the CC surcharge after an edit. I may be able to fix but suggestions welcome. I can take screen shot of the results I'm getting.

26 Jun 2013, 14:59
#183
lhungil avatar

lhungil

Totally Zenned

Join Date:
Feb 2012
Location:
mostly harmless
Posts:
1,818
Plugin Contributions:
4

Re: Edit Orders v4.0 Support Thread

Angry Bill:

Used the fix zero subtotal copy/paste. THANKS !!. I have Ceon Manual CC installed with a surcharge. The edit order doesn't include the CC surcharge after an edit. I may be able to fix but suggestions welcome. I can take screen shot of the results I'm getting.
Check your debug logs. I've going to "guess" the CEON code when written did not take into consideration the module being loaded from the Zen Cart admin. Make sure any calls to "include", "include_once", etc include the prefix DIR_FS_CATALOG (going to guess they do not). There may be some other things which meed to be modified as well.

01 Jul 2013, 22:07
#184
rod44 avatar

rod44

Zen Follower

Join Date:
Apr 2006
Location:
Homebase: Spokane, WA
Posts:
101
Plugin Contributions:
0

Re: Edit Orders v4.0 Support Thread

I have 'kind of' the same problem with totals.....

ZenCart 1.5.1
Edit Orders 4.1
Admin New Orders 1.3
2Checkout module

My issue is I installed the 3 modules 1st week in June, and seems to be working OK, however I just noticed that whenever I update and order to 'Shipped' the total goes to $0.00. Will this fix possibly correct this issue?

Thanks

02 Jul 2013, 01:14
#185
lhungil avatar

lhungil

Totally Zenned

Join Date:
Feb 2012
Location:
mostly harmless
Posts:
1,818
Plugin Contributions:
4

Re: Edit Orders v4.0 Support Thread

rod44:

... My issue is I installed the 3 modules 1st week in June, and seems to be working OK, however I just noticed that whenever I update and order to 'Shipped' the total goes to $0.00. Will this fix possibly correct this issue? ...
It should.

02 Jul 2013, 01:19
#186
lhungil avatar

lhungil

Totally Zenned

Join Date:
Feb 2012
Location:
mostly harmless
Posts:
1,818
Plugin Contributions:
4

Re: Edit Orders v4.0 Support Thread

As many of you probably know the next release of Edit Orders is just around the corner. With the next release comes some updated documentation. While still a Work In Progress, feel free to peruse the readme and provide constructive feedback.

Thank You!

03 Jul 2013, 12:34
#187
angry_bill avatar

angry_bill

New Zenner

Join Date:
Jan 2011
Posts:
6
Plugin Contributions:
0

Re: Edit Orders v4.0 Support Thread

lhungil:

Check your debug logs. I've going to "guess" the CEON code when written did not take into consideration the module being loaded from the Zen Cart admin. Make sure any calls to "include", "include_once", etc include the prefix DIR_FS_CATALOG (going to guess they do not). There may be some other things which meed to be modified as well.

If the order grand total was an editable box, just like all the rest of the boxes, the problem would be solved. I don't have to edit the totals often (less than 10%) and I certainly can be trusted to so math !! Thanks, Bill.

03 Jul 2013, 15:03
#188
lhungil avatar

lhungil

Totally Zenned

Join Date:
Feb 2012
Location:
mostly harmless
Posts:
1,818
Plugin Contributions:
4

Re: Edit Orders v4.0 Support Thread

Angry Bill:

... If the order grand total was an editable box, just like all the rest of the boxes, the problem would be solved. ...
This field is calculated by Zen Cart in the same manner as during checkout. This field is not editable because it is always recalculated (any changes to the subtotal / total one might want to make would be erased). Also if one just edited the total the surcharge would not show up on a customer's invoice or history.

Background
Edit Orders DOES let you add / remove / edit order total modules (which add the order total lines to the database). It does this by first loading the order information from the database into the same locations used by the Zen Cart checkout process. Then "Edit Orders" loads each corresponding order total modules (based upon sort order) and calls the "process" method (same as the checkout process). It is up to the order total module to return the correct value based upon the order information.

The "CEON Payment Surcharges/Discounts" module makes the assumption it will only be loaded from the catalog side of Zen Cart. It does not take into consideration one might wish to load the order total module from the admin side of Zen Cart and make modifications. This is an issue with the "CEON Payment Surcharges/Discounts" module.

How to Fix
One would need to remove the assumption made by the "CEON Payment Surcharges/Discounts" module.

A brief look through the "process()" code indicates this specific order total module expects the "payment" module to load surcharge information and call "setTablesOfRatesAndLongDescriptions()". If this has not been done the process method does nothing (never sets the order total line output).

One could add a block of code to the "process" method (If in the admin side of Zen Cart and existing order data is present in the database, set the order total line output to be the surcharge data stored in the database). There are some other ways as well, but this is one of the simplest solutions providing a long term fix (as a bonus it would allow one to edit the surcharge).

03 Jul 2013, 16:52
#189
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Edit Orders v4.0 Support Thread

Angry Bill:

If the order grand total was an editable box, just like all the rest of the boxes, the problem would be solved. I don't have to edit the totals often (less than 10%) and I certainly can be trusted to so math !! Thanks, Bill.

Angry Bill:

Used the fix zero subtotal copy/paste. THANKS !!. I have Ceon Manual CC installed with a surcharge. The edit order doesn't include the CC surcharge after an edit. I may be able to fix but suggestions welcome. I can take screen shot of the results I'm getting.

lhungil:

This field is calculated by Zen Cart in the same manner as during checkout. This field is not editable because it is always recalculated (any changes to the subtotal / total one might want to make would be erased). Also if one just edited the total the surcharge would not show up on a customer's invoice or history.

Background
Edit Orders DOES let you add / remove / edit order total modules (which add the order total lines to the database). It does this by first loading the order information from the database into the same locations used by the Zen Cart checkout process. Then "Edit Orders" loads each corresponding order total modules (based upon sort order) and calls the "process" method (same as the checkout process). It is up to the order total module to return the correct value based upon the order information.

The "CEON Payment Surcharges/Discounts" module makes the assumption it will only be loaded from the catalog side of Zen Cart. It does not take into consideration one might wish to load the order total module from the admin side of Zen Cart and make modifications. This is an issue with the "CEON Payment Surcharges/Discounts" module.

How to Fix
One would need to remove the assumption made by the "CEON Payment Surcharges/Discounts" module.

A brief look through the "process()" code indicates this specific order total module expects the "payment" module to load surcharge information and call "setTablesOfRatesAndLongDescriptions()". If this has not been done the process method does nothing (never sets the order total line output).

One could add a block of code to the "process" method (If in the admin side of Zen Cart and existing order data is present in the database, set the order total line output to be the surcharge data stored in the database). There are some other ways as well, but this is one of the simplest solutions providing a long term fix (as a bonus it would allow one to edit the surcharge).
If I may add this.. Translated another way..

  1. If Angry Bill wants Edit Orders to display the CC surcharge from the Ceon Manual CC module, he will need to modify the Ceon Manual CC module so that the surcharge can be picked up and edited by Edit Orders.
  2. Modifying the grand total is not a feature that will be added to Edit Orders, but if Angry Bill wants this feature he can certainly make these changes to his store.. (it's not a recommended change which is why it will not be included in the Edit Orders module)
04 Jul 2013, 18:34
#190
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,065
Plugin Contributions:
56

Re: Edit Orders v4.0 Support Thread

Does anyone have a merged version of /YOUR_ADMIN/orders.php that includes the changes for Edit Orders 4.1 and Ty Package Tracker 3.13?

06 Jul 2013, 13:39
#191
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,065
Plugin Contributions:
56

Re: Edit Orders v4.0 Support Thread

lat9:

Does anyone have a merged version of /YOUR_ADMIN/orders.php that includes the changes for Edit Orders 4.1 and Ty Package Tracker 3.13?
Never mind on the merge; I finally got that sorted out.

Running Edit Orders 4.1 w/ Ty Package Tracker on Zen Cart v1.5.1, PHP v5.4.8.

Whenever I click on the Edit button in the Customers->Orders display, I receive the following debug log:

[06-Jul-2013 14:32:15 Europe/Berlin] PHP Warning:  Illegal string offset 'id' in C:\xampp\htdocs\zc_151\includes\modules\shipping\freeshipper.php on line 32

[06-Jul-2013 14:32:15 Europe/Berlin] PHP Warning:  Illegal string offset 'iso_code_2' in C:\xampp\htdocs\zc_151\includes\modules\shipping\usps.php on line 1248

[06-Jul-2013 14:32:15 Europe/Berlin] PHP Warning:  Illegal string offset 'iso_code_2' in C:\xampp\htdocs\zc_151\includes\modules\shipping\usps.php on line 1262

[06-Jul-2013 14:32:15 Europe/Berlin] PHP Warning:  Illegal string offset 'id' in C:\xampp\htdocs\zc_151\includes\modules\shipping\freeshipper.php on line 32

[06-Jul-2013 14:32:15 Europe/Berlin] PHP Warning:  Illegal string offset 'iso_code_2' in C:\xampp\htdocs\zc_151\includes\modules\shipping\usps.php on line 1248

[06-Jul-2013 14:32:15 Europe/Berlin] PHP Warning:  Illegal string offset 'iso_code_2' in C:\xampp\htdocs\zc_151\includes\modules\shipping\usps.php on line 1262

The two shipping modules that I've got enabled are (you guessed it), Free Shipping and USPS. The issue is that when the shipping modules are loaded under edit_orders, the global variable $order->delivery['country'] is a *string *containing the country's name. When the shipping modules are loaded from the store-front, $order->delivery['country'] is an array:

country (array)
    id (string) => 223
    title (string) => United States
    iso_code_2 (string) => US
    iso_code_3 (string) => USA

I'm not sure if the following is the 'best' way to correct the problem ... but it works! Changes made to \YOUR_ADMIN\includes\functions\extra_functions\edit_orders_functions.php:

function eo_get_available_shipping_modules() {
	$retval = array();
	if(defined('MODULE_SHIPPING_INSTALLED') && zen_not_null(MODULE_SHIPPING_INSTALLED)) {
  
//-bof-a-lat9-illegal-string-offset
    global $order, $db;
    if (!isset($order)) {
      error_log('/includes/functions/extra_functions/edit_orders_functions.php (eo_get_available_shipping_modules()): global $order not set');
      die();
      
    }
    $country_info = $db->Execute('SELECT countries_id as id, countries_name as name, countries_iso_code_2 as iso_code_2, countries_iso_code_3 as iso_code_3 FROM ' . TABLE_COUNTRIES . " WHERE countries_name = '" . $order->delivery['country'] . "'");
    $order->delivery['country'] = $country_info->fields;
    unset($country_info);
//-eof-a-lat9-illegal-string-offset

		if(!isset($_SESSION['cart'])) {
			require_once(DIR_FS_CATALOG . DIR_WS_CLASSES . 'shopping_cart.php');
			$_SESSION['cart'] = new shoppingCart();
		}

		// Load the shipping class into the globals
		require_once(DIR_FS_CATALOG . DIR_WS_CLASSES . 'shipping.php');
		$shipping_modules = new shipping();

		for($i=0, $n=count($shipping_modules->modules); $i<$n; $i++) {
			$class = substr($shipping_modules->modules[$i], 0, strrpos($shipping_modules->modules[$i], '.'));
			if(isset($GLOBALS[$class])) {
				$retval[] = array(
					'id' => $GLOBALS[$class]->code,
					'text' => $GLOBALS[$class]->title
				);
			}
		}
		unset($shipping_modules, $class, $i, $n);
    
//-bof-a-lat9-illegal-string-offset
    $order->delivery['country'] = $order->delivery['country']['name'];
//-eof-a-lat9-illegal-string-offset

	}

	return $retval;
}
function eo_get_order_by_id($oID) {
	global $db, $order;

	// Retrieve the order
	$order = new order($oID);

	// Add some required customer information for tax calculation
	// The next method has been modified to add required info to the
	// session and global variables.
	zen_get_tax_locations();

	// Cleanup tax_groups in the order (broken code in order.php)
	// Shipping module will automatically add tax if needed.
	$order->info['tax_groups'] = array();
	foreach($order->products as $product) {
		eo_get_product_taxes($product);
	}

	// Correctly add the running subtotal (broken code in order.php)
	if(!array_key_exists('subtotal', $order->info)) {
		$query = $db->Execute(
			'SELECT value FROM `' . TABLE_ORDERS_TOTAL . '` ' .
			'WHERE `orders_id` = \'' . (int)$oID . '\' ' .
			'AND `class` = \'ot_subtotal\''
		);
		if(!$query->EOF) {
			$order->info['subtotal'] = $query->fields['value'];
		}
	}

	// Handle shipping costs (module will automatically handle tax)
	if(!array_key_exists('shipping_cost', $order->info)) {
		$query = $db->Execute(
			'SELECT value FROM `' . TABLE_ORDERS_TOTAL . '` ' .
			'WHERE `orders_id` = \'' . (int)$oID . '\' ' .
			'AND `class` = \'ot_shipping\''
		);
		if(!$query->EOF) {
			$order->info['shipping_cost'] = $query->fields['value'];

			$_SESSION['shipping'] = array(
				'title' => $order->info['shipping_method'],
				'id' => $order->info['shipping_module_code'] . '_',
				'cost' => $order->info['shipping_cost']
			);

			if(!isset($_SESSION['cart'])) {
				require_once(DIR_FS_CATALOG . DIR_WS_CLASSES . 'shopping_cart.php');
				$_SESSION['cart'] = new shoppingCart();
			}
      
//-bof-a-lat9-illegal-string-offset
      $country_info = $db->Execute('SELECT countries_id as id, countries_name as name, countries_iso_code_2 as iso_code_2, countries_iso_code_3 as iso_code_3 FROM ' . TABLE_COUNTRIES . " WHERE countries_name = '" . $order->delivery['country'] . "'");
      $order->delivery['country'] = $country_info->fields;
//-eof-a-lat9-illegal-string-offset

			// Load the shipping class into the globals
			require_once(DIR_FS_CATALOG . DIR_WS_CLASSES . 'shipping.php');
			$shipping_modules = new shipping($_SESSION['shipping']);

//-bof-a-lat9-illegal-string-offset      
      $order->delivery['country'] = $order->delivery['country']['name'];
//-eof-a-lat9-illegal-string-offset
		}
	}

	return $order;
}
06 Jul 2013, 17:21
#192
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,065
Plugin Contributions:
56

Re: Edit Orders v4.0 Support Thread

Gadgit:

Ok - I think I have come up with a solution to this now. I have done as I suggested and added an extra dimension to the front of the id array which is the $orders_products_id value.

For example - Line 903 in edit_orders.php

echo '<textarea class="attribsTextarea" name="id[' .$optionID[$j] . '][value]" rows="' . $optionInfo['rows'] . '" cols="' . $optionInfo['size'] . '" id="attrib-' . $optionID[$j] . '" >' . $text . '</textarea>' . "\n";

> 
> becomes
> 
> ```
echo '<textarea class="attribsTextarea" name="id['.$orders_products_id.'][' .	$optionID[$j] . '][value]" rows="' . $optionInfo['rows'] .
	'" cols="' . $optionInfo['size'] . '" id="attrib-' .
	$optionID[$j] . '" >' . $text . '</textarea>' . "\n";

and then, when this array is read from $_POST on line 276

zen_db_prepare_input($_POST['id']),

> 
> becomes 
> 
> ```
zen_db_prepare_input($_POST['id'][$orders_products_id]),

I have had a quick (but not thorough!) test of this, and it seems to work - can anyone see any reasons as to why this might cause problems elsewhere?

I now seem to have a problem in that the Sub-Total and hence, the Total never update, and they can't be modified manually, so the order totals cannot be changed, only by adding additional total lines (but then these get removed again upon updating the order). Is this expected functionality, have I missed something or is this a bug?

Cheers,
Scott
FWIW, a combination of the changes suggested in the referenced post plus the SQL update provided here (http://www.zen-cart.com/showthread.php?170483-Attribute-Required-for-Text-flag-not-working) allowed a client's upgraded site to be able too fully edit the attributes in an order.

06 Jul 2013, 21:39
#193
lhungil avatar

lhungil

Totally Zenned

Join Date:
Feb 2012
Location:
mostly harmless
Posts:
1,818
Plugin Contributions:
4

Re: Edit Orders v4.0 Support Thread

lat9:

...
The two shipping modules that I've got enabled are (you guessed it), Free Shipping and USPS. The issue is that when the shipping modules are loaded under edit_orders, the global variable $order->delivery['country'] is a *string *containing the country's name. When the shipping modules are loaded from the store-front, $order->delivery['country'] is an array ...

lat9:

FWIW, a combination of the changes suggested in the referenced post plus the SQL update provided here (http://www.zen-cart.com/showthread.php?170483-Attribute-Required-for-Text-flag-not-working) allowed a client's upgraded site to be able too fully edit the attributes in an order.
You may wish to join the BETA testing team (and would be most welcome). A number of bugs have been squashed, new enhancements added, and better interoperability with existing Zen Cart and 3rd party (shipping and order total) modules. Take a peek at the current list of changes (they are listed in the Edit Orders 4.1.1 readme).

07 Jul 2013, 12:30
#194
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,065
Plugin Contributions:
56

Re: Edit Orders v4.0 Support Thread

lhungil:

You may wish to join the BETA testing team (and would be most welcome). A number of bugs have been squashed, new enhancements added, and better interoperability with existing Zen Cart and 3rd party (shipping and order total) modules. Take a peek at the current list of changes (they are listed in the Edit Orders 4.1.1 readme).
Thanks, lhungil, I'll give it a spin!

09 Jul 2013, 21:39
#195
shara avatar

shara

New Zenner

Join Date:
Jul 2005
Location:
Los Angeles
Posts:
50
Plugin Contributions:
0

Re: Edit Orders v4.0 Support Thread

Zen v1.5.1

I just did a new installation of edit orders but I'm still having a problem with the sub-total being -0- when I change the quantity. I have made the changes recommended in the previous post but it hasn't fixed my problem.

I am running only the Tax Exempt plugin in addition to EO.

Also, my install file did not include anything for SQL, only the uninstall SQL.

09 Jul 2013, 21:46
#196
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Edit Orders v4.0 Support Thread

Shara:

Also, my install file did not include anything for SQL, only the uninstall SQL.Because as the readme indicates, the auto installer manages the SQL changes/execution..

12 Jul 2013, 19:26
#197
angry_bill avatar

angry_bill

New Zenner

Join Date:
Jan 2011
Posts:
6
Plugin Contributions:
0

Re: Edit Orders v4.0 Support Thread

How about the ability to edit "low order fee" for orders close to the limit?

Bill

12 Jul 2013, 20:25
#198
lhungil avatar

lhungil

Totally Zenned

Join Date:
Feb 2012
Location:
mostly harmless
Posts:
1,818
Plugin Contributions:
4

Re: Edit Orders v4.0 Support Thread

Angry Bill:

How about the ability to edit "low order fee" for orders close to the limit?
Changing the behavior of an order total module in the admin sounds a little too much like bait and switch to me.

I strongly believe order total modules should act the same for both customers making an order online and when an admin adds / edits an order from the Zen Cart admin. This makes processing orders easier, ensures a seamless customer experience, and ensures anyone editing / adding an order does not "forget" rules imposed by order total modules.

I do understand a limited number of order total modules currently exist. But if one needs different functionality, one should create a new order total module (or modify the order total module) to fit their needs. New (or modified) order total modules should be posted to (or updated in) the plugin section. This would directly benefit the Zen Cart community in general and not just users of "Edit Orders".

Note: I see the potential need for an "Onetime Order Discount" order total module. This would provide an easy way to record and audit how many times an order is discounted. Using such an order total module would also ensure invoices, reports, and the customer's order history reflect the customer was given a one time order discount. If anyone else is interested or plans to build such a module... Feel free to send me a PM or email!

12 Jul 2013, 21:25
#199
angry_bill avatar

angry_bill

New Zenner

Join Date:
Jan 2011
Posts:
6
Plugin Contributions:
0

Re: Edit Orders v4.0 Support Thread

lhungil:

Changing the behavior of an order total module in the admin sounds a little too much like bait and switch to me.

lol ok. "bait and switch". I appreciate the effort put into this code A LOT and I use it quite a bit real time. I also equally find he responses here equally amusing :smile:. I will continue to use my Microsoft access back door to REALLY edit the orders as I need to edit them.

12 Jul 2013, 23:35
#200
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Edit Orders v4.0 Support Thread

lhungil:

Changing the behavior of an order total module in the admin sounds a little too much like bait and switch to me.

I strongly believe order total modules should act the same for both customers making an order online and when an admin adds / edits an order from the Zen Cart admin. This makes processing orders easier, ensures a seamless customer experience, and ensures anyone editing / adding an order does not "forget" rules imposed by order total modules.

I do understand a limited number of order total modules currently exist. But if one needs different functionality, one should create a new order total module (or modify the order total module) to fit their needs. New (or modified) order total modules should be posted to (or updated in) the plugin section. This would directly benefit the Zen Cart community in general and not just users of "Edit Orders".

Note: I see the potential need for an "Onetime Order Discount" order total module. This would provide an easy way to record and audit how many times an order is discounted. Using such an order total module would also ensure invoices, reports, and the customer's order history reflect the customer was given a one time order discount. If anyone else is interested or plans to build such a module... Feel free to send me a PM or email!
I agree with the "bait and switch" characterization.. If an order total module has rules associated with it it would see more prudent to adjust the rules than the order total on the back end.. If the rules of say the "low order total" module aren't calculating as the shopowner thinks they should this is the RIGHT solution.. Anything else feels a tad.. ummm... dare I say "shady"...