VirtueMart

WooCommerce

Others

Docs

Support

Demo

Blog

About

Forum
Welcome, Guest
Username: Password: Remember me

TOPIC: Only odd numbers this month/No even numbers

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

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
The administrator has disabled public write access.

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 (This email address is being protected from spambots. You need JavaScript enabled to view it.): 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
The administrator has disabled public write access.

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

Hi

No multi vendor plugins or sub order plugins.
I have emailed you the system status
I have attached the setting in a screeshot
ordernumbers-2.jpg
The administrator has disabled public write access.

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 This email address is being protected from spambots. You need JavaScript enabled to view it.), 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.
The administrator has disabled public write access.

VM - Shopping cart

 x 

Cart empty

Login Formular