PluginProbe
Tiered Pricing Table for WooCommerce / 2.3.2
Tiered Pricing Table for WooCommerce v2.3.2
7.1.7 7.1.5 7.1.4 7.1.1 6.5.0 6.4.0 6.1.0 trunk 1.0 1.1 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 All 90 releases
tier-pricing-table / assets / admin / settings.js

settings.js in Tiered Pricing Table for WooCommerce 2.3.2, at assets/admin/settings.js

79 lines 3.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 jQuery(document).ready(function ($) {
2 var TieredPricingSettings = function () {
3 this.init = function () {
4 this.prefix = 'tier_pricing_table_';
5 this.$displayType = $('[name=' + this.prefix + 'display_type]');
6 this.$displayAtCatalog = $('[name=' + this.prefix + 'tiered_price_at_catalog]');
7 this.$showDiscountColumn = $('[name=' + this.prefix + 'show_discount_column]');
8
9 this.$displayType.on('change', (function () {
10
11 if (this.$displayType.val() === 'tooltip') {
12 this.hideRow(this.getRow('position_hook'));
13 this.hideRow(this.getRow('table_title'));
14 this.showRow(this.getRow('tooltip_color'));
15 this.showRow(this.getRow('tooltip_size'));
16 this.showRow(this.getRow('tooltip_border'));
17 } else {
18 this.showRow(this.getRow('position_hook'));
19 this.showRow(this.getRow('table_title'));
20 this.hideRow(this.getRow('tooltip_size'));
21 this.hideRow(this.getRow('tooltip_color'));
22 this.hideRow(this.getRow('tooltip_border'));
23 }
24
25 }).bind(this));
26
27 this.getRow('tiered_price_at_catalog_type').on('change', (function (e) {
28 if ($(e.target).val() === 'lowest') {
29 this.showRow(this.getRow('lowest_prefix'));
30 } else {
31 this.hideRow(this.getRow('lowest_prefix'));
32 }
33 }).bind(this));
34
35 this.$displayAtCatalog.on('change', (function () {
36 if (this.$displayAtCatalog.attr('checked')) {
37 this.showRow(this.getRow('tiered_price_at_catalog_type'));
38 this.showRow(this.getRow('tiered_price_at_catalog_for_variable'));
39 this.showRow(this.getRow('tiered_price_at_product_page'));
40 } else {
41 this.hideRow(this.getRow('tiered_price_at_catalog_type'));
42 this.hideRow(this.getRow('tiered_price_at_catalog_for_variable'));
43 this.hideRow(this.getRow('tiered_price_at_product_page'));
44 }
45 }).bind(this));
46
47 this.$showDiscountColumn.on('change', (function () {
48 if (this.$showDiscountColumn.attr('checked')) {
49 this.showRow(this.getRow('head_discount_text'));
50 } else {
51 this.hideRow(this.getRow('head_discount_text'));
52 }
53 }).bind(this));
54
55 this.$displayType.trigger('change');
56 this.$displayAtCatalog.trigger('change');
57 this.$showDiscountColumn.trigger('change');
58 this.getRow('tiered_price_at_catalog_type').trigger('change');
59 };
60
61 this.showRow = function (el) {
62 el.closest('tr').show(100);
63 };
64
65 this.hideRow = function (el) {
66 el.closest('tr').hide(100);
67 };
68
69 this.getRow = function (settingsName) {
70 return $('[name=' + this.prefix + settingsName + ']');
71 }
72 };
73
74 var tieredPricingSettings = new TieredPricingSettings();
75
76 tieredPricingSettings.init();
77 });
78
79