Login
Register

VirtueMart

WooCommerce

Others

Docs

Support

Blog

About

Ordernumbers for WooCommerce

IMPORTANT ANNOUNCEMENT: Plugin development ceased, all plugins made available freely (GPL)

With great sadness we have to announce that we are ceasing development of all our VirtueMart, WooCommerce and Joomla plugins. Effective immediately, all our plugins -- even those that were paid downloads -- are made available for free from our homepage (GPL license still applies), but we cannot and will not provide any support anymore.

It has been a great pleasure to be part of the thriving development communities of VirtueMart as well as WooCommerce. However, during the last year it became painstakingly clear that in addition to a full-time job, a young family and several other time-consuming hobbies at professional level (like being a professional singer) the plugin development and the support that it requires is not sustainable and is taking its toll. It has been an honor, but it is now time to say good bye!

×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Only odd numbers this month/No even numbers 14 Jul 2017 10:23 #1

  • yankee99
  • yankee99's Avatar Topic Author
Here is the sample of the numbers and i haven't made any changes

#20170705/1
#20170706/3
#20170706/5
#20170707/7

the previous month working correctly

#20170604/1
#20170605/2
#20170605/3
#20170607/4

Only odd numbers this month/No even numbers 15 Jul 2017 19:57 #2

Dear Yankee,
That's strange. There is one other customer that observes a similar behaviour, but for all others it works fine:
open-tools.net/forum/advanced-ordernumbe...s-randomly.html#8079

There are some known cases of such behaviour: Do you have any multi-vendor plugin installed and activated? Another case where an order causes multiple sub-orders to be created internally (i.e. the customer never realizes this, but wooCommerce creates new orders that are assigned to the existing order as children) is multi-shipping plugins. Do you have any of these installed?

Could you please send us the WooCommerce System Status by e-mail (office@open-tools.net): Go to the WooCommerce admin area, menu "WooCommerce" => "System status" => Button "Get system report" => Button "Copy for Support", to copy the system report to memory and paste it into a mail (Ctrl+V or Option+V on a Mac, or use the right mouse button -> "Paste" in the mail).

That system report contains a comprehensive list of all plugins and the most important settings (but no sensitive data like passwords or usernames), so it should give me a better overview about your installation.

Could you please also tell me the exact configuration of the order numbers plugin, so I can cross-check whether the issue is caused by any particular configuration setting.

Best regards,
Reinhold

Only odd numbers this month/No even numbers 17 Jul 2017 05:36 #3

  • yankee99
  • yankee99's Avatar Topic Author
Hi

No multi vendor plugins or sub order plugins.
I have emailed you the system status
I have attached the setting in a screeshot
Attachments:

Only odd numbers this month/No even numbers 10 Aug 2017 01:14 #4

Dear Yankee99,
Sorry for the late answer and thank you for all your information. Unfortunately, I can't see any obvious causes of your issue. In particular, I see none of the known problems causing such issues. However, I don't know some of the plugins, so they might cause the issue.
I suppose you don't have a test/development installation where the issue occurs, only your live site?

The easiest way to track down the issue would be if you could temporarily enable debug logging in your WordPress installation and insert two lines of code into our plugin to print out a backtrace to a log file showing which functions / plugins called the number generation function of our plugin. All of this should not have any user-visible effect, but it will print out some vital information to a log file in your server.

If you don't want to enable debugging and fiddle with our plugin code, that's okay, too. We'll just have to figure another way to determine what or who is responsible that a number is skipped with every order.

To do it, there are the following two steps neccessary:

1. Enabling debug logging in WordPress: In the file wp-config.php change the line:
define('WP_DEBUG', false);
to
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);

2. In our plugin in the file wp-content/plugins/woocommerce-advanced-ordernumbers/ordernumbers_woocommerce_basic.php find the function generateNumber (should be line 496) and insert two error_log calls right before the the "return $number;" in line 511:
error_log( "Creating new $type for order with ID $default, format=$fmt, resulting number=$number");
error_log('Backtrace = ' . print_r(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), true));
			return $number;

In particular, change the function
	function generateNumber($default, $order, $type='ordernumber') {
		if ($this->numbers_activated($type)) {
			$fmt     = get_option ($type.'_format',  "#");
			$ctrsettings = array(
				"${type}_format"  => '',
				"${type}_counter" => '',
				"${type}_global"  => get_option ($type.'_global',  'no'),
				"${type}_padding" => 1,
				"${type}_step"    => 1,
				"${type}_start"   => 1,
			);
			$customvars = get_option ('ordernumber_variables',   array());

			$number = $this->helper->createNumber ($fmt, $type, $order, $customvars, $ctrsettings);
			$this->update_order_meta($order, $this->ordernumber_meta.$type, $number );
			return $number;
		} else {
			return $default;
		}
	}
to
	function generateNumber($default, $order, $type='ordernumber') {
		if ($this->numbers_activated($type)) {
			$fmt     = get_option ($type.'_format',  "#");
			$ctrsettings = array(
				"${type}_format"  => '',
				"${type}_counter" => '',
				"${type}_global"  => get_option ($type.'_global',  'no'),
				"${type}_padding" => 1,
				"${type}_step"    => 1,
				"${type}_start"   => 1,
			);
			$customvars = get_option ('ordernumber_variables',   array());

			$number = $this->helper->createNumber ($fmt, $type, $order, $customvars, $ctrsettings);
			$this->update_order_meta($order, $this->ordernumber_meta.$type, $number );
error_log( "Creating new $type for order with ID $default, format=$fmt, resulting number=$number");
error_log('Backtrace = ' . print_r(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), true));
			return $number;
		} else {
			return $default;
		}
	}

The debug messages from the error_log call will not simply be written to the file wp-content/debug.log on your server.

3. Wait for one or two orders to come in skipping numbers. The file wp-content/debug.log will contain the information about which plugins and functions called the ordernumber generation. Could you please send me the file or its contents (via e-mail to office@open-tools.net), so I can see which plugin causes the issue.

4. Disable debug logging by reverting the changes done in step 1. and 2.

Best regards,
Reinhold

PS: If you are not comfortable modifying your installation's files, but are comfortable giving a complete stranger access (ftp and/or ssh access to your installation to modify the wp-config.php!), I can offer to make the adjustments myself.
  • Page:
  • 1