CMXX - Categories and filters
This commit is contained in:
@@ -58,6 +58,23 @@ else {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
//CHECK IF CATEGORIES ARE SEND AND UPDATE
|
||||
if (isset($post_content['categories'])){
|
||||
|
||||
if ($command != 'insert'){
|
||||
//CHANGE OR DELETE SO PRODUCT_ID IS AVAILABLE IN CALL
|
||||
$api_url = '/v2/products_categories/';
|
||||
$data = json_encode(array("categories" => $post_content['categories'], "product_id" => $id), JSON_UNESCAPED_UNICODE);
|
||||
$responses = ioApiv2($api_url,$data,$clientsecret);
|
||||
} else {
|
||||
//INSERT Product ROWID NOT AVAILABLE YET. store $post_content['categories'] in different variable.
|
||||
$categories = $post_content['categories'];
|
||||
}
|
||||
|
||||
//REMOVE CATERGORIES FROM POST_CONTENT ARRAY
|
||||
unset($post_content['categories']);
|
||||
}
|
||||
|
||||
//CREAT NEW ARRAY AND MAP TO CLAUSE
|
||||
if(isset($post_content) && $post_content!=''){
|
||||
foreach ($post_content as $key => $var){
|
||||
@@ -90,6 +107,10 @@ elseif ($command == 'insert' && isAllowed('products',$profile,$permission,'C') =
|
||||
$sql = 'INSERT INTO products ('.$clause_insert.') VALUES ('.$input_insert.')';
|
||||
$stmt = $pdo->prepare($sql);
|
||||
$stmt->execute($execute_input);
|
||||
|
||||
$api_url = '/v2/products_categories/';
|
||||
$data = json_encode(array("categories" => $categories, "product_id" => $id), JSON_UNESCAPED_UNICODE);
|
||||
$responses = ioApiv2($api_url,$data,$clientsecret);
|
||||
}
|
||||
elseif ($command == 'delete' && isAllowed('products',$profile,$permission,'D') === 1){
|
||||
$stmt = $pdo->prepare('DELETE FROM products WHERE rowID = ? '.$whereclause.'');
|
||||
|
||||
Reference in New Issue
Block a user