huggettm Posted November 11, 2017 Share Posted November 11, 2017 can digits be added to order numbers to identify which store they are from? This was easy in CC4 - probably not so now Quote Link to comment Share on other sites More sharing options...
Noodleman Posted November 11, 2017 Share Posted November 11, 2017 reasonably easy to do, but you also need to increase the field size in the DB to accomodate longer values, Quote Link to comment Share on other sites More sharing options...
bsmither Posted November 11, 2017 Share Posted November 11, 2017 There is this:http://www.chuggyskins.co.uk/index.php?act=viewProd&productId=24 but it is unknown if there have been too many changes in CC6 (versus CC5) that may cause problems. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted November 12, 2017 Share Posted November 12, 2017 I still use that plugin, but it required quite a bit of editing to get it to work with current CC. Quote Link to comment Share on other sites More sharing options...
huggettm Posted November 13, 2017 Author Share Posted November 13, 2017 ok so it can be done, I can see cart_order_id appears in: order_inventory and order_summary tables? Quote Link to comment Share on other sites More sharing options...
bsmither Posted November 13, 2017 Share Posted November 13, 2017 There may still be a class method that enforces a cart_order_id pattern. Quote Link to comment Share on other sites More sharing options...
huggettm Posted November 13, 2017 Author Share Posted November 13, 2017 Hi Brian, yes I have no idea what actually creates the order id to edit it Quote Link to comment Share on other sites More sharing options...
Noodleman Posted November 13, 2017 Share Posted November 13, 2017 class.order.php function createOrderId change the logic of the function to meet your own order number scheme, and change ALL DB columns that store the order nuber if your scheme will exceed current limits. Quote Link to comment Share on other sites More sharing options...
huggettm Posted November 13, 2017 Author Share Posted November 13, 2017 thank you, so to add a prefix "OFD" the function $this->_order_id = date('ymd-His-').rand(1000, 9999); becomes $this->_order_id = OFD.date('ymd-His-').rand(1000, 9999); ? is there a function to change the order_id in the db, I have just seen it is also in cubecart_transactions also Quote Link to comment Share on other sites More sharing options...
Noodleman Posted November 13, 2017 Share Posted November 13, 2017 $this->_order_id = 'OFD'.date('ymd-His-').rand(1000, 9999); changes need to be applied manually in the DB, easy to do using PHPMyAdmin, change the max length to whatever is required. ensure you make sure the change is the same for all fields otherwise it can impact index performance Quote Link to comment Share on other sites More sharing options...
huggettm Posted November 13, 2017 Author Share Posted November 13, 2017 (edited) ok thank you is there a way to search for the instances of cart_order_id - or is it a manual check of all tables? so far i can see order_history order_inventory order_notes order_summary order_tax cubecart_transactions which would be ALTER TABLE `CubeCart_transactions` CHANGE `order_id` `order_id` VARCHAR(24) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL; ALTER TABLE `CubeCart_order_history` CHANGE `cart_order_id` `cart_order_id` VARCHAR(24) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL; ALTER TABLE `CubeCart_order_inventory` CHANGE `cart_order_id` `cart_order_id` VARCHAR(24) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL; ALTER TABLE `CubeCart_order_notes` CHANGE `cart_order_id` `cart_order_id` VARCHAR(24) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL; ALTER TABLE `CubeCart_order_tax` CHANGE `cart_order_id` `cart_order_id` VARCHAR(24) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL; ALTER TABLE `CubeCart_order_summary` CHANGE `cart_order_id` `cart_order_id` VARCHAR(24) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL; Edited November 13, 2017 by huggettm Quote Link to comment Share on other sites More sharing options...
Noodleman Posted November 13, 2017 Share Posted November 13, 2017 From one of my test stores. SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME LIKE '%order_id%' AND TABLE_SCHEMA = 'cubecart_6.1.12' Quote Link to comment Share on other sites More sharing options...
huggettm Posted November 13, 2017 Author Share Posted November 13, 2017 ah thanks I missed coupons and downloads Quote Link to comment Share on other sites More sharing options...
keat Posted November 14, 2017 Share Posted November 14, 2017 Just be aware that these changes in the database will probably be lost if you update your site at any point, with potential for data loss. Take a look here as there are additional code edits. Quote Link to comment Share on other sites More sharing options...
huggettm Posted November 14, 2017 Author Share Posted November 14, 2017 Hi Keat, Thank you much appreciated. so in my case I would also need to change order.class: public static function validOrderId($order_id) { if(preg_match('#^[OFD]{2}[0-9]{6}-[0-9]{6}-[0-9]{4}$#i', $order_id)) { return true; Quote Link to comment Share on other sites More sharing options...
huggettm Posted November 14, 2017 Author Share Posted November 14, 2017 (edited) that doesnt seem to work, have I over simplified it? ah got it, I didnt change the character number after the prefix to 3 in my case: public static function validOrderId($order_id) { if(preg_match('#^[OFD]{3}[0-9]{6}-[0-9]{6}-[0-9]{4}$#i', $order_id)) { return true; Edited November 14, 2017 by huggettm Quote Link to comment Share on other sites More sharing options...
ploughguy Posted January 10, 2018 Share Posted January 10, 2018 Yech - I have a Cc4 store that I want to upgrade. I currently have a sequential order number add-on installed and it is a dealbreaker for me to go back to the standard user-hostile (and admin-hostile) order numbers. I don’t understand why is is such a big problem to have sequential numbers. Can someone explain why it can’t be done? I gather from this posting that there is no supported alternative? Quote Link to comment Share on other sites More sharing options...
keat Posted January 11, 2018 Share Posted January 11, 2018 (edited) @Ploughguy If you upgrade from V4 with extended order numbers, the upgrade will ignore those order number extensions, and revert back to however many are default (16 or 18 digits i think). It's possible to upgrade and keep these, but there will be work involved. When I did mine, I opened the new database tables, along side the old tables then copy and pasted the extended order numbers. (The upgrade will delete anything larger than the aforemention 16 or 18 digits) If I recall, I did this by exporting as a CSV and using MS Excel. Not overly difficult, but an added step in your upgrade process. Personally, the way I would handle this, would be to create a new domain, and build an exact mirror of my live site on a password protected second domain. get this working as an exact copy of your V4 site. You can then play until your hearts content that you've cracked the process. If you mess up, start over. I upgraded from V3 to V6, i spent weeks fine tuning the process and documenting fixes/pitfalls as I went. Edited January 11, 2018 by keat Quote Link to comment Share on other sites More sharing options...
ploughguy Posted January 21, 2018 Share Posted January 21, 2018 Thanks for the help. I am planning to follow the process you have described. I need to build a bunch of new plug-ins to get the functionality I have added to the 4.3.4 store. Then I will, as you suggest, develop a migration process and test until acceptable, install a fresh installation with a new database then migrate the data from my old store to the new store, and then switch them over. This also means that if the migration process fails for some reason, the old store is still there, up to date and ready to resume its faithful service. I will create a plugin to mirror the sequential order number functionality that I already have. Who knows, I might even publish it. Thanks for the advice! Russ Quote Link to comment Share on other sites More sharing options...
keat Posted January 22, 2018 Share Posted January 22, 2018 If you have cpanel, or plesk, Using PHPMyadmin highlight the database, and choose the options tab. In the operations tab, copy your existing database to a new database, I usually append '_copy' to the end. Next using cpanel or plesk file manager, copy your entire public_html folder, again append '_copy' to the end. Both these processes will take no more than5 minutes, and you now have everything you require to roll back. In the event that you need to roll back, it's a 5 minute process. 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.