tier-pricing-table
/
src
/
Settings
/
Sections
/
GeneralSection
/
Subsections
/
ProductPageSubsection.php
ProductPageSubsection.php in Tiered Pricing Table for WooCommerce 6.1.0, at src/Settings/Sections/GeneralSection/Subsections/ProductPageSubsection.php
| 1 | <?php namespace TierPricingTable\Settings\Sections\GeneralSection\Subsections; |
| 2 | |
| 3 | use TierPricingTable\Settings\CustomOptions\TPTDisplayType; |
| 4 | use TierPricingTable\Settings\CustomOptions\TPTSwitchOption; |
| 5 | use TierPricingTable\Settings\CustomOptions\TPTTextTemplate; |
| 6 | use TierPricingTable\Settings\Sections\SubsectionAbstract; |
| 7 | use TierPricingTable\Settings\Settings; |
| 8 | |
| 9 | class ProductPageSubsection extends SubsectionAbstract { |
| 10 | |
| 11 | public function getTitle() { |
| 12 | return __( 'Tiered pricing on product page', 'tier-pricing-table' ); |
| 13 | } |
| 14 | |
| 15 | public function getDescription() { |
| 16 | return __( 'This section controls how the tiered pricing will look and behave on the product page.', |
| 17 | 'tier-pricing-table' ); |
| 18 | } |
| 19 | |
| 20 | public function getSlug() { |
| 21 | return 'products'; |
| 22 | } |
| 23 | |
| 24 | public function getSettings() { |
| 25 | return array( |
| 26 | array( |
| 27 | 'title' => __( 'Show tiered pricing', 'tier-pricing-table' ), |
| 28 | 'id' => Settings::SETTINGS_PREFIX . 'display', |
| 29 | 'type' => TPTSwitchOption::FIELD_TYPE, |
| 30 | 'default' => 'yes', |
| 31 | 'desc' => __( 'Display a tiered pricing on the product page? Prices will be changing even if the tiered pricing is not displaying.', |
| 32 | 'tier-pricing-table' ), |
| 33 | 'desc_tip' => true, |
| 34 | ), |
| 35 | array( |
| 36 | 'title' => __( 'Display tiered pricing as', 'tier-pricing-table' ), |
| 37 | 'id' => Settings::SETTINGS_PREFIX . 'display_type', |
| 38 | 'type' => TPTDisplayType::FIELD_TYPE, |
| 39 | 'options' => array( |
| 40 | 'table' => __( 'Table', 'tier-pricing-table' ), |
| 41 | 'blocks' => __( 'Blocks', 'tier-pricing-table' ), |
| 42 | 'options' => __( 'Options', 'tier-pricing-table' ), |
| 43 | 'tooltip' => __( 'Tooltip', 'tier-pricing-table' ), |
| 44 | ), |
| 45 | 'desc' => __( 'Type of displaying tiered pricing on the product page.', 'tier-pricing-table' ), |
| 46 | 'desc_tip' => true, |
| 47 | 'default' => 'table', |
| 48 | ), |
| 49 | array( |
| 50 | 'title' => __( 'Quantity displaying type', 'tier-pricing-table' ), |
| 51 | 'id' => Settings::SETTINGS_PREFIX . 'quantity_type', |
| 52 | 'type' => 'select', |
| 53 | 'options' => array( |
| 54 | 'range' => __( 'Range', 'tier-pricing-table' ), |
| 55 | 'static' => __( 'Static values', 'tier-pricing-table' ), |
| 56 | ), |
| 57 | 'desc' => __( 'How to display quantities in the tiered pricing. Range for a range of quantities that a tiered price will apply for or static for a minimum quantity that a tiered price will apply for.', 'tier-pricing-table' ), |
| 58 | 'desc_tip' => false, |
| 59 | 'default' => 'range', |
| 60 | ), |
| 61 | array( |
| 62 | 'title' => __( 'Tooltip icon color', 'tier-pricing-table' ), |
| 63 | 'id' => Settings::SETTINGS_PREFIX . 'tooltip_color', |
| 64 | 'type' => 'color', |
| 65 | 'default' => '#96598A', |
| 66 | 'css' => 'width:6em;', |
| 67 | 'desc' => __( 'Color of the icon', 'tier-pricing-table' ), |
| 68 | 'desc_tip' => true, |
| 69 | ), |
| 70 | array( |
| 71 | 'title' => __( 'Tooltip icon size (px)', 'tier-pricing-table' ), |
| 72 | 'id' => Settings::SETTINGS_PREFIX . 'tooltip_size', |
| 73 | 'type' => 'number', |
| 74 | 'default' => '15', |
| 75 | 'desc' => __( 'Size of the icon', 'tier-pricing-table' ), |
| 76 | 'desc_tip' => true, |
| 77 | ), |
| 78 | array( |
| 79 | 'title' => __( 'Tooltip border', 'tier-pricing-table' ), |
| 80 | 'id' => Settings::SETTINGS_PREFIX . 'tooltip_border', |
| 81 | 'type' => TPTSwitchOption::FIELD_TYPE, |
| 82 | 'default' => 'yes', |
| 83 | ), |
| 84 | array( |
| 85 | 'title' => __( 'Pricing title', 'tier-pricing-table' ), |
| 86 | 'id' => Settings::SETTINGS_PREFIX . 'table_title', |
| 87 | 'type' => 'text', |
| 88 | 'default' => '', |
| 89 | 'desc' => __( 'The name is displaying above the tiered pricing.', 'tier-pricing-table' ), |
| 90 | 'desc_tip' => true, |
| 91 | ), |
| 92 | array( |
| 93 | 'title' => __( 'Tiered pricing position', 'tier-pricing-table' ), |
| 94 | 'id' => Settings::SETTINGS_PREFIX . 'position_hook', |
| 95 | 'type' => 'select', |
| 96 | 'options' => array( |
| 97 | 'woocommerce_before_add_to_cart_button' => __( 'Above buy button', 'tier-pricing-table' ), |
| 98 | 'woocommerce_after_add_to_cart_button' => __( 'Below buy button', 'tier-pricing-table' ), |
| 99 | 'woocommerce_before_add_to_cart_form' => __( 'Above add to cart form', 'tier-pricing-table' ), |
| 100 | 'woocommerce_after_add_to_cart_form' => __( 'Below add to cart form', 'tier-pricing-table' ), |
| 101 | 'woocommerce_single_product_summary' => __( 'Above product title', 'tier-pricing-table' ), |
| 102 | 'woocommerce_before_single_product_summary' => __( 'Before product summary', 'tier-pricing-table' ), |
| 103 | 'woocommerce_after_single_product_summary' => __( 'After product summary', 'tier-pricing-table' ), |
| 104 | ), |
| 105 | 'desc' => __( 'Where to display the tiered pricing.', 'tier-pricing-table' ), |
| 106 | 'desc_tip' => true, |
| 107 | ), |
| 108 | array( |
| 109 | 'title' => __( 'Active pricing tier color', 'tier-pricing-table' ), |
| 110 | 'id' => Settings::SETTINGS_PREFIX . 'selected_quantity_color', |
| 111 | 'type' => 'color', |
| 112 | 'css' => 'width:6em;', |
| 113 | 'default' => '#96598A', |
| 114 | ), |
| 115 | array( |
| 116 | 'title' => __( 'Quantity column title', 'tier-pricing-table' ), |
| 117 | 'id' => Settings::SETTINGS_PREFIX . 'head_quantity_text', |
| 118 | 'type' => 'text', |
| 119 | 'default' => __( 'Quantity', 'tier-pricing-table' ), |
| 120 | 'desc' => __( 'Name of the quantity column. Set price column and quantity column name blank to do not show table heading.', |
| 121 | 'tier-pricing-table' ), |
| 122 | 'desc_tip' => true, |
| 123 | ), |
| 124 | array( |
| 125 | 'title' => __( 'Price column title', 'tier-pricing-table' ), |
| 126 | 'id' => Settings::SETTINGS_PREFIX . 'head_price_text', |
| 127 | 'type' => 'text', |
| 128 | 'default' => __( 'Price', 'tier-pricing-table' ), |
| 129 | 'desc' => __( 'Name of the price column. Let price column and quantity column names blank to do not show table heading.', |
| 130 | 'tier-pricing-table' ), |
| 131 | 'desc_tip' => true, |
| 132 | ), |
| 133 | array( |
| 134 | 'title' => __( 'Show percentage discount', 'tier-pricing-table' ), |
| 135 | 'id' => Settings::SETTINGS_PREFIX . 'show_discount_column', |
| 136 | 'type' => TPTSwitchOption::FIELD_TYPE, |
| 137 | 'desc' => __( 'Show a percentage discount as column for table or for pricing blocks', 'tier-pricing-table' ), |
| 138 | 'default' => 'yes', |
| 139 | |
| 140 | ), |
| 141 | array( |
| 142 | 'title' => __( 'Discount column title', 'tier-pricing-table' ), |
| 143 | 'id' => Settings::SETTINGS_PREFIX . 'head_discount_text', |
| 144 | 'type' => 'text', |
| 145 | 'default' => __( 'Discount (%)', 'tier-pricing-table' ), |
| 146 | 'desc' => __( 'Name of discount column.', 'tier-pricing-table' ), |
| 147 | 'desc_tip' => true, |
| 148 | ), |
| 149 | |
| 150 | array( |
| 151 | 'title' => __( 'Show original product price', 'tier-pricing-table' ), |
| 152 | 'id' => Settings::SETTINGS_PREFIX . 'options_show_original_product_price', |
| 153 | 'type' => TPTSwitchOption::FIELD_TYPE, |
| 154 | 'default' => 'yes', |
| 155 | 'desc' => __( 'Show price with no discount in the option.', 'tier-pricing-table' ), |
| 156 | ), |
| 157 | |
| 158 | array( |
| 159 | 'title' => __( 'Show total in each option', 'tier-pricing-table' ), |
| 160 | 'id' => Settings::SETTINGS_PREFIX . 'options_show_total', |
| 161 | 'type' => TPTSwitchOption::FIELD_TYPE, |
| 162 | 'default' => 'yes', |
| 163 | 'desc' => __( 'Show total for each option when an option is active.', 'tier-pricing-table' ), |
| 164 | 'custom_attributes' => [ 'data-tiered-pricing-premium-option' => true ] |
| 165 | ), |
| 166 | |
| 167 | array( |
| 168 | 'title' => __( 'Option text', 'tier-pricing-table' ), |
| 169 | 'id' => Settings::SETTINGS_PREFIX . 'options_option_text', |
| 170 | 'default' => __( '<strong>Buy {tp_quantity} pieces and save {tp_rounded_discount}%</strong>', 'tier-pricing-table' ), |
| 171 | 'placeholders' => array( |
| 172 | 'tp_quantity', |
| 173 | 'tp_discount', |
| 174 | 'tp_rounded_discount', |
| 175 | ), |
| 176 | 'type' => TPTTextTemplate::FIELD_TYPE, |
| 177 | ), |
| 178 | array( |
| 179 | 'title' => __( 'Show the default option', 'tier-pricing-table' ), |
| 180 | 'id' => Settings::SETTINGS_PREFIX . 'options_show_default_option', |
| 181 | 'type' => TPTSwitchOption::FIELD_TYPE, |
| 182 | 'default' => 'yes', |
| 183 | 'desc' => __( 'Show the option without a discount (option with a regular product price)', |
| 184 | 'tier-pricing-table' ), |
| 185 | ), |
| 186 | array( |
| 187 | 'title' => __( 'Default option text', 'tier-pricing-table' ), |
| 188 | 'id' => Settings::SETTINGS_PREFIX . 'options_default_option_text', |
| 189 | 'default' => __( '<strong>Buy {tp_quantity} pieces', 'tier-pricing-table' ), |
| 190 | 'placeholders' => array( |
| 191 | 'tp_quantity', |
| 192 | ), |
| 193 | 'type' => TPTTextTemplate::FIELD_TYPE, |
| 194 | ), |
| 195 | array( |
| 196 | 'title' => __( 'Set tiered price on a click', 'tier-pricing-table' ), |
| 197 | 'id' => Settings::SETTINGS_PREFIX . 'clickable_table_rows', |
| 198 | 'type' => TPTSwitchOption::FIELD_TYPE, |
| 199 | 'default' => 'yes', |
| 200 | 'desc' => __( 'Change product quantity on click at table pricing row or pricing block', |
| 201 | 'tier-pricing-table' ), |
| 202 | 'custom_attributes' => [ 'data-tiered-pricing-premium-option' => true ] |
| 203 | ), |
| 204 | array( |
| 205 | 'title' => __( 'Show total price', 'tier-pricing-table' ), |
| 206 | 'id' => Settings::SETTINGS_PREFIX . 'show_total_price', |
| 207 | 'type' => TPTSwitchOption::FIELD_TYPE, |
| 208 | 'default' => 'no', |
| 209 | 'desc' => __( 'Calculate and show total price on the product page', 'tier-pricing-table' ), |
| 210 | 'custom_attributes' => [ 'data-tiered-pricing-premium-option' => true ] |
| 211 | ), |
| 212 | ); |
| 213 | } |
| 214 | } |