| 1 |
<?php namespace TierPricingTable\Addons\YouSave; |
| 2 |
|
| 3 |
use TierPricingTable\Settings\CustomOptions\TPTSwitchOption; |
| 4 |
use TierPricingTable\Settings\CustomOptions\TPTTextTemplate; |
| 5 |
use TierPricingTable\Settings\Sections\SubsectionAbstract; |
| 6 |
use TierPricingTable\Settings\Settings; |
| 7 |
|
| 8 |
class YouSaveSubsection extends SubsectionAbstract { |
| 9 |
|
| 10 |
public function getTitle(): string { |
| 11 |
return __( '"You Save" Badge', 'tier-pricing-table' ); |
| 12 |
} |
| 13 |
|
| 14 |
public function getDescription(): string { |
| 15 |
return __( 'Show customers exactly how much they save when tiered discounts are applied.', |
| 16 |
'tier-pricing-table' ); |
| 17 |
} |
| 18 |
|
| 19 |
public function getSlug(): string { |
| 20 |
return 'you_save'; |
| 21 |
} |
| 22 |
|
| 23 |
public function getSettings(): array { |
| 24 |
return array( |
| 25 |
array( |
| 26 |
'title' => __( 'Show savings badge on product page', 'tier-pricing-table' ), |
| 27 |
'id' => Settings::SETTINGS_PREFIX . 'you_save_enabled', |
| 28 |
'type' => TPTSwitchOption::FIELD_TYPE, |
| 29 |
'default' => 'yes', |
| 30 |
'desc' => __( 'Show the difference between the regular price and a discounted price. You can also show it via the [tiered_price_you_save] shortcode.', |
| 31 |
'tier-pricing-table' ), |
| 32 |
), |
| 33 |
array( |
| 34 |
'title' => __( 'Include WooCommerce sale discount in total savings', 'tier-pricing-table' ), |
| 35 |
'id' => Settings::SETTINGS_PREFIX . 'you_save_consider_sale_price', |
| 36 |
'type' => TPTSwitchOption::FIELD_TYPE, |
| 37 |
'default' => 'yes', |
| 38 |
'desc' => __( 'If a product is already on sale, add that existing discount to the tiered pricing savings so the customer sees one large total saved.', |
| 39 |
'tier-pricing-table' ), |
| 40 |
), |
| 41 |
array( |
| 42 |
'title' => __( 'Show badge for standard products (non-tiered)', 'tier-pricing-table' ), |
| 43 |
'id' => Settings::SETTINGS_PREFIX . 'you_save_non_tiered', |
| 44 |
'type' => TPTSwitchOption::FIELD_TYPE, |
| 45 |
'default' => 'no', |
| 46 |
'desc' => __( 'Display the savings badge for regular WooCommerce sale products even if they don\'t have tiered pricing rules.', |
| 47 |
'tier-pricing-table' ), |
| 48 |
), |
| 49 |
array( |
| 50 |
'title' => __( 'Badge text template', 'tier-pricing-table' ), |
| 51 |
'id' => Settings::SETTINGS_PREFIX . 'you_save_template', |
| 52 |
'default' => __( 'You save {tp_ys_total_price} ({tp_ys_percentage_discount}%)', |
| 53 |
'tier-pricing-table' ), |
| 54 |
'placeholders' => array( |
| 55 |
'tp_ys_price', |
| 56 |
'tp_ys_total_price', |
| 57 |
'tp_ys_percentage_discount', |
| 58 |
), |
| 59 |
'type' => TPTTextTemplate::FIELD_TYPE, |
| 60 |
), |
| 61 |
array( |
| 62 |
'title' => __( 'Badge text color', 'tier-pricing-table' ), |
| 63 |
'id' => Settings::SETTINGS_PREFIX . 'you_save_text_color', |
| 64 |
'type' => 'color', |
| 65 |
'css' => 'width:6em;', |
| 66 |
'default' => '#FF0000', |
| 67 |
), |
| 68 |
); |
| 69 |
} |
| 70 |
} |
| 71 |
|