Skip to content

Commit

Permalink
Merge pull request #423 from pluginever/fix/420
Browse files Browse the repository at this point in the history
Milestone 2.0.1
  • Loading branch information
kawsarahmedr authored Aug 14, 2024
2 parents cdbbe42 + 0729d05 commit c2adfda
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 89 deletions.
2 changes: 1 addition & 1 deletion src/Admin/Orders.php → includes/Admin/Orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace WooCommerceSerialNumbers\Admin;

defined( 'ABSPATH' ) || exit;
defined( 'ABSPATH' ) || exit; // Exit if accessed directly.

/**
* Class Orders.
Expand Down
62 changes: 58 additions & 4 deletions src/Admin/Metaboxes.php → includes/Admin/Products.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,82 @@

namespace WooCommerceSerialNumbers\Admin;

defined( 'ABSPATH' ) || exit;
defined( 'ABSPATH' ) || exit; // Exit if accessed directly.

/**
* Class Metaboxes.
* Class Products.
*
* @since 1.0.0
* @package WooCommerceSerialNumbers\Admin
*/
class Metaboxes {
class Products {

/**
* Metaboxes constructor.
* Products constructor.
*
* @since 1.0.0
*/
public function __construct() {
add_action( 'admin_head', array( __CLASS__, 'print_style' ) );
add_filter( 'woocommerce_product_data_tabs', array( __CLASS__, 'product_data_tab' ) );
add_action( 'woocommerce_product_data_panels', array( __CLASS__, 'product_write_panel' ) );
add_filter( 'woocommerce_process_product_meta', array( __CLASS__, 'product_save_data' ) );
add_action( 'woocommerce_product_after_variable_attributes', array( __CLASS__, 'variable_product_content' ), 10, 3 );
}

/**
* Print style
*
* @since 1.0.0
*/
public static function print_style() {
?>
<style>
#woocommerce-product-data ul.wc-tabs li.wc_serial_numbers_options a:before {
font-family: 'dashicons';
content: "\f112";
}

._serial_key_source_field label {
margin: 0 !important;
width: 100% !important;
}

.wc-serial-numbers-upgrade-box {
background: #f1f1f1;
padding: 10px;
border-left: 2px solid #007cba;
}

.wc-serial-numbers-variation-settings .wc-serial-numbers-settings-title {
border-bottom: 1px solid #eee;
padding-left: 0 !important;
font-weight: 600;
font-size: 1em;
padding-bottom: 5px;
}

.wc-serial-numbers-variation-settings label, .wc-serial-numbers-variation-settings legend {
margin-bottom: 5px !important;
display: inline-block;
}

.wc-serial-numbers-variation-settings .wc-radios li {
padding-bottom: 0 !important;

}

.wc-serial-numbers-variation-settings .woocommerce-help-tip {
margin-top: -5px;
}

.wc-serial-numbers-variation-settings .short {
min-width: 200px;
}
</style>
<?php
}

/**
* Add product data tab.
*
Expand Down
2 changes: 1 addition & 1 deletion includes/Admin/Requests.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use WooCommerceSerialNumbers\Models\Key;

defined( 'ABSPATH' ) || exit;
defined( 'ABSPATH' ) || exit; // Exit if accessed directly.

/**
* Class Requests.
Expand Down
13 changes: 6 additions & 7 deletions src/Admin/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,12 @@ public function __construct() {
* @since 1.0.0
*/
public function init() {
WCSN()->services['admin/settings'] = Settings::instance();
WCSN()->services['admin/menus'] = new Menus();
WCSN()->services['admin/notices'] = new Notices();
WCSN()->services['admin/requests'] = new Requests();
WCSN()->services['admin/metaboxes'] = new Metaboxes();
WCSN()->services['admin/orders'] = new Orders();
WCSN()->services['admin/products'] = new Products();
WCSN()->services['admin/settings'] = Settings::instance();
WCSN()->services['admin/menus'] = new Menus();
WCSN()->services['admin/notices'] = new Notices();
WCSN()->services['admin/requests'] = new Requests();
WCSN()->services['admin/orders'] = new Orders();
WCSN()->services['admin/products'] = new Products();
}

/**
Expand Down
76 changes: 0 additions & 76 deletions src/Admin/Products.php

This file was deleted.

0 comments on commit c2adfda

Please sign in to comment.