<?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.*, pav.cl_value_id, pav.cl_show, pav.cl_supplier_price, pav.cl_monthly_price, pav.cl_weight, pav.cl_default FROM tb_filter_value fv LEFT JOIN tb_product_attributes_values pav ON fv.cl_id=pav.cl_value_id WHERE fv.cl_filter_id=? AND (pav.cl_product_id=? OR pav.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;