← All changes
|
src/Addons/TieredPricingCart/CartOptionsSubsection.php
+28
-4
6.4.0
→
8.0.2
View file →
| @@ -6,9 +6,9 @@ | ||
| 6 | 6 | |
| 7 | 7 | class CartOptionsSubsection extends SubsectionAbstract { |
| 8 | 8 | |
| 9 | 9 | public function getTitle(): string { |
| 10 | - return __( 'Cart Display Settings', 'tier-pricing-table' ); | |
| 10 | + return __( 'Cart Page Pricing', 'tier-pricing-table' ); | |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | public function getDescription(): string { |
| 14 | 14 | return __( 'Manage how tiered pricing and discounts appear on the cart page.', 'tier-pricing-table' ); |
| @@ -20,9 +20,9 @@ | ||
| 20 | 20 | |
| 21 | 21 | public function getSettings(): array { |
| 22 | 22 | return array( |
| 23 | 23 | array( |
| 24 | - 'title' => __( 'Display price as discount', 'tier-pricing-table' ), | |
| 24 | + 'title' => __( 'Show original item price crossed out', 'tier-pricing-table' ), | |
| 25 | 25 | 'id' => Settings::SETTINGS_PREFIX . 'show_discount_in_cart', |
| 26 | 26 | 'desc' => __( 'Show a crossed-out regular price next to the discounted tiered price in the cart. For example: ', |
| 27 | 27 | 'tier-pricing-table' ) . ' <b><del>$10.00</del> <ins>$8.00</ins><b>', |
| 28 | 28 | 'type' => TPTSwitchOption::FIELD_TYPE, |
| @@ -28,9 +28,9 @@ | ||
| 28 | 28 | 'type' => TPTSwitchOption::FIELD_TYPE, |
| 29 | 29 | 'default' => 'yes', |
| 30 | 30 | ), |
| 31 | 31 | array( |
| 32 | - 'title' => __( 'Display subtotal as discount', 'tier-pricing-table' ), | |
| 32 | + 'title' => __( 'Show original subtotal crossed out', 'tier-pricing-table' ), | |
| 33 | 33 | 'id' => Settings::SETTINGS_PREFIX . 'show_subtotal_as_discount_in_cart', |
| 34 | 34 | 'desc' => __( 'Show a crossed-out regular subtotal next to the discounted subtotal in the cart.', |
| 35 | 35 | 'tier-pricing-table' ), |
| 36 | 36 | 'type' => TPTSwitchOption::FIELD_TYPE, |
| @@ -36,9 +36,9 @@ | ||
| 36 | 36 | 'type' => TPTSwitchOption::FIELD_TYPE, |
| 37 | 37 | 'default' => 'yes', |
| 38 | 38 | ), |
| 39 | 39 | array( |
| 40 | - 'title' => __( 'Always use regular price', 'tier-pricing-table' ), | |
| 40 | + 'title' => __( 'Cross out regular price instead of sale price', 'tier-pricing-table' ), | |
| 41 | 41 | 'id' => Settings::SETTINGS_PREFIX . 'consider_sale_price_as_discount_in_cart', |
| 42 | 42 | 'desc' => __( 'When crossing out a price, always display the regular price rather than a sale price.', |
| 43 | 43 | 'tier-pricing-table' ), |
| 44 | 44 | 'type' => TPTSwitchOption::FIELD_TYPE, |
| @@ -43,9 +43,33 @@ | ||
| 43 | 43 | 'tier-pricing-table' ), |
| 44 | 44 | 'type' => TPTSwitchOption::FIELD_TYPE, |
| 45 | 45 | 'default' => 'no', |
| 46 | 46 | ), |
| 47 | + array( | |
| 48 | + 'title' => __( 'Show a total savings row', 'tier-pricing-table' ), | |
| 49 | + 'id' => Settings::SETTINGS_PREFIX . 'cart_total_savings', | |
| 50 | + 'desc' => __( 'A row in the cart totals and in the classic checkout\'s order review with the amount the tiered prices take off the cart. Not available with the Checkout block.', 'tier-pricing-table' ), | |
| 51 | + 'type' => TPTSwitchOption::FIELD_TYPE, | |
| 52 | + 'default' => 'no', | |
| 53 | + ), | |
| 54 | + array( | |
| 55 | + 'title' => __( 'Total savings row label', 'tier-pricing-table' ), | |
| 56 | + 'id' => Settings::SETTINGS_PREFIX . 'cart_total_savings_label', | |
| 57 | + 'type' => 'text', | |
| 58 | + 'default' => __( 'Total savings', 'tier-pricing-table' ), | |
| 59 | + 'css' => 'width: 20em;', | |
| 60 | + ), | |
| 47 | 61 | ); |
| 62 | + } | |
| 63 | + | |
| 64 | + public static function showTotalSavings(): bool { | |
| 65 | + return get_option( Settings::SETTINGS_PREFIX . 'cart_total_savings', 'no' ) === 'yes'; | |
| 66 | + } | |
| 67 | + | |
| 68 | + public static function getTotalSavingsLabel(): string { | |
| 69 | + $label = (string) get_option( Settings::SETTINGS_PREFIX . 'cart_total_savings_label', '' ); | |
| 70 | + | |
| 71 | + return '' !== trim( $label ) ? $label : __( 'Total savings', 'tier-pricing-table' ); | |
| 48 | 72 | } |
| 49 | 73 | |
| 50 | 74 | |
| 51 | 75 | /** |