WalterL48 Posted November 25, 2015 Share Posted November 25, 2015 The Order Numbers generated by CubeCart are rather long. How can I change that? I didn't see anywhere in the Admin section where that could be done.Thanks in advance! Quote Link to comment Share on other sites More sharing options...
bsmither Posted November 25, 2015 Share Posted November 25, 2015 A CubeCart version prior to CC608 had an experimental "Sequential Order Numbering" system. It is no longer part of CC608.I don't find it in the Marketplace, but such a thing may be available elsewhere.Changing the existing order numbering system would require also finding and editing the code that checks for a properly formatted order number. Quote Link to comment Share on other sites More sharing options...
WalterL48 Posted November 25, 2015 Author Share Posted November 25, 2015 Oh well, I guess I can live with it. I put order numbers on my shipping labels. I'll just use the last half.Thanks for the quick reply and HAPPY THANKSGIVING! Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted November 25, 2015 Share Posted November 25, 2015 I am still using the Sequential Order Number mod that can create much simpler numbers from Chuggyskins, but I have not upgraded to 6.0.8 yet. I did notice there are some code changes in some way related to order numbers in 6.0.8. Quote Link to comment Share on other sites More sharing options...
WalterL48 Posted November 25, 2015 Author Share Posted November 25, 2015 Thanks for the info DB! Quote Link to comment Share on other sites More sharing options...
havenswift-hosting Posted November 27, 2015 Share Posted November 27, 2015 The sequential order numbering functionality that used to be in CubeCart was removed as we found and reported some serious issues with it and so the option to use it was removed until these can be addressedIan Quote Link to comment Share on other sites More sharing options...
WalterL48 Posted November 27, 2015 Author Share Posted November 27, 2015 Thanks for the reply Ian! Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted November 28, 2015 Share Posted November 28, 2015 @WalterL48 I've been working on the manual upgrade to 6.0.8 today, and have not been able to figure out how to merge the Chuggyskins v5 Sequential Order Number mod with the relevant changes in 6.0.8 cubecart.class.php and order.class.php. I'm pretty sure the issue is with the new section of order.class.php: /** * Validate order ID * * @param string $order_id * @return bool */ public static function validOrderId($order_id) { if(preg_match('#^[0-9]{6}-[0-9]{6}-[0-9]{4}$#i', $order_id)) { return true; } return false; } My numbers in 6.0.7 came out YYYY-2alphaletters-upto6digits (2015-EC-2039). If the preg_match line could be made to recognize that format I am guessing the Sequential mod would continue to work. Quote Link to comment Share on other sites More sharing options...
bsmither Posted November 28, 2015 Share Posted November 28, 2015 Maybe we can have the mod:contain instructions to edit this new function (now used in several places in the Cubecart class) such that instead of a hard-coded pattern, there would be a pattern from the mod's configadd to the mod's control panel the pattern to use that matches the desired numberingThe pattern that matches your description above is:preg_match('#^[0-9]{4}-[A-Z]{2}-[0-9]{1,6}$#i', $order_id)Four digits, a dash, two letters, a dash, from one to six digits, case-insensitive.Does this mod add to the properties of the order, or does it replace the existing order_number value? Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted November 29, 2015 Share Posted November 29, 2015 As usual I don't know enough to be able to respond intelligently to your question.I was, however, able to get a blend of 6.0.7 and 6.0.8 code to work by NOT including the Validate Order ID section in order.class.php and leaving out the test for pref_match in each applicable part of cubecart.class.php (this was Chuggyskin's work-around at some point in the past to keep me using his v5 mod).eg: // 6.0.8 VERSION if (isset($_GET['cart_order_id']) && Order::validOrderId(trim($_GET['cart_order_id']))) { //ORIGINAL 6.0.7 if (isset($_GET['cart_order_id']) && preg_match('#^[0-9]{6}-[0-9]{6}-[0-9]{4}$#i', trim($_GET['cart_order_id']))) { //Sequential Order Number tweak for Lookup Order if (isset($_GET['cart_order_id'])){ //end Sequential Order Number tweak for Lookup OrderSo now the question becomes - why was this test for valid order id added, and have I put myself at any security risk by not using it? Quote Link to comment Share on other sites More sharing options...
WalterL48 Posted November 29, 2015 Author Share Posted November 29, 2015 Actually I have no problem with the current system except for the Order Number being so large. A simple 6 or 7 digit number would suffice. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted November 29, 2015 Share Posted November 29, 2015 Sorry to have hijacked your OP. Hopefully there would be some way to create shorter random order numbers to suit your situation. Quote Link to comment Share on other sites More sharing options...
bsmither Posted November 30, 2015 Share Posted November 30, 2015 "why was this test for valid order id added"Actually, it was always there. The test was located at five different locations and had the actual pattern to match against - hard-coded. This change just "centralized" the test and now any code can test for the validity of a cart_order_id. Still, there needs to be a hook so that plugins can manipulate this test if necessary."and have I put myself at any security risk by not using it?"The only answer I can give is, maybe. The value of $_GET['cart_order_id'] is sent through Sanitize::_safety() which just makes sure that only printable characters get through, then strips out anything between < and > including the angles (HTML markup tags). And that means the answer is not a definite no. Quote Link to comment Share on other sites More sharing options...
WalterL48 Posted November 30, 2015 Author Share Posted November 30, 2015 Sorry to have hijacked your OP. Hopefully there would be some way to create shorter random order numbers to suit your situation.No problem. It's a minor issue for me that I can live with. I like to see people helping people. Thanks again Bsmither for all your help here! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.