reseller to customer
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
class Wiaas_Admin_CL_Shop {
|
||||
|
||||
public static function init() {
|
||||
|
||||
add_action( 'admin_menu', array( __CLASS__, 'add_customers_page' ), 9 );
|
||||
}
|
||||
|
||||
public static function add_customers_page() {
|
||||
add_menu_page(
|
||||
__( 'Customers', 'wiaas' ),
|
||||
__( 'Customers', 'wiaas' ),
|
||||
'manage_wiaas_cl_customers',
|
||||
'wiaas-cl-customers',
|
||||
array(__CLASS__, 'output_customers'),
|
||||
'dashicons-groups',
|
||||
'66.0' );
|
||||
}
|
||||
|
||||
public static function output_orders() {
|
||||
|
||||
}
|
||||
|
||||
public static function output_customers() {
|
||||
$organization_id = wiaas_get_current_user_organization_id();
|
||||
|
||||
// handle default order type update if needed
|
||||
if (! empty($_POST['wiaas_update_cl_default_order_type_nonce']) &&
|
||||
! empty($_POST['default_order_type']) &&
|
||||
wp_verify_nonce(
|
||||
$_POST['wiaas_update_cl_default_order_type_nonce'],
|
||||
'wiaas_update_cl_default_order_type')
|
||||
) {
|
||||
|
||||
$default_order_type = sanitize_key($_POST['default_order_type']);
|
||||
|
||||
error_log($default_order_type);
|
||||
|
||||
Wiaas_Shop::update_default_order_type($organization_id, $default_order_type);
|
||||
|
||||
}
|
||||
|
||||
// handle customer order type update if needed
|
||||
if (! empty($_POST['wiaas_update_cl_customer_order_type_nonce']) &&
|
||||
! empty($_POST['customer_order_type']) &&
|
||||
wp_verify_nonce(
|
||||
$_POST['wiaas_update_cl_customer_order_type_nonce'],
|
||||
'wiaas_update_cl_customer_order_type')
|
||||
) {
|
||||
|
||||
$customer_id = absint($_POST['customer_order_type']['customer_id']);
|
||||
$order_type = sanitize_key($_POST['customer_order_type']['order_type']);
|
||||
|
||||
Wiaas_Shop_Data_Store::update_shop_customer_order_type(
|
||||
$organization_id,
|
||||
$customer_id,
|
||||
$order_type);
|
||||
}
|
||||
|
||||
$customers = Wiaas_Shop_Data_Store::get_shop_customers($organization_id);
|
||||
|
||||
require 'views/html-admin-cl-customers-page.php';
|
||||
}
|
||||
}
|
||||
|
||||
Wiaas_Admin_CL_Shop::init();
|
||||
Reference in New Issue
Block a user