'', 'name' => '', 'parent_id' => 0, 'status' => 1, 'filter' => 0, 'accounthierarchy' => '' ]; $category_exclude = (isset($_GET['rowID'])) ? 'rowID_exclude='.$_GET['rowID'] : ''; //GET ALL CATEGORIES $api_url = '/v2/categories/'.$category_exclude; $categories = ioServer($api_url,''); //Decode Payload if (!empty($categories)){$categories = json_decode($categories,true);}else{$categories = null;} if (isset($_GET['rowID'])) { //CALL TO API $api_url = '/v2/categories/rowID='.$_GET['rowID']; $category = ioServer($api_url,''); //Decode Payload if (!empty($category)){$category = json_decode($category,true);}else{$category = null;} $category = $category[0]; // ID param exists, edit an existing category $page = 'Edit'; if (isset($_POST['submit'])) { //Update the category //GET ALL POST DATA $payload = json_encode($_POST, JSON_UNESCAPED_UNICODE); //API call $responses = ioServer('/v2/categories', $payload); if ($responses === 'NOK'){ } else { header('Location: index.php?page=categories&success_msg=2'); exit; } } if (isset($_POST['delete'])) { //GET ALL POST DATA $payload = json_encode($_POST, JSON_UNESCAPED_UNICODE); var_dump($payload); //API call $responses = ioServer('/v2/categories', $payload); if ($responses === 'NOK'){ } else { //Redirect and delete product header('Location: index.php?page=categories&success_msg=3'); exit; } } } else { // Create a new category $page = 'Create'; if (isset($_POST['submit'])) { //GET ALL POST DATA $payload = json_encode($_POST , JSON_UNESCAPED_UNICODE); //API call $responses = ioServer('/v2/categories', $payload); if ($responses === 'NOK'){ // DO nothing } else { header('Location: index.php?page=categories&success_msg=1'); exit; } } } template_header('Category', 'categories', 'manage'); $view ='