79 lines
1.6 KiB
PHP
79 lines
1.6 KiB
PHP
<?php
|
|
|
|
class admin_customer_editor_actions {
|
|
|
|
private $base_object;
|
|
private $config;
|
|
|
|
function __construct($base_object, $layout_object) {
|
|
$this->base_object = $base_object;
|
|
}
|
|
|
|
public function run() {
|
|
if (isset($_GET['action'])) {
|
|
$action = $_GET['action'];
|
|
} else {
|
|
$action = false;
|
|
}
|
|
|
|
if ($action == 'set_standard') {
|
|
$this->set_standard();
|
|
} elseif ($action == "delete") {
|
|
$this->delete();
|
|
} else {
|
|
echo "ERROR: no action.";
|
|
|
|
exit();
|
|
}
|
|
}
|
|
|
|
private function set_standard() {
|
|
if (isset($_GET['customer_id'])) {
|
|
$customer_id = $_GET['customer_id'];
|
|
} else {
|
|
echo json_encode(array('status' => 'error', 'message' => "ERROR: no user id"));
|
|
|
|
exit();
|
|
}
|
|
|
|
if (isset($_GET['address_id'])) {
|
|
$address_id = $_GET['address_id'];
|
|
} else {
|
|
echo json_encode(array('status' => 'error', 'message' => "ERROR: no address id"));
|
|
|
|
exit();
|
|
}
|
|
|
|
$result = Customer::set_standard_address($customer_id, $address_id);
|
|
|
|
echo json_encode(array('status' => 'success', 'data' => $result));
|
|
|
|
exit();
|
|
}
|
|
|
|
private function delete() {
|
|
if (isset($_GET['customer_id'])) {
|
|
$customer_id = $_GET['customer_id'];
|
|
} else {
|
|
echo json_encode(array('status' => 'error', 'message' => "ERROR: no user id"));
|
|
|
|
exit();
|
|
}
|
|
|
|
if (isset($_GET['address_id'])) {
|
|
$address_id = $_GET['address_id'];
|
|
} else {
|
|
echo json_encode(array('status' => 'error', 'message' => "ERROR: no address id"));
|
|
|
|
exit();
|
|
}
|
|
|
|
$result = Customer::delete_address($customer_id, $address_id);
|
|
|
|
echo json_encode(array('status' => 'success', 'data' => $result));
|
|
|
|
exit();
|
|
}
|
|
|
|
}
|