/** * Function to check if the vendor_id of the product * $d['product_id'] matches the vendor_id associated with the * user that calls this function * * @param array $d * @return boolean True, when vendor_id matches, false when not */ function check_vendor($d) { $ps_vendor_id = $_SESSION["ps_vendor_id"]; $db = new ps_DB; $q = "SELECT vendor_id FROM #__{vm}_product "; $q .= "WHERE vendor_id = '$ps_vendor_id' "; $q .= "AND product_id = '" . $d["product_id"] . "' "; $db->query($q); if ($db->next_record()) { return true; } else { return false; } }