PluginProbe
Tiered Pricing Table for WooCommerce / 6.1.0
Tiered Pricing Table for WooCommerce v6.1.0
8.0.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 All 91 releases
tier-pricing-table / src / Settings / Sections / GeneralSection / GeneralSection.php

GeneralSection.php in Tiered Pricing Table for WooCommerce 6.1.0, at src/Settings/Sections/GeneralSection/GeneralSection.php

152 lines 7.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php namespace TierPricingTable\Settings\Sections\GeneralSection;
2
3 use TierPricingTable\Core\ServiceContainer;
4 use TierPricingTable\Settings\Sections\GeneralSection\Subsections\CartOptionsSubsection;
5 use TierPricingTable\Settings\Sections\GeneralSection\Subsections\HiddenOptionsSubsection;
6 use TierPricingTable\Settings\Sections\GeneralSection\Subsections\NonLoggedInUsersSubsection;
7 use TierPricingTable\Settings\Sections\GeneralSection\Subsections\UpsellsSubsection;
8 use TierPricingTable\Settings\Sections\GeneralSection\Subsections\CatalogPricesSubsection;
9 use TierPricingTable\Settings\Sections\GeneralSection\Subsections\LayoutSubsection;
10 use TierPricingTable\Settings\Sections\GeneralSection\Subsections\ProductPagePriceSubsection;
11 use TierPricingTable\Settings\Sections\GeneralSection\Subsections\SummarySubsection;
12 use TierPricingTable\Settings\Sections\GeneralSection\Subsections\YouSaveSubsection;
13 use TierPricingTable\Settings\Sections\SectionAbstract;
14 use TierPricingTable\Settings\Settings;
15
16 class GeneralSection extends SectionAbstract {
17
18 public function getSettings() {
19 $settings = array();
20
21 foreach ( $this->getSubsections() as $subsection ) {
22 $settings = array_merge( $settings, ( new $subsection() )->getWrappedSettings() );
23 }
24
25 return apply_filters( 'tiered_pricing_table/settings/general_settings', $settings );
26 }
27
28 protected function getSubsections() {
29 return apply_filters( 'tiered_pricing_table/settings/general_subsections', array(
30 HiddenOptionsSubsection::class,
31 LayoutSubsection::class,
32 ProductPagePriceSubsection::class,
33 CatalogPricesSubsection::class,
34 CartOptionsSubsection::class,
35 YouSaveSubsection::class,
36 NonLoggedInUsersSubsection::class,
37 UpsellsSubsection::class,
38 SummarySubsection::class,
39 ) );
40 }
41
42 public static function deleteOptions() {
43 delete_option( Settings::SETTINGS_PREFIX . 'product_page_subsection' );
44 delete_option( Settings::SETTINGS_PREFIX . 'display' );
45 delete_option( Settings::SETTINGS_PREFIX . 'display_type' );
46 delete_option( Settings::SETTINGS_PREFIX . 'quantity_type' );
47 delete_option( Settings::SETTINGS_PREFIX . 'tooltip_color' );
48 delete_option( Settings::SETTINGS_PREFIX . 'tooltip_size' );
49 delete_option( Settings::SETTINGS_PREFIX . 'tooltip_border' );
50 delete_option( Settings::SETTINGS_PREFIX . 'table_title' );
51 delete_option( Settings::SETTINGS_PREFIX . 'position_hook' );
52 delete_option( Settings::SETTINGS_PREFIX . 'selected_quantity_color' );
53 delete_option( Settings::SETTINGS_PREFIX . 'head_quantity_text' );
54 delete_option( Settings::SETTINGS_PREFIX . 'head_price_text' );
55 delete_option( Settings::SETTINGS_PREFIX . 'show_discount_column' );
56 delete_option( Settings::SETTINGS_PREFIX . 'head_discount_text' );
57 delete_option( Settings::SETTINGS_PREFIX . 'table_quantity_measurement' );
58 delete_option( Settings::SETTINGS_PREFIX . 'blocks_quantity_measurement' );
59 delete_option( Settings::SETTINGS_PREFIX . 'product_page_price_format' );
60 delete_option( Settings::SETTINGS_PREFIX . 'clickable_table_rows' );
61 delete_option( Settings::SETTINGS_PREFIX . 'product_page_subsection' );
62 delete_option( Settings::SETTINGS_PREFIX . 'cart_checkout_subsection' );
63 delete_option( Settings::SETTINGS_PREFIX . 'summarize_variations' );
64 delete_option( Settings::SETTINGS_PREFIX . 'show_discount_in_cart' );
65 delete_option( Settings::SETTINGS_PREFIX . 'cart_checkout_subsection' );
66 delete_option( Settings::SETTINGS_PREFIX . 'catalog_prices_subsection' );
67 delete_option( Settings::SETTINGS_PREFIX . 'tiered_price_at_catalog' );
68 delete_option( Settings::SETTINGS_PREFIX . 'tiered_price_at_catalog_for_variable' );
69 delete_option( Settings::SETTINGS_PREFIX . 'tiered_price_at_catalog_cache_for_variable' );
70 delete_option( Settings::SETTINGS_PREFIX . 'tiered_price_at_product_page' );
71 delete_option( Settings::SETTINGS_PREFIX . 'tiered_price_at_catalog_type' );
72 delete_option( Settings::SETTINGS_PREFIX . 'lowest_prefix' );
73 delete_option( Settings::SETTINGS_PREFIX . 'premium_options' );
74 delete_option( Settings::SETTINGS_PREFIX . 'summary_section' );
75 delete_option( Settings::SETTINGS_PREFIX . 'display_summary' );
76 delete_option( Settings::SETTINGS_PREFIX . 'summary_title' );
77 delete_option( Settings::SETTINGS_PREFIX . 'summary_type' );
78 delete_option( Settings::SETTINGS_PREFIX . 'summary_total_label' );
79 delete_option( Settings::SETTINGS_PREFIX . 'summary_each_label' );
80 delete_option( Settings::SETTINGS_PREFIX . 'summary_position_hook' );
81
82 delete_option( Settings::SETTINGS_PREFIX . 'options_option_text' );
83 delete_option( Settings::SETTINGS_PREFIX . 'options_show_default_option' );
84 delete_option( Settings::SETTINGS_PREFIX . 'options_default_option_text' );
85 delete_option( Settings::SETTINGS_PREFIX . 'options_show_original_product_price' );
86 delete_option( Settings::SETTINGS_PREFIX . 'options_show_total' );
87
88 delete_option( Settings::SETTINGS_PREFIX . 'show_total_price' );
89 delete_option( Settings::SETTINGS_PREFIX . 'update_price_on_product_page' );
90 delete_option( Settings::SETTINGS_PREFIX . 'show_tiered_price_as_discount' );
91 }
92
93 public function getSlug(): string {
94 return 'general';
95 }
96
97 public function getName(): string {
98 return __( 'General', 'tier-pricing-table' );
99 }
100
101 public static function getOptionText() {
102 $default = __( '<strong>Buy {tp_quantity} pieces and save {tp_rounded_discount}%</strong>',
103 'tier-pricing-table' );
104
105 return ServiceContainer::getInstance()->getSettings()->get( 'options_option_text', $default );
106 }
107
108 public static function getPlainTextTemplate() {
109 $default = __( '<strong>Buy {tp_quantity} pieces for {tp_price} each and save {tp_rounded_discount}%</strong>',
110 'tier-pricing-table' );
111
112 return ServiceContainer::getInstance()->getSettings()->get( 'plain_text_template', $default );
113 }
114
115 public static function getPlainTextFirstTierTemplate() {
116 $default = __( '<strong>Buy {tp_quantity} pieces for {tp_price}</strong>', 'tier-pricing-table' );
117
118 return ServiceContainer::getInstance()->getSettings()->get( 'plain_text_first_tier_template', $default );
119 }
120
121 public static function isPlainTextFirstTierEnabled(): bool {
122 return ServiceContainer::getInstance()->getSettings()->get( 'plain_text_show_first_tier', 'yes' ) === 'yes';
123 }
124
125 public static function getDefaultOptionText() {
126 $default = __( '<strong>Buy {tp_quantity} pieces</strong>', 'tier-pricing-table' );
127
128 return ServiceContainer::getInstance()->getSettings()->get( 'options_default_option_text', $default );
129 }
130
131 public static function isDefaultOptionEnabled(): bool {
132 return ServiceContainer::getInstance()->getSettings()->get( 'options_show_default_option', 'yes' ) === 'yes';
133 }
134
135 public static function isShowOriginalProductPrice(): bool {
136 return ServiceContainer::getInstance()->getSettings()->get( 'options_show_original_product_price',
137 'yes' ) === 'yes';
138 }
139
140 public static function isShowOptionTotal(): bool {
141 return ServiceContainer::getInstance()->getSettings()->get( 'options_show_total', 'yes' ) === 'yes';
142 }
143
144 public static function getPricingBlocksStyle(): string {
145 return ServiceContainer::getInstance()->getSettings()->get( 'pricing_blocks_style', 'default' );
146 }
147
148 public static function getPricingOptionsStyle(): string {
149 return ServiceContainer::getInstance()->getSettings()->get( 'pricing_options_style', 'default' );
150 }
151 }
152