CMXX - Categories and filters
This commit is contained in:
@@ -41,9 +41,18 @@ $product = [
|
||||
'partnerhierarchy' => '',
|
||||
'sn' =>'',
|
||||
'healthindex' =>'',
|
||||
'configurable' =>''
|
||||
'configurable' =>'',
|
||||
'categories' => []
|
||||
];
|
||||
|
||||
//GET ALL CATEGORIES
|
||||
$api_url = '/v2/categories/';
|
||||
$categories = ioServer($api_url,'');
|
||||
|
||||
//Decode Payload
|
||||
if (!empty($categories)){$categories = json_decode($categories,true);}else{$categories = null;}
|
||||
|
||||
|
||||
if (isset($_GET['id'])) {
|
||||
// ID param exists, edit an existing product
|
||||
//CALL TO API
|
||||
@@ -68,6 +77,13 @@ if (isset($_GET['id'])) {
|
||||
}
|
||||
}
|
||||
|
||||
//GET RELATED CATEGORIES
|
||||
$api_url = '/v2/products_categories/product_id='.$_GET['id'];
|
||||
$product['categories'] = ioServer($api_url,'');
|
||||
|
||||
//Decode Payload
|
||||
if (!empty($product['categories'] )){$product['categories'] = json_decode($product['categories'] ,true);}else{$product['categories'] = null;}
|
||||
|
||||
if ($update_allowed === 1){
|
||||
if (isset($_POST['file_upload'])){
|
||||
uploadProduct($_POST['productcode']);
|
||||
@@ -186,6 +202,21 @@ $view .= '<div class="content-block tab-content active">
|
||||
<label for="price"><i class="required">*</i> '.($product_quantity ?? 'Quantity').' </label>
|
||||
<input id="price" type="number" name="quantity" placeholder="'.($product_quantity ?? 'Quantity').'" min="0" step="1" value="'.$product['quantity'].'">
|
||||
<input type="hidden" name="rowID" value="'.$product['rowID'].'">
|
||||
<label for="category">Categories</label>
|
||||
<div class="multiselect" data-name="categories[]">';
|
||||
foreach ($product['categories'] as $cat){
|
||||
$view .= ' <span class="item" data-value="'.$cat['rowID'].'">
|
||||
<i class="remove">×</i>'.$cat['name'].'
|
||||
<input type="hidden" name="categories[]" value="'.$cat['rowID'].'">
|
||||
</span>';
|
||||
}
|
||||
$view .= ' <input type="text" class="search" id="category" placeholder="Categories">
|
||||
<div class="list">';
|
||||
foreach ($categories as $cat) {
|
||||
$view .= ' <span data-value="'.$cat['rowID'].'">'.$cat['name'].'</span>';
|
||||
}
|
||||
$view .= ' </div>
|
||||
</div>
|
||||
<input id="source_'.$product['rowID'].'" type="hidden" name="product_media" value="'.$product['product_media'].'">
|
||||
<img id="image_'.$product['rowID'].'" src="'.$product['full_path'].'" alt="" style="display: block; max-width: 75px;">
|
||||
<button type="button" class="btn" id="openSelectorBtn" onclick="setSourceID(\''.$product['rowID'].'\'), openDialog(\'image_'.$product['rowID'].'\')">'.($button_assign_image ?? 'Assign Image').'</button>
|
||||
|
||||
Reference in New Issue
Block a user