Querying by [ItemShops][Itemshop][x][timeStamp]

Ryan ShenkRyan Shenk Member Posts: 12

Good morning!

I'm attempting to create a query to return all products that have had an inventory event in the last 2 days, using this (simplified) query. However, it's returning all products that have had the item itself modified (not the ItemShops child), and referencing the Item timestamp. Does anyone have guidance as to how I can access the child timestamp (as shown in the array below)? Thank you very much!

$query = [

        'load_relations' => '["ItemShops"]',

        'timeStamp' => '>=,'.date_format($dateFilter, ('Y-m-d\TH:i:sO')),

        'limit' => 100,

        'offset' => $offset

      ];

 ["ItemShops"]=>
  array(1) {
    ["ItemShop"]=>
    array(3) {
      [0]=>
      array(11) {
        ["itemShopID"]=>
        string(6) "668375"
        ["qoh"]=>
        string(2) "12"
        ["sellable"]=>
        string(2) "12"
        ["backorder"]=>
        string(1) "0"
        ["componentQoh"]=>
        string(1) "0"
        ["componentBackorder"]=>
        string(1) "0"
        ["reorderPoint"]=>
        string(2) "56"
        ["reorderLevel"]=>
        string(3) "168"
        ["timeStamp"]=>
        string(25) "2019-05-22T15:01:39+00:00"
        ["itemID"]=>
        string(6) "134086"
        ["shopID"]=>
        string(1) "1"


2 comments

  • Ryan ShenkRyan Shenk Member Posts: 12

    Figured this one out - for future reference, the following code will reference the ItemShops timestamp and return Items that have had an inventory event within a timespan.


            'ItemShops.timeStamp' => '>=,'.date_format($dateFilter, ('Y-m-d\TH:i:sO')),

  • LeahLeah Moderator, Lightspeed Staff Posts: 117 moderator

    @Ryan ShenkGlad you figured it out and thanks for sharing your results!

    API Support
    Lightspeed HQ
Sign In or Register to comment.