<?php
include_once "../../../config.php";
include_once "../../database1.php";
include_once "../../../validation.php";
include_once "../../../Helper.php";

require_once '../check_edit_page_ajax.php';

class getFilterValuesOfSubCategory extends database{
	public function index($id, $productID)
	{
		$where[] = $id;
		$where[] = $productID;
		


		$sql = ' SELECT fv.*, pf.cl_value_id FROM tb_filter_value fv LEFT JOIN tb_product_filter pf ON fv.cl_id=pf.cl_value_id WHERE fv.cl_filter_id=? AND (pf.cl_product_id=? OR pf.cl_product_id IS NULL) AND fv.cl_deleted_at IS NULL ';

		return $this->callQuery($sql, $where);
	}
}

if(!isset($_GET['product_id']))
{
	http_response_code(404);
	echo json_encode(['error_text' => 'Something Went Wrong']);
	exit;
}

$productID = $_GET['product_id'];

$helper = new Helper();
$validation = new validation();

$obj = new getFilterValuesOfSubCategory();
$res = $obj->index($id, $productID);



http_response_code(200);
echo json_encode($res);
exit;