| @@ -1,44 +1,12 @@ | ||
| 1 | 1 | jQuery(document).ready(function ($) { |
| 2 | 2 | var TieredPricingSettings = function () { |
| 3 | 3 | this.init = function () { |
| 4 | 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]'); | |
| 5 | 8 | |
| 6 | - this.$displayType = this.getRow('display_type'); | |
| 7 | - this.$displayAtCatalog = this.getRow('tiered_price_at_catalog'); | |
| 8 | - this.$showDiscountColumn = this.getRow('show_discount_column'); | |
| 9 | - this.$changePriceAtProductPage = this.getRow('tiered_price_at_product_page'); | |
| 10 | - this.$showSummary = this.getRow('display_summary'); | |
| 11 | - this.$summaryType = this.getRow('summary_type'); | |
| 12 | - | |
| 13 | - this.$showSummary.on('change', (function () { | |
| 14 | - | |
| 15 | - this.$summaryType.trigger('change'); | |
| 16 | - | |
| 17 | - if (this.$showSummary.attr('checked')) { | |
| 18 | - this.showRow(this.getRow('summary_type')); | |
| 19 | - this.showRow(this.getRow('summary_title')); | |
| 20 | - this.showRow(this.getRow('summary_position_hook')); | |
| 21 | - } else { | |
| 22 | - this.hideRow(this.getRow('summary_type')); | |
| 23 | - this.hideRow(this.getRow('summary_title')); | |
| 24 | - this.hideRow(this.getRow('summary_position_hook')); | |
| 25 | - } | |
| 26 | - | |
| 27 | - }).bind(this)); | |
| 28 | - | |
| 29 | - this.$summaryType.on('change', (function () { | |
| 30 | - | |
| 31 | - if (this.$summaryType.val() === 'inline' && this.$showSummary.attr('checked')) { | |
| 32 | - this.showRow(this.getRow('summary_total_label')); | |
| 33 | - this.showRow(this.getRow('summary_each_label')); | |
| 34 | - } else { | |
| 35 | - this.hideRow(this.getRow('summary_total_label')); | |
| 36 | - this.hideRow(this.getRow('summary_each_label')); | |
| 37 | - } | |
| 38 | - | |
| 39 | - }).bind(this)); | |
| 40 | - | |
| 41 | 9 | this.$displayType.on('change', (function () { |
| 42 | 10 | |
| 43 | 11 | if (this.$displayType.val() === 'tooltip') { |
| 44 | 12 | this.hideRow(this.getRow('position_hook')); |
| @@ -65,9 +33,8 @@ | ||
| 65 | 33 | }).bind(this)); |
| 66 | 34 | |
| 67 | 35 | this.$displayAtCatalog.on('change', (function () { |
| 68 | 36 | if (this.$displayAtCatalog.attr('checked')) { |
| 69 | - this.showRow(this.getRow('lowest_prefix')); | |
| 70 | 37 | this.showRow(this.getRow('tiered_price_at_catalog_type')); |
| 71 | 38 | this.showRow(this.getRow('tiered_price_at_catalog_for_variable')); |
| 72 | 39 | this.showRow(this.getRow('tiered_price_at_product_page')); |
| 73 | 40 | } else { |
| @@ -73,9 +40,8 @@ | ||
| 73 | 40 | } else { |
| 74 | 41 | this.hideRow(this.getRow('tiered_price_at_catalog_type')); |
| 75 | 42 | this.hideRow(this.getRow('tiered_price_at_catalog_for_variable')); |
| 76 | 43 | this.hideRow(this.getRow('tiered_price_at_product_page')); |
| 77 | - this.hideRow(this.getRow('lowest_prefix')); | |
| 78 | 44 | } |
| 79 | 45 | }).bind(this)); |
| 80 | 46 | |
| 81 | 47 | this.$showDiscountColumn.on('change', (function () { |
| @@ -85,26 +51,11 @@ | ||
| 85 | 51 | this.hideRow(this.getRow('head_discount_text')); |
| 86 | 52 | } |
| 87 | 53 | }).bind(this)); |
| 88 | 54 | |
| 89 | - | |
| 90 | - this.$changePriceAtProductPage.on('change', (function () { | |
| 91 | - if (this.$changePriceAtProductPage.attr('checked')) { | |
| 92 | - this.hideRow(this.getRow('show_total_price')); | |
| 93 | - this.hideRow(this.getRow('clickable_table_rows')); | |
| 94 | - } else { | |
| 95 | - this.showRow(this.getRow('show_total_price')); | |
| 96 | - this.showRow(this.getRow('clickable_table_rows')); | |
| 97 | - } | |
| 98 | - }).bind(this)); | |
| 99 | - | |
| 100 | 55 | this.$displayType.trigger('change'); |
| 101 | 56 | this.$displayAtCatalog.trigger('change'); |
| 102 | 57 | this.$showDiscountColumn.trigger('change'); |
| 103 | - this.$changePriceAtProductPage.trigger('change'); | |
| 104 | - this.$showSummary.trigger('change'); | |
| 105 | - this.$summaryType.trigger('change'); | |
| 106 | - | |
| 107 | 58 | this.getRow('tiered_price_at_catalog_type').trigger('change'); |
| 108 | 59 | }; |
| 109 | 60 | |
| 110 | 61 | this.showRow = function (el) { |
| @@ -122,5 +73,6 @@ | ||
| 122 | 73 | |
| 123 | 74 | var tieredPricingSettings = new TieredPricingSettings(); |
| 124 | 75 | |
| 125 | 76 | tieredPricingSettings.init(); |
| 126 | -}); | |
| 77 | +}); | |
| 78 | + | |