<?php
require dirname(dirname(__FILE__)) . '/inc/Config.php';
require dirname(dirname(__FILE__)) . '/inc/Crud.php';
header('Content-type: text/json');
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$data = json_decode(file_get_contents('php://input'), true);
     
	        $product = $data['product_id'];
			$mprice = $data['mprice'];
			
			$mtype = stripslashes($lundry->real_escape_string(trim($data['title'])));
			$mdiscount = $data['mdiscount'];
			$mstock = $data['mstock'];
			$store_id = $lundry->real_escape_string($data["store_id"]);
			
if ($product == '' or $store_id == '' or $mprice == ''   or $mtype == '' or $mdiscount == '' or $mstock == '') {
    $returnArr = array(
        "ResponseCode" => "401",
        "Result" => "false",
        "ResponseMsg" => "Something Went Wrong!"
    );
} else {
			
  $table="tbl_product_attribute";
 $field_values = array("product_id", "normal_price", "title", "discount", "out_of_stock", "store_id");
$data_values = array("$product", "$mprice", "$mtype", "$mdiscount", "$mstock", "$store_id");
  
  $h = new Crud($lundry);
            $check = $h->lundryinsertdata_Api($field_values, $data_values, $table);
			
			$returnArr    = array(
                "ResponseCode" => "200",
                "Result" => "true",
                "ResponseMsg" => "Product Attribute Add Successfully"
            );
	}
echo json_encode($returnArr);
?>