public function assign_category()
 {
     if (!isset($_POST['productID']) || !isset($_POST['categoryID'])) {
         exit;
     }
     check_ajax_referer('fpd_ajax_nonce', '_ajax_nonce');
     global $wpdb;
     $checked = intval($_POST['checked']);
     header('Content-Type: application/json');
     if ($checked) {
         $fancy_category = new Fancy_Category($_POST['categoryID']);
         $inserted = $fancy_category->add_product($_POST['productID']);
         //assign product to category
         echo json_encode($inserted);
     } else {
         $test = $wpdb->query($wpdb->prepare("DELETE FROM " . FPD_CATEGORY_PRODUCTS_REL_TABLE . " WHERE category_id=%d AND product_id=%d", $_POST['categoryID'], $_POST['productID']));
         echo json_encode($test);
     }
     die;
 }