Jump to content

Explain orders.reference column please?


Recommended Posts

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 by bcsteeve (see edit history)
Link to comment
Share on other sites

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

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 by bcsteeve (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...