Waza04 Posted April 30, 2003 Share Posted April 30, 2003 Notice how the letter set changes so that 0 and O don't get mixed up and so that the recognition ID (eg RM) on the end dosen't get generated anywhere else.... Link to comment Share on other sites More sharing options...
brighthorizon Posted May 1, 2003 Share Posted May 1, 2003 I loaded the random order number contribution and found that my download site... my downloads are not functioning anymore??? It was working before i installed the contribution and works when I reload my backup and edit the sql tables again. I had the same problem until I removed the letters from the random order number. There is an if statement in downloads.php that checks for a numeric value in the order number. I tried removing that portion of the if structure, but it didn't work. There must be something elsewhere that doesn't like the letters. Charlie Was this problem solved?? Warren I don't believe so I've been watching this thread and noone has come up with a solution yet for random order number and still be able to download items on a download site. Sighhhhh Link to comment Share on other sites More sharing options...
GaryM Posted May 8, 2003 Share Posted May 8, 2003 I loaded the random order number contribution and found that my download site... my downloads are not functioning anymore??? It was working before i installed the contribution and works when I reload my backup and edit the sql tables again. I had the same problem until I removed the letters from the random order number. There is an if statement in downloads.php that checks for a numeric value in the order number. I tried removing that portion of the if structure, but it didn't work. There must be something elsewhere that doesn't like the letters. Charlie Was this problem solved?? Warren I don't believe so I've been watching this thread and noone has come up with a solution yet for random order number and still be able to download items on a download site. Sighhhhh I thought the solution was to remove the letters from your random order #. Isn't that what this sentence says? "I had the same problem until I removed the letters from the random order number. " If that statement is true, then just use a random number scheme that doesn't insert any letters. Seems simple enough to me. Have you ever gotten any help from these forums? Be part of the community and help out by answering a question or 2. Pass on what you know about OSC to someone who needs help. Link to comment Share on other sites More sharing options...
brighthorizon Posted May 11, 2003 Share Posted May 11, 2003 But removing just the letters did not fix the download problem... Has anyone been able to fix this yet?? Link to comment Share on other sites More sharing options...
capsulas Posted May 21, 2003 Share Posted May 21, 2003 I added the contribution, but I have a trouble... I really appreciate your advice, with the following error in my database MYSQL QUERY ERROR REPORT --------------------------------------- 1062 - Error 1062 Duplicate entry '0' for key 1 PS I followed all steps. Link to comment Share on other sites More sharing options...
drakonan Posted May 21, 2003 Share Posted May 21, 2003 Can you do this?: Maintain your real order number (for proper download functionality for one, but also for sorting, without having to mod an additional sort routine) But DISPLAY a "fake" derivative of that number. Maybe a linear matrix? Or even as simple as, the real numbers are all the odd numbers... invoice 1003 could be 19050637. 1x0x0x3x where all the X's are random numbers. Just anytime the number is displayed, do the above. The number will still have significance, but only you understand :). This number will need to be stored as well of course, so the customer's order number doesn't change every time... Or, maybe the numbers could be put through some math algorithm... - - - - Sometimes, ignorance is bliss. Link to comment Share on other sites More sharing options...
Guest Posted May 21, 2003 Share Posted May 21, 2003 I loaded the random order number contribution and found that my download site... my downloads are not functioning anymore??? It was working before i installed the contribution and works when I reload my backup and edit the sql tables again. I had the same problem until I removed the letters from the random order number. There is an if statement in downloads.php that checks for a numeric value in the order number. I tried removing that portion of the if structure, but it didn't work. There must be something elsewhere that doesn't like the letters. Charlie Was this problem solved?? Warren I don't believe so I've been watching this thread and noone has come up with a solution yet for random order number and still be able to download items on a download site. Sighhhhh It solved the problem for me. I get random order numbers and my downloads page works now. Charlie Link to comment Share on other sites More sharing options...
brighthorizon Posted May 25, 2003 Share Posted May 25, 2003 I loaded the random order number contribution and found that my download site... my downloads are not functioning anymore??? It was working before i installed the contribution and works when I reload my backup and edit the sql tables again. I had the same problem until I removed the letters from the random order number. There is an if statement in downloads.php that checks for a numeric value in the order number. I tried removing that portion of the if structure, but it didn't work. There must be something elsewhere that doesn't like the letters. Charlie Was this problem solved?? Warren I don't believe so I've been watching this thread and noone has come up with a solution yet for random order number and still be able to download items on a download site. Sighhhhh It solved the problem for me. I get random order numbers and my downloads page works now. Charlie how did you get this mod to work and still have download functionality? i'm using the downloads controller mod also. Link to comment Share on other sites More sharing options...
Guest Posted May 25, 2003 Share Posted May 25, 2003 In the random order number generator function, remove the part that adds the characters and make sure there are no dashes. There is some checking done in the downloads controller that check for a numeric value in the order number. The alpha characters make it choke. Charlie Link to comment Share on other sites More sharing options...
edpierre Posted May 30, 2003 Share Posted May 30, 2003 Hello, All The question may like as a stupid one,but... How to change the auto_increment state (from OFF to ON or vice versa) in phpmyadmin and in DOS ? E Pierre Link to comment Share on other sites More sharing options...
Emmtee Posted May 30, 2003 Share Posted May 30, 2003 is there no way to tell mySQL to generate a random number automatically ? http://www.oscommerce.com/community/contributions,1762 Link to comment Share on other sites More sharing options...
Guest Posted July 18, 2003 Share Posted July 18, 2003 I've installed the code to generate an order number based on the date & a random number, but no matter what I do, the database lists the order no as '2147483647' The order no in the email is correct. What's going wrong? The order number comes from - srand ((float) microtime() * 10000000); $r1 = rand(100,999); $t1 = date("yzhis"); $ordernum = $t1.$r1; Other than that, I followed the instructions in the contribution. Link to comment Share on other sites More sharing options...
Emmtee Posted July 18, 2003 Share Posted July 18, 2003 I've installed the code to generate an order number based on the date & a random number, but no matter what I do, the database lists the order no as '2147483647' The order no in the email is correct. What's going wrong?The order number comes from - srand ((float) microtime() * 10000000); $r1 = rand(100,999); $t1 = date("yzhis"); $ordernum = $t1.$r1; Other than that, I followed the instructions in the contribution. probably you missed the place where it inserts the order into DB - the ID field ist left away as it's autovalue... you would need to add it manually and run a check for already existing number... btw - using just microtime will probably be better than using random + time as you always have the danger of random hitting the same value 2x http://www.oscommerce.com/community/contributions,1762 Link to comment Share on other sites More sharing options...
Guest Posted July 18, 2003 Share Posted July 18, 2003 probably you missed the place where it inserts the order into DB - the ID field ist left away as it's autovalue... you would need to add it manually and run a check for already existing number... btw - using just microtime will probably be better than using random + time as you always have the danger of random hitting the same value 2x Do you mean this bit? 4. Change this Code: $insert_id = tep_db_insert_id(); to the following code: $insert_id = $ordernum; I've double checked & it is there. What else should I check? Surely using both the random number & the time reduces the chance of 2 the same, since even if 2 people order at the same second, the random part will be different. Link to comment Share on other sites More sharing options...
Guest Posted July 18, 2003 Share Posted July 18, 2003 1. changed orders_id type from INT(11) to VARCHAR(11) in the following tables: orders orders_products orders_products_attributes orders_products_download orders_status_history orders_total 2. Pasted randomizing code right before this line // load the before_process function from the payment modules 3. changed $sql_data_array = array('customers_id' => $customer_id, to $sql_data_array = array('orders_id' => $ordernum, 'customers_id' => $customer_id, Double check that you did 1, 2, and 3. If you have 1 and 3, you might want to post the code you used for 2, perhaps there is an error. Unfortunately, I can see ways that any of the four steps could produce the error that you get. Good luck, Matt Link to comment Share on other sites More sharing options...
Guest Posted July 18, 2003 Share Posted July 18, 2003 srand ((float) microtime() * 10000000); $r1 = rand(100,999); $t1 = date("yzhis"); $ordernum = $t1.$r1; If I replace that with just $t1 = date("U"); $ordernum = $t1; it seems to work. I'm continuing to try different ways to get this to work, because I really want to reduce the possibility of duplicated order nos. Link to comment Share on other sites More sharing options...
Guest Posted July 18, 2003 Share Posted July 18, 2003 If you change it to $ordernum = "ORDER"; what happens? If you get the -1 (2147483647) in the database that way, then I would say that the definition in the database is wrong and needs to be changed from INT to VARCHAR. If that works, then I would guess that there is an error with the randomization code. Hth, Matt Link to comment Share on other sites More sharing options...
Guest Posted July 18, 2003 Share Posted July 18, 2003 DOH!!! I didn't change INT to VARCHAR because I was only using numerics & not the random alphas. But of course its still VARCHAR because of conjoining the 2 values :oops: :roll: Thanks for the prompting. I've now got the order number showing up ok, but orders are being duplicated in the database. Only one email is sent for each order number. My Order History Order Number: 03199-123226777 Order Status: Pending Order Date: Saturday 19 July, 2003 Shipped To: test3 test Products: 1 Order Cost: ?5.42 View Order Order Number: 03199-123226777 Order Status: Pending Order Date: Saturday 19 July, 2003 Shipped To: test3 test Products: 1 Order Cost: ?10.42 View Order Order Number: 03199-122850848 Order Status: Pending Order Date: Saturday 19 July, 2003 Shipped To: test3 test Products: 1 Order Cost: ?5.42 View Order Order Number: 03199-122850848 Order Status: Pending Order Date: Saturday 19 July, 2003 Shipped To: test3 test Products: 1 Order Cost: ?10.42 View Order Displaying 1 to 4 (of 4 orders) Result Pages: 1 Suggestions please anyone? Link to comment Share on other sites More sharing options...
Guest Posted July 19, 2003 Share Posted July 19, 2003 I've tested some more & not only does it copy a customers order under all their previous order numbers and add their previous orders under the current order number (as in the quote above) It also copies all previous orders when a new customer places an order!!!! HELP!!!!! Link to comment Share on other sites More sharing options...
Genius Posted July 28, 2003 Share Posted July 28, 2003 hi all i have this contribution.. and would like to know how to disable this function as i would like to have the order numbers in an order thanks Link to comment Share on other sites More sharing options...
Guest Posted July 28, 2003 Share Posted July 28, 2003 Revert to the backup you made before you installed the contribution. Link to comment Share on other sites More sharing options...
Genius Posted July 28, 2003 Share Posted July 28, 2003 thanks Link to comment Share on other sites More sharing options...
Guest Posted July 28, 2003 Share Posted July 28, 2003 What size and type is your order number field set to? Charlie Link to comment Share on other sites More sharing options...
Genius Posted July 28, 2003 Share Posted July 28, 2003 I just wanted the default settings. Link to comment Share on other sites More sharing options...
msheno01 Posted July 28, 2003 Share Posted July 28, 2003 This contribution is great. I would like to install it except that I don't know where to put the randan generating code ( which file). I know that the array's go in checkout_process, but other than that, I don't know. Please explain where each code should go in which files. Thank You Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.