Plugin para adicionar o status "Aguardando retirada" aos pedidos do WooCommerce
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

150 lines
4.0 KiB

<?php
/**
* The admin-specific functionality of the plugin.
*
* @link https://horizontes.info
* @since 1.0.0
*
* @package Wc_Retirada_Produtos
* @subpackage Wc_Retirada_Produtos/admin
*/
/**
* The admin-specific functionality of the plugin.
*
* Defines the plugin name, version, and two examples hooks for how to
* enqueue the admin-specific stylesheet and JavaScript.
*
* @package Wc_Retirada_Produtos
* @subpackage Wc_Retirada_Produtos/admin
* @author Horizontes Coop. <contato@horizontes.info>
*/
class Wc_Retirada_Produtos_Admin {
/**
* The ID of this plugin.
*
* @since 1.0.0
* @access private
* @var string $plugin_name The ID of this plugin.
*/
private $plugin_name;
/**
* The version of this plugin.
*
* @since 1.0.0
* @access private
* @var string $version The current version of this plugin.
*/
private $version;
/**
* Initialize the class and set its properties.
*
* @since 1.0.0
* @param string $plugin_name The name of this plugin.
* @param string $version The version of this plugin.
*/
public function __construct( $plugin_name, $version ) {
$this->plugin_name = $plugin_name;
$this->version = $version;
}
/**
* Register the stylesheets for the admin area.
*
* @since 1.0.0
*/
public function enqueue_styles() {
/**
* This function is provided for demonstration purposes only.
*
* An instance of this class should be passed to the run() function
* defined in Wc_Retirada_Produtos_Loader as all of the hooks are defined
* in that particular class.
*
* The Wc_Retirada_Produtos_Loader will then create the relationship
* between the defined hooks and the functions defined in this
* class.
*/
wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wc-retirada-produtos-admin.css', array(), $this->version, 'all' );
}
/**
* Register the JavaScript for the admin area.
*
* @since 1.0.0
*/
public function enqueue_scripts() {
/**
* This function is provided for demonstration purposes only.
*
* An instance of this class should be passed to the run() function
* defined in Wc_Retirada_Produtos_Loader as all of the hooks are defined
* in that particular class.
*
* The Wc_Retirada_Produtos_Loader will then create the relationship
* between the defined hooks and the functions defined in this
* class.
*/
wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wc-retirada-produtos-admin.js', array( 'jquery' ), $this->version, false );
}
/**
* Register the "Waiting Pickup" post status
*
* @since 1.0.0
*/
public function register_waiting_pickup_post_status()
{
register_post_status( 'wc-waiting-pickup', array(
'label' => __('Aguardando Retirada', 'wc-retirada-produtos'),
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => _n_noop( 'Aguardando Retirada <span class="count">(%s)</span>', 'Aguardando Retirada <span class="count">(%s)</span>' )
));
}
public function add_waiting_pickup_to_wc_order_statuses($order_statuses)
{
$order_statuses['wc-waiting-pickup'] = __('Aguardando Retirada', 'wc-retirada-produtos');
return $order_statuses;
}
public function add_waiting_pickup_to_order_bulk_actions($actions)
{
$actions['mark_waiting-pickup'] = __( 'Mudar status para aguardando retirada', 'wc-retirada-produtos' );
return $actions;
}
public function add_waiting_pickup_to_wc_email_actions($actions)
{
$actions[] = 'woocommerce_order_status_wc-waiting-pickup';
return $actions;
}
public function add_waiting_pickup_to_wc_email_classes($emails)
{
require_once WC_RETIRADA_PRODUTOS_PATH . 'includes/emails/class-customer-order-waiting-pickup.php';
$emails['WC_Email_Customer_Order_Waiting_Pickup'] = new WC_Email_Customer_Order_Waiting_Pickup();
return $emails;
}
}