Order ID

Hello,

Does anybody know how to change (somewhere in settings or some php files) how would be Order ID generated? Now, it consist of numbers and letters (looks like some random string), and my customer need just numbers (because, he will use Order ID in payment parameters, and banks in our Country don't accept letter in that parameter). So, it can be random string... but it have to consist just from numbers.

Thank you very much.

Kindest regards,

Sinisa Sinjori

  • Kimberly
    • Champion of Loops

    Hello Sinisa!

    Welcome to the WPME DEV Community!

    If you want to hardcode an option:

    Add this function to the main marketpress.php file:

    function generate_random_number($length) {
    $random = '';
    for ($i = 0; $i < $length; $i++) {
    $random .= chr(rand(ord('0'), ord('9')));
    }
    return $random;
    }

    Then call it like: generate_random_number(12);

    Replace this line (3002) in the main marketpress.php file:

    $order_id = substr(sha1(uniqid('')), rand(1, 24), 12);
    with
    $order_id = generate_random_number(12);

    or if you are familiar with hooks you can use this to remove the filter and apply the above code:

    $order_id = apply_filters( 'mp_order_id', $order_id );

    Best,

    Kimberly

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.