init();
}
public function init()
{
add_action('admin_menu', array($this, 'add_menu_item'));
add_action('admin_footer', array($this, 'cancel_request'));
add_action('admin_footer', array($this, 'approved_request'));
add_action('wp_ajax_wooacd_show_custom_product_item', array($this, 'show_custom_product_item')); // Call when user logged in
add_action('wp_ajax_nopriv_wooacd_show_custom_product_item', array($this, 'show_custom_product_item')); // Call when user in not
add_action('wp_ajax_wooacd_cancel_request', array($this, 'cancel_request')); // Call when user logged in
add_action('wp_ajax_nopriv_wooacd_cancel_request', array($this, 'cancel_request')); // Call when user in not
add_action('wp_ajax_wooacd_insert_admin_note', array($this, 'insert_admin_note')); // Call when user logged in
add_action('wp_ajax_nopriv_wooacd_insert_admin_note', array($this, 'insert_admin_note')); // Call when user in not
add_action('wp_ajax_wooacd_add_to_cart_search_product', array($this, 'add_to_cart_search_product')); // Call when user logged in
add_action('wp_ajax_nopriv_wooacd_add_to_cart_search_product', array($this, 'add_to_cart_search_product')); // Call when user in not
add_action('wp_ajax_wooacd_approve_product', array($this, 'approve_product')); // Call when user logged in
add_action('wp_ajax_nopriv_wooacd_approve_product', array($this, 'approve_product')); // Call when user in not
add_action('wp', array($this, 'wooacd_custom_add_to_cart'));
}
public function add_menu_item()
{
global $wpdb;
$db_cart = $wpdb->prefix . 'wooacd_custom_cart';
$rowcount = $wpdb->get_var("SELECT COUNT(*) FROM $db_cart WHERE `status` = 0 ");
add_submenu_page(
'acl-wooacd',
'Customer Request',
$rowcount ? sprintf('Customer Request %d', $rowcount) : 'Customer Request',
'manage_options',
'wooacd-customer-request',
array($this, 'custom_request_page')
);
}
public function custom_request_page()
{
//echo "hi";
?>
prefix . 'wooacd_custom_cart';
$record_per_page = 10;
$page = isset($_POST['page']) ? wc_clean($_POST['page']) : 1;
$offset = ($page * $record_per_page) - $record_per_page;
$results = $wpdb->get_results("SELECT * FROM $db_cart WHERE `cart_type` = 2 ORDER BY `id` DESC LIMIT $offset, $record_per_page");
?>