• Hey guys, I’m after a way to export the order number in one cell, then in the cell next to it have the order number with a -1 next to it without having to do it manually.

    I made an excel code for it, but when I use a code in the export orders settings, it puts a space before the = so the code won’t work.

    Any help would be appreciated.
    Thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author algol.plus

    (@algolplus)

    Hi

    yes, we add extra space to prevent security injections.

    please, use this way to add new field https://docs.algolplus.com/algol_order_export/fields/

    code will be
    $value = $order->get_id() - 1;

    • This reply was modified 4 years, 4 months ago by algol.plus.
    Thread Starter sasquatchis

    (@sasquatchis)

    I’m using the following.

    $value = $order->get_order_number() - 1;

    And in the field it’s only showing -1.
    With the order id when I use get_id it doesn’t have the -1 either, however I need the full order number not just the id. Still can’t seem to get it to work.

    Plugin Author algol.plus

    (@algolplus)

    what is order number ( without modification) ?

    Plugin Author algol.plus

    (@algolplus)

    please, use this code

    $value = preg_replace_callback('#^(.+?)(\d+)$#',
    function($matches){
     return $matches[1]. ($matches[2] -1);
    },
    $order->get_order_number() );
    Thread Starter sasquatchis

    (@sasquatchis)

    We use box numbers because of the prefix we need to include in our order numbers for sending off deliveries.
    order_number translates to
    MEYS_HD_138776

    The code above made it subtract a number off the order number to
    MEYS_HD_138775

    I’m just after the dash 1 at the end of the order number
    MEYS_HD_138776-1

    Plugin Author algol.plus

    (@algolplus)

    just use

    $value = $order->get_order_number() . "- 1";

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Need to export order number’ is closed to new replies.