getOrders('2022-09-01'); $miraviaTable = new MiraviaTable(); // die('
'.print_r($orders,true).''); $data = array(); $miraviaTable->custom_actions = array( 'download' => sprintf('Download', sanitize_text_field($_REQUEST['page']), sanitize_text_field($_REQUEST['subpage']), 'download', ), ); $miraviaTable->columns = [ 'id' => "Order Number", 'name' => 'Customer Name', 'price' => "Price", 'statuses' => "Status", 'created_at' => 'Created', 'updated_at' => 'Updated', ]; foreach($orders['data']['orders'] as $k => $p) { $data[] = array( 'id' => $p['order_number'], 'name' => $p['customer_first_name'], 'price' => number_format($p['price'], 2) . '€', 'statuses' => $p['statuses'][0], 'created_at' => date('d-m-Y H:i', strtotime($p['created_at'])), 'updated_at' => date('d-m-Y H:i', strtotime($p['updated_at'])), ); } // die('
' . print_r($data, true) . ''); $miraviaTable->data_table = $data; $miraviaTable->total_elements = $orders['data']['count']; $miraviaTable->prepare_items(); }else{ $accounts = MiraviaCore::get_accounts(); $html_accounts = ""; if(count($accounts) == 1) { wp_safe_redirect( "?page=miravia_settings&subpage=orders&account={$accounts[0]['name']}&token={$accounts[0]['token']}&account_id={$accounts[0]['id']}", 301); die(); } foreach($accounts as $a) { $html_accounts .= "{$a['name']} ({$a['email']})"; } } ?>
'.__('Orders by account', 'miravia').' '.sanitize_text_field($_GET['account']).'
', array('p' => array())); $miraviaTable->display(); } ?>