PK
TL\} solvcrm-wp-bridge.zipPK RZ`PJ solvcrm-wp-bridge.php array(
'Content-Type' => 'application/json',
'Authorization' => 'Bearer ' . $api_key
),
'body' => json_encode($form_data),
'timeout' => 15
));
return $response;
}
PK (RZH< < includes/shortcode.php ''), $atts);
ob_start();
?>
SOLVCRM Plugin Instellingen
Handleiding - SOLVCRM Bridge
Met deze plugin kun je dynamisch CRM-formulieren op je WordPress website plaatsen en leads automatisch versturen naar jouw SOLVCRM-installatie.
Stap 1: Instellingen
- Ga naar SOLVCRM Bridge > Instellingen.
- Voer de API URL in, bijvoorbeeld:
https://jouwdomein.nl/plugins/Web_Form_Plugin
- Voer de API Key in die je binnen SOLVCRM gebruikt (bijv. gegenereerd token).
Stap 2: Formulier op pagina plaatsen
Gebruik de shortcode om een formulier op een pagina te tonen:
[crm_form id="1"]
Vervang 1 met het ID van het formulier uit SOLVCRM.
Stap 3: Styling aanpassen
Je kunt de velden stylen via je eigen thema of een extra CSS bestand laden.
Ondersteuning
Voor hulp of uitbreiding, neem contact op via solvware.nl.
table('sw_estimate_requests_forms')
->select('id, title, fields')
->where('is_active', 1)
->get()
->getResult();
return $this->response->setJSON($forms);
}
function submit_form() {
$data = $this->request->getJSON(true);
if (!isset($data['form_id']) || !isset($data['fields'])) {
return $this->response->setStatusCode(400)->setJSON(["error" => "Missing form_id or fields"]);
}
// Haal formulierdefinitie op
$form = db()->table('sw_estimate_requests_forms')
->where('id', $data['form_id'])
->get()
->getRow();
if (!$form) {
return $this->response->setStatusCode(404)->setJSON(["error" => "Form not found"]);
}
$form_fields = json_decode($form->fields, true);
if (!is_array($form_fields)) {
return $this->response->setStatusCode(500)->setJSON(["error" => "Form configuration invalid"]);
}
// Haal e-mail en naam op uit ingediende data
$email = $data['fields']['email'] ?? null;
$name = $data['fields']['name'] ?? 'Onbekende naam';
if (!$email) {
return $this->response->setStatusCode(400)->setJSON(["error" => "Email is required to create client"]);
}
// Controleer of gebruiker al bestaat
$user = db()->table('sw_users')->where('email', $email)->get()->getRow();
if (!$user) {
// Maak nieuwe user met type 'client'
$user_data = [
'email' => $email,
'first_name' => $name,
'user_type' => 'client',
'created_at' => date('Y-m-d H:i:s')
];
db()->table('sw_users')->insert($user_data);
$user_id = db()->insertID();
} else {
$user_id = $user->id;
}
// Controleer of client bestaat
$client = db()->table('sw_clients')->where('user_id', $user_id)->get()->getRow();
if (!$client) {
$client_data = [
'user_id' => $user_id,
'company_name' => $name,
'created_date' => date('Y-m-d H:i:s')
];
db()->table('sw_clients')->insert($client_data);
$client_id = db()->insertID();
} else {
$client_id = $client->id;
}
// Maak nieuwe estimate request aan
$insert_data = [
"form_id" => $data["form_id"],
"created_at" => date("Y-m-d H:i:s"),
"data" => json_encode($data["fields"]),
"client_id" => $client_id
];
db()->table("sw_estimate_requests")->insert($insert_data);
return $this->response->setJSON(["success" => true, "client_id" => $client_id]);
}
}
function view_requests() {
$requests = db()->table('sw_estimate_requests r')
->select('r.id, r.created_at, r.client_id, c.company_name, u.email, r.data')
->join('sw_clients c', 'c.id = r.client_id', 'left')
->join('sw_users u', 'u.id = c.user_id', 'left')
->orderBy('r.created_at', 'DESC')
->get()
->getResult();
$view_data['requests'] = $requests;
return $this->template->rander('Web_Form_Plugin\Views\requests\index', $view_data);
}
function _get_sidebar_menu() {
return view("Web_Form_Plugin\Views\sidebar");
}
PK RZ:ȸ< Routes/routes.phpget('web_form_plugin/forms', 'Web_Form_Plugin::get_forms', ['namespace' => 'Web_Form_Plugin\Controllers']);
$routes->post('web_form_plugin/submit', 'Web_Form_Plugin::submit_form', ['namespace' => 'Web_Form_Plugin\Controllers']);
$routes->get('web_form_plugin/requests', 'Web_Form_Plugin::view_requests', ['namespace' => 'Web_Form_Plugin\Controllers']);
PK SZ@ Views/sidebar.php
Webformulier Aanvragen
PK RZ Views/requests/index.php
Webformulier Aanvragen
| ID |
Klant |
Email |
Datum |
Gegevens |
| id; ?> |
company_name; ?> |
email; ?> |
created_at; ?> |
data), JSON_PRETTY_PRINT); ?> |
PK QZ;gg5 5 index.phpPK SZ`zHF F \ Controllers/Web_Form_Plugin.phpPK RZ:ȸ< Routes/routes.phpPK SZ@ Views/sidebar.phpPK RZ Views/requests/index.phpPK H PK
TL\} solvcrm-wp-bridge.zipPK
UL\y, , J Web_Form_Plugin.zipPK .