Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only pad order increment id with zeros if it is numeric #34

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

only pad order increment id with zeros if it is numeric #34

wants to merge 2 commits into from

Conversation

darinda
Copy link

@darinda darinda commented Feb 1, 2018

$orderIncrementId = $this->getOrder()->getRealOrderId();
if ( ! is_numeric( $orderIncrementId ))
{
return $orderIncrementId;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we please use substring with length of 10 (preferably from the end of the string) so that we don't exceed the max length of this parameter.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, this can be done. But be aware that in magento the increment id is not limited to a length of 10 but rather could grow up to 50 chars in length (see eav_entity_store table).

Also, in the current implementation sprintf( '%010d', $this->getOrder()->getRealOrderId() ); the length can already exceed 10. That statement will insert 0's until the string is exactly 10 chars in length. If it is longer than 10 chars the string won't be modified, though, resulting in problems already now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Module does not support non-integer increment ids
2 participants