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

Alphanumeric increment id's #390

Closed
philwinkle opened this issue Oct 16, 2013 · 2 comments
Closed

Alphanumeric increment id's #390

philwinkle opened this issue Oct 16, 2013 · 2 comments

Comments

@philwinkle
Copy link
Contributor

Increment id's for sales orders are still assumed to be numeric, though there is no schema requirement in eav_entity_store for a prefix being an int. In the cases where the prefix is alphnum (as the db schema defines a varchar(50)) the isOrderIncrementIdUsed() method, when casting to int, will always evaluate as 0. When the value is cast and returns 0 as the increment_id in the where clause, concurrent orders on high-traffic stores may choose identical increment ids, causing some payment gateways to error on authorize/capture.

The method for reference:

 public function isOrderIncrementIdUsed($orderIncrementId)
    {
        $adapter   = $this->_getReadAdapter();
        $bind      = array(':increment_id' => (int)$orderIncrementId);
        $select    = $adapter->select();
        $select->from($this->getTable('sales_flat_order'), 'entity_id')
            ->where('increment_id = :increment_id');
        $entity_id = $adapter->fetchOne($select, $bind);
        if ($entity_id > 0) {
            return true;
        }

        return false;
    }

So, in essence this is what happens:

[1] boris> $varchar = 'M00000101';
 → string(9) "M00000101"
[2] boris> (int)$varchar;
 → int(0)

It would be desirable to either see the db schema change to enforce a numeric-only increment id or, rather, remove the cast to int (which is my current workaround).

Source:

https://github.com/magento/magento2/blob/master/app/code/Magento/Sales/Model/Resource/Quote.php#L178

@dbsdsun
Copy link

dbsdsun commented Nov 6, 2013

Thanks for your comment, did Magento team response on your "Alphanumeric increment id's" issue?

@verklov
Copy link
Contributor

verklov commented Dec 23, 2013

philwinkle,
Thank you for reporting this issue! As this issue is the detailed description of the pull request #406 , which was released with the last code update in dev57, we are closing this issue.
Looking forward for your new contributions!

@verklov verklov closed this as completed Dec 23, 2013
magento-team added a commit that referenced this issue Dec 27, 2013
* Fixed bugs:
  * Security improved for the Login, Update Cart, Add to Compare, Review, and Add entire wishlist actions on the frontend
  * Removed warnings on category pages when Flat Catalog Category is enabled
  * Fixed product price displayed in wrong currency after switching currency on the frontend
  * Fixed the Save & Duplicate action in product creation
  * Fixed big image scaling in product description
  * Fixed admin dashboard styling issue
  * Fixed validation message for the Quantity field on the product page in the backend
  * Fixed the email template for sharing a Wishlist
  * Fixed the response of the drop-down menu in the Plushe theme
  * Fixed the missing Related Banners tab for Catalog Price Rule
  * Fixed inability to enable the duplicated product
  * Removed warnings on saving payment method configuration
  * Fixed gift messages displaying on the Order View page after admin edits
  * Fixed inability to create a new order status
  * Fixed the behavior of the Save and Previous and the Previous buttons on the Edit Review page
  * Fixed inability to delete a website if the number of websites is less or equal to two
  * Fixed Export on the All Customers page
  * Fixed inability to add products to the Shopping Cart from the Category page in Internet Explorer
  * Fixed logo on the backend login page
  * Fixed visual elements to indicate that Tax details can be expanded on the order creation page in the backend
  * Fixed the CMS page preview design
  * Fixed the newsletter template preview design
  * Fixed the Matched Customers grid design in the Email Reminder Rules
  * Fixed the theme version validation message displayed when creating a new theme
  * Fixed performance degradation during installation wizard execution
  * Fixed cron shell script
  * Fixed user login on the frontend, when the Redirect Customer to Account Dashboard after Logging option is set to No
  * Fixed errors in requests to shipping carrier (DHL International) when the shipping address contains letters with diacritic marks
  * Fixed invalid account creation date
  * Fixed displaying Product Alert links on product view page when the functionality is disabled
  * Fixed the absence of some bundle options when configuring a bundle product in the Shopping Cart on the frontend
  * Fixed the issue which allowed to view and cancel billing agreements belonging to another customer
  * Fixed the content spoofing vulnerability when Solr was used
  * Fixed a potential XSS vulnerability in customer login
  * Fixed RSS feed for categories containing bundle product(s)
  * Fixed inability to place an order with 3D Secure in Internet Explorer 10
  * Fixed inability to place an order with PayPal Payflow Link and PayPal Payments Advanced
  * Fixed integrity constraint violation in catalog URL rewrites
  * Fixed the absence of the error when a wrong website code is specified during a website creation
  * Fixed saving in the backend a new customer address, which contains new customer address attributes configured to be not visible on frontend
  * Fixed USPS shipping method in the checkout
  * Fixed placing orders with recurring profile items via PayPal Express Checkout
  * Fixed email template creation in the backend
  * Fixed the issue with default billing address being used instead of default shipping address during admin order creation
  * Fixed inability to choose DB as Media Storage
  * Fixed PHP issues found during the UI testing of the backend
  * Fixed shipping label creation for USPS Priority Mail Shipping methods
  * Fixed the issue which allowed to create customers with duplicate email
  * Fixed the abstract product block error in the tier price template getter
  * Fixed system message displaying in the backend
  * Fixed the "404" error on customer review page
  * Fixed autocomplete enabled on the admin login page
  * Fixed the 3D Secure iframe
  * Fixed the indicators of mandatory fields on the Package Extension page
  * Fixed product image scaling on the Compare Products page
  * Fixed product page design for products with the Fixed Product Tax attribute
  * Removed spaces between parentheses and numbers in the Cart, Wishlist, and Compare Products blocks
  * Fixed the message displaying the quantity for products found on the Advanced Search page
  * Fixed incorrect caching of locale settings and URL settings during web installation
  * Fixed inability to use a newly created store for admin user roles
  * Fixed absence of the Advanced Search field on the frontend, when the Popular Search Terms functionality is disabled
  * Fixed incorrect link to downloadable product(s) in the email invoice copy
  * Fixed customs monetary value in labels/package info for international shipments
  * Fixed importing for files with blank URL Key field on the store view level
  * Fixed table rate error message
  * Fixed frontend login without pre-set cookies
  * Fixed date resetting to 1 Jan 1970 after saving a design change in the admin panel in case date format is DD/MM/YY
  * Fixed CAPTCHA on multi-address checkout flow
  * Fixed view files population tool
* GitHub requests:
  * [#122](#122) -- Added support of federal units of Brazil with 27 states
  * [#184](#184) -- Removed unused blocks and methods in Magento_Wishlist module
  * [#390](#390) -- Support of alphanumeric order increment ids by the quote resource model
* Themes update:
  * Responsive design improvements
* Improvements in code coverage calculation:
  * Code coverage calculation approach for unit tests was changed from blacklist to whitelist
joanhe pushed a commit that referenced this issue Jul 3, 2015
magento-team pushed a commit that referenced this issue Feb 24, 2016
mmansoor-magento pushed a commit that referenced this issue Sep 19, 2016
…-from-2.0.7-to-2.1.0

[Jackalopes] MAGETWO-56063 upgrade from 2.0.7 to 2.1.0 (2.2 release)
magento-engcom-team added a commit that referenced this issue Feb 26, 2019
 - Merge Pull Request magento/graphql-ce#390 from pmclain/graphql-ce:hotfix/quote-address-country
 - Merged commits:
   1. 7871f4c
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

No branches or pull requests

3 participants