diff --git a/assets/css/admin-style.scss b/assets/css/admin-style.scss
index 9f1f9cd0..67412ae4 100644
--- a/assets/css/admin-style.scss
+++ b/assets/css/admin-style.scss
@@ -209,3 +209,21 @@
}
}
}
+
+// Product page.
+#wc_serial_numbers_data{
+ padding-bottom: 20px !important;
+ .wc-radios {
+ display: inline-block;
+
+ li {
+ display: inline-block !important;
+ margin-right: 15px !important;
+ }
+
+ + .description {
+ display: block;
+ clear: both;
+ }
+ }
+}
diff --git a/languages/wc-serial-numbers.pot b/languages/wc-serial-numbers.pot
index 0f236e75..cf462ac7 100644
--- a/languages/wc-serial-numbers.pot
+++ b/languages/wc-serial-numbers.pot
@@ -2,9 +2,9 @@
# This file is distributed under the GPLv2+.
msgid ""
msgstr ""
-"Project-Id-Version: Serial Numbers for WooCommerce 1.5.3\n"
+"Project-Id-Version: Serial Numbers for WooCommerce 1.5.4\n"
"Report-Msgid-Bugs-To: https://pluginever.com/plugins/wc-serial-numbers/\n"
-"POT-Creation-Date: 2023-06-14 07:17:43+00:00\n"
+"POT-Creation-Date: 2023-07-21 10:16:27+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -24,19 +24,20 @@ msgstr ""
"X-Textdomain-Support: yes\n"
"X-Generator: grunt-wp-i18n 1.0.3\n"
-#: lib/Lib/Model.php:810
-msgid "Could not insert item into the database."
+#: lib/Lib/Model.php:434
+#. translators: %s: database error message.
+msgid "Could not insert item into the database error %s"
msgstr ""
-#: lib/Lib/Model.php:923
+#: lib/Lib/Model.php:499
msgid "Could not update item in the database."
msgstr ""
-#: lib/Lib/Plugin.php:239 src/Admin/Menus.php:200
-msgid "Upgrade to Pro"
+#: lib/Lib/Plugin.php:239
+msgid "Go Pro"
msgstr ""
-#: lib/Lib/Plugin.php:585 src/Admin/Settings.php:188
+#: lib/Lib/Plugin.php:585 src/Admin/Settings.php:190
msgid "Documentation"
msgstr ""
@@ -60,29 +61,29 @@ msgstr ""
msgid "Settings saved."
msgstr ""
-#: lib/Lib/Settings.php:228 lib/Lib/Settings.php:316 lib/Lib/Settings.php:325
-#: lib/Lib/Settings.php:334
+#: lib/Lib/Settings.php:233 lib/Lib/Settings.php:325 lib/Lib/Settings.php:334
+#: lib/Lib/Settings.php:343
msgid "Recommended"
msgstr ""
-#: lib/Lib/Settings.php:229 lib/Lib/Settings.php:317 lib/Lib/Settings.php:326
-#: lib/Lib/Settings.php:335
+#: lib/Lib/Settings.php:234 lib/Lib/Settings.php:326 lib/Lib/Settings.php:335
+#: lib/Lib/Settings.php:344
msgid "Install Now"
msgstr ""
-#: lib/Lib/Settings.php:287
+#: lib/Lib/Settings.php:296
msgid "Need Help?"
msgstr ""
-#: lib/Lib/Settings.php:349
+#: lib/Lib/Settings.php:358
msgid "Join our Community"
msgstr ""
-#: lib/Lib/Settings.php:353
+#: lib/Lib/Settings.php:362
msgid "Request a Feature"
msgstr ""
-#: lib/Lib/Settings.php:357
+#: lib/Lib/Settings.php:366
msgid "Report a Bug"
msgstr ""
@@ -205,7 +206,7 @@ msgstr ""
msgid "Invalid product ID."
msgstr ""
-#: src/API.php:81 src/Models/Key.php:479
+#: src/API.php:81 src/Models/Key.php:496
msgid "Serial key is required."
msgstr ""
@@ -288,8 +289,8 @@ msgstr ""
#: src/Admin/Admin.php:68
#. translators: 1: Plugin name 2: WordPress
msgid ""
-"Thank you for using %1$s. If you like it, please leave us a %2$s rating. A "
-"huge thank you from PluginEver in advance!"
+"Thank you for using %1$s! Share your appreciation with a five-star review "
+"%2$s."
msgstr ""
#: src/Admin/Admin.php:70
@@ -309,7 +310,7 @@ msgid "Serial Numbers"
msgstr ""
#: src/Admin/ListTables/ActivationsTable.php:39
-#: src/Admin/ListTables/KeysTable.php:321
+#: src/Admin/ListTables/KeysTable.php:288
msgid "Activation"
msgstr ""
@@ -323,15 +324,15 @@ msgid "No activations found. Once a serial key is activated, it will appear here
msgstr ""
#: src/Admin/ListTables/ActivationsTable.php:125
-#: src/Admin/ListTables/KeysTable.php:244
+#: src/Admin/ListTables/KeysTable.php:211
#: src/Admin/ListTables/StockTable.php:92
msgid "Filter"
msgstr ""
#: src/Admin/ListTables/ActivationsTable.php:177
#: src/Admin/ListTables/ActivationsTable.php:252
-#: src/Admin/ListTables/KeysTable.php:301
-#: src/Admin/ListTables/KeysTable.php:392
+#: src/Admin/ListTables/KeysTable.php:268
+#: src/Admin/ListTables/KeysTable.php:359
msgid "Delete"
msgstr ""
@@ -341,7 +342,7 @@ msgid "Instance"
msgstr ""
#: src/Admin/ListTables/ActivationsTable.php:190
-#: src/Admin/ListTables/KeysTable.php:315
+#: src/Admin/ListTables/KeysTable.php:282
#: src/Admin/ListTables/StockTable.php:105
#: src/Admin/Views/html-api-actions.php:118
#: src/Admin/Views/html-api-validation.php:121
@@ -351,7 +352,7 @@ msgid "Product"
msgstr ""
#: src/Admin/ListTables/ActivationsTable.php:191
-#: src/Admin/ListTables/KeysTable.php:314
+#: src/Admin/ListTables/KeysTable.php:281
#: src/Admin/Views/html-api-actions.php:131
#: src/Admin/Views/html-api-validation.php:134 src/Functions/Template.php:42
msgid "Key"
@@ -382,124 +383,93 @@ msgstr ""
msgid "Add new key"
msgstr ""
-#: src/Admin/ListTables/KeysTable.php:174
-msgid "Keys can have one of the following statuses:"
+#: src/Admin/ListTables/KeysTable.php:189
+msgid "All keys."
+msgstr ""
+
+#: src/Admin/ListTables/KeysTable.php:189
+msgid "All"
msgstr ""
-#: src/Admin/ListTables/KeysTable.php:178
-#: src/Admin/ListTables/KeysTable.php:223 src/functions.php:46
+#: src/Admin/ListTables/KeysTable.php:190
+msgid "Available for sell."
+msgstr ""
+
+#: src/Admin/ListTables/KeysTable.php:190 src/functions.php:46
msgid "Available"
msgstr ""
-#: src/Admin/ListTables/KeysTable.php:180
-msgid "This means the key is available for purchase."
+#: src/Admin/ListTables/KeysTable.php:191
+msgid "Pending payment."
msgstr ""
-#: src/Admin/ListTables/KeysTable.php:183
-#: src/Admin/ListTables/KeysTable.php:224 src/functions.php:47
+#: src/Admin/ListTables/KeysTable.php:191 src/functions.php:47
msgid "Pending"
msgstr ""
-#: src/Admin/ListTables/KeysTable.php:185
-msgid "This means the key has been sold, but the order has not been completed yet."
+#: src/Admin/ListTables/KeysTable.php:192
+msgid "Sold keys."
msgstr ""
-#: src/Admin/ListTables/KeysTable.php:188
-#: src/Admin/ListTables/KeysTable.php:225
+#: src/Admin/ListTables/KeysTable.php:192
#: src/Admin/ListTables/StockTable.php:107 src/functions.php:48
msgid "Sold"
msgstr ""
-#: src/Admin/ListTables/KeysTable.php:190
-msgid "This means the key has been sold, and the order has been completed."
+#: src/Admin/ListTables/KeysTable.php:193
+msgid "Expired keys."
msgstr ""
-#: src/Admin/ListTables/KeysTable.php:193
-#: src/Admin/ListTables/KeysTable.php:226 src/Functions/Template.php:72
+#: src/Admin/ListTables/KeysTable.php:193 src/Functions/Template.php:72
#: src/functions.php:49
msgid "Expired"
msgstr ""
-#: src/Admin/ListTables/KeysTable.php:195
-msgid "This means the key has expired and is no longer valid."
+#: src/Admin/ListTables/KeysTable.php:194
+msgid "Cancelled keys."
msgstr ""
-#: src/Admin/ListTables/KeysTable.php:198
-#: src/Admin/ListTables/KeysTable.php:227 src/functions.php:50
+#: src/Admin/ListTables/KeysTable.php:194 src/functions.php:50
msgid "Cancelled"
msgstr ""
-#: src/Admin/ListTables/KeysTable.php:200
-msgid ""
-"This means the key has been cancelled and is no longer available for "
-"purchase or use."
-msgstr ""
-
-#: src/Admin/ListTables/KeysTable.php:222
-msgid "All keys."
-msgstr ""
-
-#: src/Admin/ListTables/KeysTable.php:222
-msgid "All"
-msgstr ""
-
-#: src/Admin/ListTables/KeysTable.php:223
-msgid "Available for sell."
-msgstr ""
-
-#: src/Admin/ListTables/KeysTable.php:224
-msgid "Pending payment."
-msgstr ""
-
-#: src/Admin/ListTables/KeysTable.php:225
-msgid "Sold keys."
-msgstr ""
-
-#: src/Admin/ListTables/KeysTable.php:226
-msgid "Expired keys."
-msgstr ""
-
-#: src/Admin/ListTables/KeysTable.php:227
-msgid "Cancelled keys."
-msgstr ""
-
-#: src/Admin/ListTables/KeysTable.php:302
+#: src/Admin/ListTables/KeysTable.php:269
msgid "Reset Activations"
msgstr ""
-#: src/Admin/ListTables/KeysTable.php:316
+#: src/Admin/ListTables/KeysTable.php:283
msgid "Order"
msgstr ""
-#: src/Admin/ListTables/KeysTable.php:317
+#: src/Admin/ListTables/KeysTable.php:284
msgid "Validity"
msgstr ""
-#: src/Admin/ListTables/KeysTable.php:324
+#: src/Admin/ListTables/KeysTable.php:291
msgid "Order Date"
msgstr ""
-#: src/Admin/ListTables/KeysTable.php:325 src/Admin/Menus.php:322
-#: src/Admin/Views/html-edit-key.php:113 src/Functions/Template.php:78
+#: src/Admin/ListTables/KeysTable.php:292 src/Admin/Menus.php:322
+#: src/Admin/Views/html-edit-key.php:114 src/Functions/Template.php:78
msgid "Status"
msgstr ""
-#: src/Admin/ListTables/KeysTable.php:390
+#: src/Admin/ListTables/KeysTable.php:357
msgid "ID: %d"
msgstr ""
-#: src/Admin/ListTables/KeysTable.php:391
+#: src/Admin/ListTables/KeysTable.php:358
#: src/Admin/ListTables/StockTable.php:153 src/Admin/Metaboxes.php:361
msgid "Edit"
msgstr ""
-#: src/Admin/ListTables/KeysTable.php:482
+#: src/Admin/ListTables/KeysTable.php:449
msgid "%s Day
After purchase"
msgid_plural "%s Days
After purchase"
msgstr[0] ""
msgstr[1] ""
-#: src/Admin/ListTables/KeysTable.php:482 src/Admin/Metaboxes.php:348
+#: src/Admin/ListTables/KeysTable.php:449 src/Admin/Metaboxes.php:348
#: src/Functions/Template.php:63
msgid "Lifetime"
msgstr ""
@@ -565,6 +535,11 @@ msgstr ""
msgid "Reports"
msgstr ""
+#: src/Admin/Menus.php:200 src/Admin/Metaboxes.php:137
+#: src/Admin/Metaboxes.php:156
+msgid "Upgrade to Pro"
+msgstr ""
+
#: src/Admin/Menus.php:247 src/Admin/Views/html-list-keys.php:25
msgid "Import"
msgstr ""
@@ -667,16 +642,14 @@ msgstr[1] ""
#: src/Admin/Metaboxes.php:137
msgid ""
-"Want serial numbers to be generated automatically and auto assign with "
-"order and many more?"
-msgstr ""
-
-#: src/Admin/Metaboxes.php:137 src/Admin/Metaboxes.php:156
-msgid "Upgrade to Pro"
+"Want serial keys to be generated automatically and auto assign with order "
+"and many more?"
msgstr ""
#: src/Admin/Metaboxes.php:156
-msgid "The free version of Serial Numbers for WooCommerce does not support product variation."
+msgid ""
+"The free version of Serial Numbers for WooCommerce does not support product "
+"variation."
msgstr ""
#: src/Admin/Metaboxes.php:226
@@ -709,8 +682,9 @@ msgstr ""
#: src/Admin/Notices.php:65
#. translators: %1$s: link to the plugin page, %2$s: link to the plugin page
msgid ""
-"Upgrade to %6$s to unlock the full potential of %5$s and avail a %1$s "
-"discount by using the promo code %2$s %3$s Upgrade Now %4$s."
+"New! Send Serial Keys via SMS with Twilio. Upgrade to %6$s to unlock the "
+"full potential of %5$s and avail a %1$s discount by using the promo code "
+"%2$s %3$s Upgrade Now %4$s."
msgstr ""
#: src/Admin/Orders.php:43 src/Admin/Orders.php:122
@@ -751,11 +725,11 @@ msgid "General Settings"
msgstr ""
#: src/Admin/Settings.php:48
-msgid "The following options affect how the serial keys will work."
+msgid "These options determine the behavior and operation of the serial keys."
msgstr ""
#: src/Admin/Settings.php:52
-msgid "Auto-complete order"
+msgid "Auto-complete orders"
msgstr ""
#: src/Admin/Settings.php:54
@@ -806,101 +780,111 @@ msgstr ""
msgid "Disable Software Licensing support & API functionalities."
msgstr ""
-#: src/Admin/Settings.php:94
+#: src/Admin/Settings.php:86
+msgid ""
+"If you enable this option, the activation menu and it’s functionality will "
+"be turned off."
+msgstr ""
+
+#: src/Admin/Settings.php:95
msgid "Stock Notification"
msgstr ""
-#: src/Admin/Settings.php:96
-msgid "The following options affect how the stock notification will work."
+#: src/Admin/Settings.php:97
+msgid "These options determine the operation of the serial key stock notification."
msgstr ""
-#: src/Admin/Settings.php:100
+#: src/Admin/Settings.php:101
msgid "Stock notification email"
msgstr ""
-#: src/Admin/Settings.php:102
+#: src/Admin/Settings.php:103
msgid "Sends notification emails when product stock is low."
msgstr ""
-#: src/Admin/Settings.php:108
+#: src/Admin/Settings.php:109
msgid "Stock threshold"
msgstr ""
-#: src/Admin/Settings.php:110
+#: src/Admin/Settings.php:111
msgid ""
-"When the stock goes below the above number, it will send a notification "
-"email."
+"An email notification will be sent when the stock falls below the specified "
+"number."
msgstr ""
-#: src/Admin/Settings.php:115
+#: src/Admin/Settings.php:116
msgid "Notification recipient email"
msgstr ""
-#: src/Admin/Settings.php:117
-msgid "The email address to be used for sending the email notifications."
+#: src/Admin/Settings.php:118
+msgid "The email address which will be used to send email notifications."
msgstr ""
-#: src/Admin/Settings.php:151
+#: src/Admin/Settings.php:152
msgid "Create and assign license keys for WooCommerce variable products."
msgstr ""
-#: src/Admin/Settings.php:152
+#: src/Admin/Settings.php:153
msgid "Generate bulk license keys with your custom key generator rule."
msgstr ""
-#: src/Admin/Settings.php:153
-msgid "Random & sequential order for the generator rules."
+#: src/Admin/Settings.php:154
+msgid "Random & sequential key order for the generator rules."
msgstr ""
-#: src/Admin/Settings.php:154
+#: src/Admin/Settings.php:155
msgid "Automatic license key generator to auto-create & assign keys with orders."
msgstr ""
-#: src/Admin/Settings.php:155
+#: src/Admin/Settings.php:156
msgid "License key management option from the order page with required actions."
msgstr ""
-#: src/Admin/Settings.php:156
+#: src/Admin/Settings.php:157
msgid "Support for bulk import/export of license keys from/to CSV."
msgstr ""
-#: src/Admin/Settings.php:157
+#: src/Admin/Settings.php:158
+msgid "Send Serial Keys via SMS with Twilio."
+msgstr ""
+
+#: src/Admin/Settings.php:159
msgid ""
"Option to sell license keys even if there are no available keys in the "
"stock."
msgstr ""
-#: src/Admin/Settings.php:158
+#: src/Admin/Settings.php:160
msgid "Custom deliverable quantity to deliver multiple keys with a single product."
msgstr ""
-#: src/Admin/Settings.php:159
+#: src/Admin/Settings.php:161
msgid ""
"Manual delivery option to manually deliver license keys instead of "
"automatic."
msgstr ""
-#: src/Admin/Settings.php:160
+#: src/Admin/Settings.php:162
msgid ""
"Email Template to easily and quickly customize the order confirmation & low "
"stock alert email."
msgstr ""
-#: src/Admin/Settings.php:161
+#: src/Admin/Settings.php:163
msgid "Many more ..."
msgstr ""
-#: src/Admin/Settings.php:165
+#: src/Admin/Settings.php:167
msgid "Want More?"
msgstr ""
-#: src/Admin/Settings.php:166
+#: src/Admin/Settings.php:168
msgid ""
"This plugin offers a premium version which comes with the following "
"features:"
msgstr ""
-#: src/Admin/Settings.php:172
+#: src/Admin/Settings.php:174
msgid "Upgrade to PRO"
msgstr ""
@@ -910,8 +894,8 @@ msgstr ""
#: src/Admin/Views/html-api-actions.php:26
msgid ""
-"You can use the API to perform actions on serial key. You can use the API "
-"to perform actions on your website or on another website."
+"You can use the API to perform actions on your website or on another "
+"website."
msgstr ""
#: src/Admin/Views/html-api-actions.php:29
@@ -955,8 +939,8 @@ msgstr ""
#: src/Admin/Views/html-api-actions.php:52
#: src/Admin/Views/html-api-validation.php:59
msgid ""
-"Optional. If email is provided, the API will check if the serial key is "
-"assigned to the provided email address."
+"Using email is completely voluntary. The API will verify that the serial "
+"number is associated with the given email address."
msgstr ""
#: src/Admin/Views/html-api-actions.php:57
@@ -1094,7 +1078,7 @@ msgstr ""
#: src/Admin/Views/html-api-actions.php:185
#: src/Admin/Views/html-api-validation.php:153
-msgid "API Response"
+msgid "API response"
msgstr ""
#: src/Admin/Views/html-api-actions.php:195 src/Shortcodes.php:146
@@ -1107,6 +1091,7 @@ msgid "API Validation"
msgstr ""
#: src/Admin/Views/html-api-validation.php:30
+#: src/Admin/Views/html-edit-key.php:33
#. translators: %s: link to the pro version
msgid ""
"You are using the free version of Serial Numbers for WooCommerce. Upgrade to Pro to get more features."
-msgstr ""
-
#: src/Admin/Views/html-edit-key.php:50
msgid "Select Product"
msgstr ""
#: src/Admin/Views/html-edit-key.php:60
-msgid "Select the product for which this key is valid."
+msgid "Select the product for which this key is applicable."
msgstr ""
-#: src/Admin/Views/html-edit-key.php:67 src/Shortcodes.php:41
-#: src/Shortcodes.php:137
-msgid "Serial Key"
+#: src/Admin/Views/html-edit-key.php:67
+msgid "Serial key"
msgstr ""
#: src/Admin/Views/html-edit-key.php:74
msgid ""
-"Enter secret number, supports multiline. E.g., "
+"Enter your serial key, also supports multiline. For example: "
"4CE0460D0G-4CE0460D1G-4CE0460D2G"
msgstr ""
@@ -1213,37 +1190,37 @@ msgid ""
"the product is not software, keep it blank."
msgstr ""
-#: src/Admin/Views/html-edit-key.php:97
+#: src/Admin/Views/html-edit-key.php:98
msgid "Valid for (days)"
msgstr ""
-#: src/Admin/Views/html-edit-key.php:103
+#: src/Admin/Views/html-edit-key.php:104
msgid ""
-"Number of days the key will be valid from the purchase date. Leave blank "
+"Number of days the key will be valid from the purchase date. Leave it blank "
"for lifetime validity."
msgstr ""
-#: src/Admin/Views/html-edit-key.php:122
+#: src/Admin/Views/html-edit-key.php:123
msgid "Status of the serial key."
msgstr ""
-#: src/Admin/Views/html-edit-key.php:129
+#: src/Admin/Views/html-edit-key.php:130
msgid "Order ID"
msgstr ""
-#: src/Admin/Views/html-edit-key.php:133
+#: src/Admin/Views/html-edit-key.php:134
msgid "Select Order"
msgstr ""
-#: src/Admin/Views/html-edit-key.php:141
+#: src/Admin/Views/html-edit-key.php:142
msgid "The order to which the serial number will be assigned."
msgstr ""
-#: src/Admin/Views/html-edit-key.php:152
+#: src/Admin/Views/html-edit-key.php:153
msgid "Update"
msgstr ""
-#: src/Admin/Views/html-edit-key.php:152
+#: src/Admin/Views/html-edit-key.php:153
msgid "Create"
msgstr ""
@@ -1318,27 +1295,27 @@ msgstr ""
msgid "%1$s updated to version %2$s successfully."
msgstr ""
-#: src/Models/Activation.php:228
+#: src/Models/Activation.php:244
msgid "Serial id is required."
msgstr ""
-#: src/Models/Activation.php:233
+#: src/Models/Activation.php:249
msgid "Instance is required."
msgstr ""
-#: src/Models/Key.php:469
+#: src/Models/Key.php:486
msgid "Product id is required."
msgstr ""
-#: src/Models/Key.php:474
+#: src/Models/Key.php:491
msgid "Product id is invalid."
msgstr ""
-#: src/Models/Key.php:491
+#: src/Models/Key.php:508
msgid "Serial key already exists. Duplicate serial keys are not allowed."
msgstr ""
-#: src/Models/Key.php:497
+#: src/Models/Key.php:514
msgid "Order id is invalid."
msgstr ""
@@ -1393,6 +1370,10 @@ msgstr ""
msgid "Serial Key Validation"
msgstr ""
+#: src/Shortcodes.php:41 src/Shortcodes.php:137
+msgid "Serial Key"
+msgstr ""
+
#: src/Shortcodes.php:42 src/Shortcodes.php:138
msgid "Enter your serial key"
msgstr ""
@@ -1427,7 +1408,7 @@ msgid "Could not find any products with serial numbers enabled."
msgstr ""
#: src/functions.php:91
-msgid "Manually Added"
+msgid "Manually added"
msgstr ""
#: src/functions.php:511
@@ -1685,8 +1666,8 @@ msgstr ""
#. Description of the plugin/theme
msgid ""
-"The best WooCommerce extension to sell license & serial keys, gift cards "
-"and other secret numbers!"
+"Sell and manage license keys/ serial numbers/ secrect keys easily within "
+"your WooCommerce store."
msgstr ""
#. Author of the plugin/theme
diff --git a/package-lock.json b/package-lock.json
index 591900f9..bd033de7 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "wc-serial-numbers",
- "version": "1.5.3",
+ "version": "1.5.4",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "wc-serial-numbers",
- "version": "1.5.3",
+ "version": "1.5.4",
"license": "GPL-3.0+",
"devDependencies": {
"@lodder/time-grunt": "^4.0.0",
diff --git a/src/Admin/ListTables/GeneratorsTable.php b/src/Admin/ListTables/GeneratorsTable.php
new file mode 100644
index 00000000..98a02ef7
--- /dev/null
+++ b/src/Admin/ListTables/GeneratorsTable.php
@@ -0,0 +1,265 @@
+ __( 'generator', 'wc-serial-numbers-pro' ),
+ 'plural' => __( 'generators', 'wc-serial-numbers-pro' ),
+ 'ajax' => false,
+ )
+ );
+ }
+
+ /**
+ * Prepare table data.
+ *
+ * @since 1.4.6
+ */
+ public function prepare_items() {
+ $per_page = $this->get_items_per_page( 'wcsn_stocks_per_page' );
+ $columns = $this->get_columns();
+ $hidden = [];
+ $sortable = $this->get_sortable_columns();
+ $this->_column_headers = array( $columns, $hidden, $sortable );
+ $current_page = $this->get_pagenum();
+ $orderby = isset( $_GET['orderby'] ) ? sanitize_key( $_GET['orderby'] ) : 'order_date';
+ $order = isset( $_GET['order'] ) ? sanitize_key( $_GET['order'] ) : 'desc';
+ $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null;
+ $product_id = isset( $_GET['product_id'] ) ? absint( $_GET['product_id'] ) : '';
+
+ $args = array(
+ 'per_page' => $per_page,
+ 'paged' => $current_page,
+ 'orderby' => $orderby,
+ 'order' => $order,
+ 'product_id' => $product_id,
+ 'search' => $search,
+ );
+
+ $query = new \WP_Query( $args );
+ $this->items = wcsn_get_generators( $args );
+ $this->total_count = wcsn_get_generators( array_merge( $args, array( 'count' => true ) ) );
+
+ $this->set_pagination_args(
+ array(
+ 'total_items' => $query->found_posts,
+ 'per_page' => $per_page,
+ 'total_pages' => $query->found_posts > 0 ? ceil( $query->found_posts / $per_page ) : 0,
+ )
+ );
+ }
+
+ /**
+ * No items found text.
+ */
+ public function no_items() {
+ esc_html_e( 'No generators found.', 'wc-serial-numbers-pro' );
+ }
+
+ /**
+ * Process bulk action.
+ *
+ * @param string $doaction Action name.
+ *
+ * @since 1.4.6
+ */
+ public function process_bulk_actions( $doaction ) {
+ if ( $doaction ) {
+ if ( isset( $_REQUEST['id'] ) ) {
+ $ids = wp_parse_id_list( $_REQUEST['id'] );
+ $doaction = ( - 1 !== $_REQUEST['action'] ) ? $_REQUEST['action'] : $_REQUEST['action2']; // phpcs:ignore
+ } elseif ( isset( $_REQUEST['ids'] ) ) {
+ $ids = array_map( 'absint', $_REQUEST['ids'] );
+ } elseif ( wp_get_referer() ) {
+ wp_safe_redirect( wp_get_referer() );
+ exit;
+ }
+
+ foreach ( $ids as $id ) { // Check the permissions on each.
+ $key = Generator::get( $id );
+ if ( ! $key ) {
+ continue;
+ }
+ switch ( $doaction ) {
+ case 'delete':
+ $key->delete();
+ break;
+ }
+ }
+
+ wp_safe_redirect( wp_get_referer() );
+ exit;
+ }
+
+ parent::process_bulk_actions( $doaction );
+ }
+
+ /**
+ * Get bulk actions
+ *
+ * since 1.0.0
+ *
+ * @return array
+ */
+ public function get_bulk_actions() {
+ return array(
+ 'delete' => __( 'Delete', 'wc-serial-numbers-pro' ),
+ );
+ }
+
+ /**
+ * since 1.0.0
+ *
+ * @return array
+ */
+ public function get_columns() {
+ $columns = array(
+ 'cb' => '',
+ 'pattern' => __( 'Pattern', 'wc-serial-numbers-pro' ),
+ 'product' => __( 'Product', 'wc-serial-numbers-pro' ),
+ 'type' => __( 'Type', 'wc-serial-numbers-pro' ),
+ 'activation_limit' => __( 'Activation Limit', 'wc-serial-numbers-pro' ),
+ 'validity' => __( 'Validity', 'wc-serial-numbers-pro' ),
+ 'generate' => __( 'Generate', 'wc-serial-numbers-pro' ),
+ );
+
+ return apply_filters( 'wc_serial_numbers_stock_table_columns', $columns );
+ }
+
+ /**
+ * since 1.0.0
+ *
+ * @return array
+ */
+ function get_sortable_columns() {
+ return array(
+ 'product' => array( 'product_id', false ),
+ );
+ }
+
+ /**
+ * Gets the name of the primary column.
+ *
+ * @since 1.0.0
+ * @access protected
+ * @return string Name of the primary column.
+ */
+ protected function get_primary_column_name() {
+ return 'column_pattern';
+ }
+
+ /**
+ * Render the bulk edit checkbox
+ *
+ * @param Generator $item The item being acted upon.
+ *
+ * @return string
+ */
+ protected function column_cb( $item ) {
+ return "";
+ }
+
+ /**
+ * column pattern
+ *
+ * @param $item
+ *
+ * @return string
+ * @since 1.0.0
+ */
+ function column_pattern( $item ) {
+ $row_actions = array();
+ $base_url = admin_url( 'admin.php?page=wc-serial-numbers-tools&tab=generators' );
+ $edit_url = add_query_arg( [ 'edit' => $item->get_id() ], $base_url );
+ $delete_url = add_query_arg(
+ [
+ 'action' => 'delete',
+ 'id' => $item->get_id(),
+ ],
+ $base_url
+ );
+ $row_actions['edit'] = sprintf( '%2$s', $edit_url, __( 'Edit', 'wc-serial-numbers-pro' ) );
+ $row_actions['delete'] = sprintf( '%2$s', $delete_url, __( 'Delete', 'wc-serial-numbers-pro' ) );
+ $pattern = get_post_meta( $item->ID, 'pattern', true );
+
+ return sprintf( '%1$s %2$s', $pattern, $this->row_actions( $row_actions ) );
+ }
+
+ /**
+ * column generate
+ *
+ * @param $item
+ *
+ * @since 1.0.0
+ */
+ public function column_generate( $item ) {
+ ?>
+
+ 'generate-serials',
+ 'data-id' => $item->get_id(),
+ 'data-nonce' => wp_create_nonce( 'generate_serials' ),
+ )
+ );
+ ?>
+
+
%s %s
', __( 'The free version of Serial Numbers for WooCommerce does not support product variation.', 'wc-serial-numbers' ), 'https://www.pluginever.com/plugins/woocommerce-serial-numbers-pro/?utm_source=product_page_license_area&utm_medium=link&utm_campaign=wc-serial-numbers&utm_content=Upgrade%20to%20Pro', __( 'Upgrade to Pro', 'wc-serial-numbers' ) ); - } - - } - - /** - * since 1.0.0 - */ - public static function product_save_data() { - global $post; - $status = isset( $_POST['_is_serial_number'] ) ? 'yes' : 'no'; - $source = isset( $_POST['_serial_key_source'] ) ? sanitize_text_field( $_POST['_serial_key_source'] ) : 'custom_source'; - update_post_meta( $post->ID, '_is_serial_number', $status ); - update_post_meta( $post->ID, '_serial_key_source', $source ); - // save only if software licensing enabled - if ( ! wc_serial_numbers_software_support_disabled() ) { - update_post_meta( $post->ID, '_software_version', ! empty( $_POST['_software_version'] ) ? sanitize_text_field( $_POST['_software_version'] ) : '' ); - } - - do_action( 'wcsn_save_simple_product_meta', $post ); - } /** diff --git a/src/Admin/Products.php b/src/Admin/Products.php index ab1740c2..6986e55a 100644 --- a/src/Admin/Products.php +++ b/src/Admin/Products.php @@ -18,9 +18,162 @@ class Products extends \WooCommerceSerialNumbers\Lib\Singleton { * @since 1.0.0 */ protected function __construct() { + 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 ); add_action( 'admin_head', array( __CLASS__, 'print_style' ) ); } + /** + * Add product data tab. + * + * @param array $tabs product tabs. + * + * since 1.0.0 + */ + public static function product_data_tab( $tabs ) { + $tabs['wc_serial_numbers'] = array( + 'label' => __( 'Serial Numbers', 'wc-serial-numbers' ), + 'target' => 'wc_serial_numbers_data', + 'class' => array( 'show_if_simple' ), + 'priority' => 11, + ); + + return $tabs; + } + + /** + * since 1.0.0 + */ + public static function product_write_panel() { + global $post, $woocommerce; + include 'Views/html-product-options.php'; + } + + /** + * since 1.0.0 + */ + public static function product_write_panel_bk() { + global $post, $woocommerce; + ?> + + is_premium_active() ) { + echo sprintf( '%s %s
', __( 'The free version of Serial Numbers for WooCommerce does not support product variation.', 'wc-serial-numbers' ), 'https://www.pluginever.com/plugins/woocommerce-serial-numbers-pro/?utm_source=product_page_license_area&utm_medium=link&utm_campaign=wc-serial-numbers&utm_content=Upgrade%20to%20Pro', __( 'Upgrade to Pro', 'wc-serial-numbers' ) ); + } + + } + + /** + * since 1.0.0 + */ + public static function product_save_data() { + global $post; + $status = isset( $_POST['_is_serial_number'] ) ? 'yes' : 'no'; + $source = isset( $_POST['_serial_key_source'] ) ? sanitize_text_field( $_POST['_serial_key_source'] ) : 'custom_source'; + update_post_meta( $post->ID, '_is_serial_number', $status ); + update_post_meta( $post->ID, '_serial_key_source', $source ); + // save only if software licensing enabled + if ( ! wc_serial_numbers_software_support_disabled() ) { + update_post_meta( $post->ID, '_software_version', ! empty( $_POST['_software_version'] ) ? sanitize_text_field( $_POST['_software_version'] ) : '' ); + } + + do_action( 'wcsn_save_simple_product_meta', $post ); + } + /** * Print style * diff --git a/src/Admin/Views/edit-generator.php b/src/Admin/Views/edit-generator.php new file mode 100644 index 00000000..5f42032a --- /dev/null +++ b/src/Admin/Views/edit-generator.php @@ -0,0 +1,13 @@ + diff --git a/src/Admin/Views/html-list-generators.php b/src/Admin/Views/html-list-generators.php new file mode 100644 index 00000000..b03a1dc1 --- /dev/null +++ b/src/Admin/Views/html-list-generators.php @@ -0,0 +1,30 @@ +current_action(); +$list_table->process_bulk_actions( $action ); +?> + +