'', 'group_status' => '', 'group_name' => '', 'group_mandatory' => '', 'group_type' => '', 'created' => '', 'createdby' => '', 'updated' => '', 'updatedby' => '', 'accounthierarchy' => '' ]; if (isset($_GET['rowID'])) { //CALL TO API $api_url = '/v2/products_attributes/rowID='.$_GET['rowID']; $responses = ioServer($api_url,''); //Decode Payload if (!empty($responses)){$responses = json_decode($responses,true);}else{$responses = null;} $products_attributes = json_decode(json_encode($responses[0]), true); //CALL TO API FOR RELATED TRANSLATIONS $api_url = '/v2/products_attributes_items/media=all&group_id='.$_GET['rowID']; $products_attributes_items = ioServer($api_url,''); //Decode Payload if (!empty($products_attributes_items)){$products_attributes_items = json_decode($products_attributes_items,true);}else{$products_attributes_items = null;} //CALL TO API $api_url = '/v2/media/list=product_image'; $media_responses = ioServer($api_url,''); //Decode Payload if (!empty($media_responses)){$media_responses = json_decode($media_responses,true);}else{$media_responses = null;} if ($update_allowed === 1){ if (isset($_POST['submit'])) { //GET ALL POST DATA $payload = json_encode($_POST, JSON_UNESCAPED_UNICODE); //API call $responses = ioServer('/v2/products_attributes', $payload); if ($responses === 'NOK'){ } else { header('Location: index.php?page=products_attributes&success_msg=2'); exit; } } if (isset($_POST['add'])) { //GET ALL POST DATA $payload = json_encode($_POST, JSON_UNESCAPED_UNICODE); //API call $responses = ioServer('/v2/products_attributes_items', $payload); if ($responses === 'NOK'){ } else { header('Location: index.php?page=products_attributes_manage&rowID='.$_GET['rowID'].''); exit; } } if (isset($_POST['update']) && isset($_POST['attributes'])) { //RUN through all POST items foreach ($_POST['attributes'] as $attr){ //GET ALL POST DATA $payload = json_encode($attr, JSON_UNESCAPED_UNICODE); var_dump($payload); //API call $responses = ioServer('/v2/products_attributes_items', $payload); if ($responses === 'NOK'){ //NOT correct exit procedure exit; } } header('Location: index.php?page=products_attributes_manage&rowID='.$_GET['rowID'].''); exit; } } if ($delete_allowed === 1){ if (isset($_POST['delete'])) { //GET ALL POST DATA $payload = json_encode($_POST, JSON_UNESCAPED_UNICODE); //API call $responses = ioServer('/v2/products_attributes', $payload); // Redirect and delete product if ($responses === 'NOK'){ } else { header('Location: index.php?page=products_attributes&success_msg=3'); exit; } } } } else { // Create a new variable if (isset($_POST['submit']) && $create_allowed === 1) { //GET ALL POST DATA $payload = json_encode($_POST, JSON_UNESCAPED_UNICODE); //API call $responses = ioServer('/v2/products_attributes', $payload); if ($responses === 'NOK'){ } else { //GET ROWID OF CREATED ITEM $group_rowID = json_decode($responses,true); header('Location: index.php?page=products_attributes_manage&rowID='.$group_rowID['rowID'].''); exit; } } } //EMPTY VIEW $view = ''; // Handle success messages if (isset($_GET['success_msg'])) { if ($_GET['success_msg'] == 0) { $success_msg = $error_msg_0; } } template_header('Products attributes', 'products_attributes', 'manage'); if (isset($success_msg)){ $view .= '
'.$success_msg.'
| '.($products_attributes_item_status ?? 'status').' | '.($products_attributes_item_name ?? 'name').' | '.($products_attributes_item_quantity ?? 'quantity').' | '.($products_attributes_item_position ?? 'position').' | '.($products_attributes_item_media ?? 'media').' | '.($products_attributes_alternative_media ?? 'alternative').' | '.$general_created.' | '.$general_actions.' |
|---|---|---|---|---|---|---|---|
| '.($message_no_products_attributess ?? '').' | |||||||
|
|
|
'.getRelativeTime($items['created']).' | |||||