bcsteeve Posted July 2, 2015 Share Posted July 2, 2015 (edited) I'm importing data from a different platform (slowly) I wish to import orders. I see in the sample data what appears to be 8 to 9 random capitalized A-Z. Can someone give a hint on how they are generated and how I might import without conflicts? If it is random, what if it is not unique? While very unlikely, it is possible for two to end up the same unless it is constantly checking for uniqueness. Why not just use incremental numbers? Gotta be a reason My guess from hints in the php files is that it is not really an order "number" (as it appears), but rather a reference to a payment (for multiple orders associated to a single payment? Or the other way round?). Anyway, I'm guessing it isn't all that important and I could leave blank if the system I'm migrating from has a 1:1 relationship between orders and payments. Is that even close? Edited July 2, 2015 by bcsteeve (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted July 2, 2015 Share Posted July 2, 2015 The order reference is created using this code. It is not guaranteed to be unique. strtoupper(Tools::passwdGen(9, 'NO_NUMERIC')); PS used to use the Order ID but moved to using the reference in PS v1.5. I don't recall why. Perhaps move your old order number to it when you import? Link to comment Share on other sites More sharing options...
NemoPS Posted July 3, 2015 Share Posted July 3, 2015 Actually it is unique as it recursively checks it's not already in the db, when it's generated Link to comment Share on other sites More sharing options...
bcsteeve Posted July 3, 2015 Author Share Posted July 3, 2015 (edited) From the code comments: /** * @var string Order reference, this reference is not unique, but unique for a payment */ public $reference; So you can see why I assumed it wasn't unique... cause it says so. Of course, at this point I don't immediately see why I determined that was the correct "$reference" other than it being in the Order.php file (I'm sure I had a better reason at the time). Either way, my old order_IDs are unique so that isn't the issue. My only concern was format and whether or not a simple 4-digit numerical reference would cause a problem. Edited July 3, 2015 by bcsteeve (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted July 4, 2015 Share Posted July 4, 2015 My only concern was format and whether or not a simple 4-digit numerical reference would cause a problem. No it won't Link to comment Share on other sites More sharing options...
bcsteeve Posted July 4, 2015 Author Share Posted July 4, 2015 thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now