PluginProbe ʕ •ᴥ•ʔ
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution / 1.0.0
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution v1.0.0
4.9.1 4.9.0 2.0.0 2.1.0 2.2.0 2.2.1 2.2.2 2.3.0 2.4.0 2.5.0 2.5.1 3.0.0 3.1.0 3.1.1 4.0.0 4.0.1 4.1.0 4.1.1 4.2.0 4.2.1 4.3.0 4.3.1 4.4.0 4.5.0 4.5.1 4.6.0 4.6.1 4.6.2 4.6.3 4.6.4 4.6.5 4.6.6 4.6.7 4.6.8 4.6.9 4.7.0 4.7.1 4.7.2 4.7.3 4.7.4 4.7.5 4.7.6 4.7.7 4.7.8 4.7.9 4.8.0 4.8.1 4.8.2 4.8.3 4.8.4 4.8.5 4.8.6 4.8.7 4.8.8 4.8.9 trunk 0.1.2-beta 0.1.3-beta 0.1.4-beta 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.4.0 1.4.1 1.5.0 1.5.1 1.6.0 1.6.1 1.7.0 1.8.0 1.8.1 1.9.0
shopengine / core / builders / base.php
shopengine / core / builders Last commit date
action.php 5 years ago api.php 5 years ago base.php 5 years ago hooks.php 5 years ago templates.php 5 years ago
base.php
238 lines
1 <?php
2
3 namespace ShopEngine\Core\Builders;
4
5 use ShopEngine\Base\Common;
6 use ShopEngine\Core\Page_Templates\Hooks\Account;
7 use ShopEngine\Core\Page_Templates\Hooks\Account_Address;
8 use ShopEngine\Core\Page_Templates\Hooks\Account_Details;
9 use ShopEngine\Core\Page_Templates\Hooks\Account_Downloads;
10 use ShopEngine\Core\Page_Templates\Hooks\Account_Login;
11 use ShopEngine\Core\Page_Templates\Hooks\Account_Orders;
12 use ShopEngine\Core\Page_Templates\Hooks\Account_Orders_View;
13 use ShopEngine\Core\Page_Templates\Hooks\Archive;
14 use ShopEngine\Core\Page_Templates\Hooks\Cart;
15 use ShopEngine\Core\Page_Templates\Hooks\Checkout;
16 use ShopEngine\Core\Page_Templates\Hooks\Empty_Cart;
17 use ShopEngine\Core\Page_Templates\Hooks\Shop;
18 use ShopEngine\Core\Page_Templates\Hooks\Single;
19 use ShopEngine\Core\Page_Templates\Hooks\Thank_You;
20 use ShopEngine\Core\Template_Cpt;
21 use ShopEngine\Traits\Singleton;
22 use ShopEngine\Utils\Elementor_Data_Map;
23
24 defined('ABSPATH') || exit;
25
26 class Base extends Common
27 {
28
29 use Singleton;
30
31 // $api variable call for Cpt Class Instance
32 public $form;
33
34 // $api variable call for Api Class Instance
35 public $api;
36
37 public function get_dir() {
38
39 return dirname(__FILE__);
40 }
41
42
43 /**
44 *
45 * @since 1.0.0
46 *
47 */
48 public function init() {
49
50 $this->api = new Api();
51
52 #Registering custom post type
53 Template_Cpt::instance()->init();
54
55 #All hooks.....................
56 Hooks::instance()->init();
57
58 Shop::instance()->init();
59
60 Archive::instance()->init();
61
62 Single::instance()->init();
63
64 Cart::instance()->init();
65
66 Empty_Cart::instance()->init();
67
68 Checkout::instance()->init();
69
70 Thank_You::instance()->init();
71
72 Account::instance()->init();
73
74 Account_Orders::instance()->init();
75
76 Account_Orders_View::instance()->init();
77
78 Account_Downloads::instance()->init();
79
80 Account_Address::instance()->init();
81
82 Account_Details::instance()->init();
83
84 Account_Login::instance()->init();
85
86 add_filter('woocommerce_checkout_fields', [$this, 'disabling_fields'], 999);
87 }
88
89 public function disabling_fields($fields) {
90
91 // checkout page
92 // - is any checkout template active ?
93 // - - then it is overriding the template
94 // - - - then add the filter
95
96 if(is_checkout()) {
97
98 $template_id = $this->get_template_id('checkout', 0);
99
100 if(!empty($template_id)) {
101
102 $current_page_id = get_the_ID();
103 $mapper = new Elementor_Data_Map();
104
105 $dt = $mapper->get_elementor_data($template_id);
106 $els = $mapper->get_widget_data('shopengine-checkout-form-billing', $dt);
107
108 if(!empty($els[0]->settings)) {
109
110 $obj = $els[0]->settings;
111 unset($els);
112
113 if(!empty($obj->shopengine_hide_billing_first_name_field)) {
114
115 unset($fields['billing']['billing_first_name']);
116 }
117
118 if(!empty($obj->shopengine_hide_billing_last_name_field)) {
119
120 unset($fields['billing']['billing_last_name']);
121 }
122
123 if(!empty($obj->shopengine_hide_billing_company_field)) {
124
125 unset($fields['billing']['billing_company']);
126 }
127
128 if(!empty($obj->shopengine_hide_billing_country_field)) {
129
130 unset($fields['billing']['billing_country']);
131 }
132
133 if(!empty($obj->shopengine_hide_billing_address_1_field)) {
134
135 unset($fields['billing']['billing_address_1']);
136 }
137
138 if(!empty($obj->shopengine_hide_billing_address_2_field)) {
139
140 unset($fields['billing']['billing_address_2']);
141 }
142
143 if(!empty($obj->shopengine_hide_billing_city_field)) {
144
145 unset($fields['billing']['billing_city']);
146 }
147
148 if(!empty($obj->shopengine_hide_billing_state_field)) {
149
150 unset($fields['billing']['billing_state']);
151 }
152
153 if(!empty($obj->shopengine_hide_billing_postcode_field)) {
154
155 unset($fields['billing']['billing_postcode']);
156 }
157
158 if(!empty($obj->shopengine_hide_billing_phone_field)) {
159
160 unset($fields['billing']['billing_phone']);
161 }
162
163 if(!empty($obj->shopengine_hide_billing_email_field)) {
164
165 unset($fields['billing']['billing_email']);
166 }
167 }
168
169 $els = $mapper->get_widget_data('shopengine-checkout-form-shipping', $dt);
170
171 if(!empty($els[0]->settings)) {
172
173 $obj = $els[0]->settings;
174 unset($els);
175
176 if(!empty($obj->shopengine_hide_billing_first_name_field)) {
177
178 unset($fields['shipping']['shipping_first_name']);
179 }
180
181 if(!empty($obj->shopengine_hide_shipping_last_name_field)) {
182
183 unset($fields['shipping']['shipping_last_name']);
184 }
185
186 if(!empty($obj->shopengine_hide_shipping_company_field)) {
187
188 unset($fields['shipping']['shipping_company']);
189 }
190
191 if(!empty($obj->shopengine_hide_shipping_country_field)) {
192
193 unset($fields['shipping']['shipping_country']);
194 }
195
196 if(!empty($obj->shopengine_hide_shipping_address_1_field)) {
197
198 unset($fields['shipping']['shipping_address_1']);
199 }
200
201 if(!empty($obj->shopengine_hide_shipping_address_2_field)) {
202
203 unset($fields['shipping']['shipping_address_2']);
204 }
205
206 if(!empty($obj->shopengine_hide_shipping_city_field)) {
207
208 unset($fields['shipping']['shipping_city']);
209 }
210
211 if(!empty($obj->shopengine_hide_shipping_state_field)) {
212
213 unset($fields['shipping']['shipping_state']);
214 }
215
216 if(!empty($obj->shopengine_hide_shipping_postcode_field)) {
217
218 unset($fields['shipping']['shipping_postcode']);
219 }
220 }
221
222 } else {
223
224 // var_dump('ohh....... no checkout template is active!');
225
226 }
227 }
228
229
230 return $fields;
231 }
232
233 public function get_template_id($type, $def = '') {
234
235 return get_option(Action::PK__SHOPENGINE_TEMPLATE . '__' . $type, $def);
236 }
237 }
238