- This topic has 1 reply, 1 voice, and was last updated 8 years, 5 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.
Welcome to GPLDL - we are still beta - please report any bugs via the contact form.
WooThemes Sequential Order Numbers Pro – ver 1.10.0 (06-04-2016)
I have installed the plugin, however was unable to get the pre-padding of order numbers to get working.
With order number template: {YYYY}-0001 i was supposed to get number: ‘2016-0001’ but i was getting ‘2016-1’ like in the free version.
So i tried to dig in the code and found something that might be a bug or a clever camouflage :D
On line 1083: if ( $order_number_length && ctype_digit( $order_number_length ) )
it checks whether order_number_length variable is set and whether it’s a digit. When you checked what was the input, then in my case i saw number 4.
However ctype_digit takes string as argument, so it converted that number into ASCII with value 4 which is not a number and returned false. Therefore the pre-padding was not working.
So what I ended up doing was, that i added casting that value to string (might not be the best solution, but working… with my almost non-existent PHP skills :D)
Here is the “fix”:
In file: woocommerce-sequential-order-numbers.php
line 1084: $order_number = sprintf( "%0{$order_number_length}d", $order_number );
change to: $order_number = sprintf( "%0{$order_number_length}d", (string)$order_number );
Hope that helps.
the actual fix is on line 1083:
change : if ( $order_number_length && ctype_digit( $order_number_length ) ) {
to: if ( $order_number_length && ctype_digit( (string)$order_number_length ) ) {
Had to also disable woothemes updates for this plugin, otherwise it got replaced.