PluginProbe ʕ •ᴥ•ʔ
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution / 1.1.2
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution v1.1.2
4.9.2 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 4 years ago api.php 5 years ago base.php 4 years ago hooks.php 4 years ago templates.php 4 years ago
base.php
214 lines
1 <?php
2
3 namespace ShopEngine\Core\Builders;
4
5 use ShopEngine\Base\Common;
6 use ShopEngine\Core\Page_Templates\Hooks\Archive;
7 use ShopEngine\Core\Page_Templates\Hooks\Cart;
8 use ShopEngine\Core\Page_Templates\Hooks\Checkout;
9 use ShopEngine\Core\Page_Templates\Hooks\Empty_Cart;
10 use ShopEngine\Core\Page_Templates\Hooks\Shop;
11 use ShopEngine\Core\Page_Templates\Hooks\Single;
12 use ShopEngine\Core\Template_Cpt;
13 use ShopEngine\Traits\Singleton;
14 use ShopEngine\Utils\Elementor_Data_Map;
15
16 defined('ABSPATH') || exit;
17
18 class Base extends Common
19 {
20
21 use Singleton;
22
23 // $api variable call for Cpt Class Instance
24 public $form;
25
26 // $api variable call for Api Class Instance
27 public $api;
28
29 public function get_dir() {
30
31 return dirname(__FILE__);
32 }
33
34
35 /**
36 *
37 * @since 1.0.0
38 *
39 */
40 public function init() {
41
42 $this->api = new Api();
43
44 #Registering custom post type
45 Template_Cpt::instance()->init();
46
47 #All hooks.....................
48 Hooks::instance()->init();
49
50 Shop::instance()->init();
51
52 Archive::instance()->init();
53
54 Single::instance()->init();
55
56 Cart::instance()->init();
57
58 Empty_Cart::instance()->init();
59
60 Checkout::instance()->init();
61
62 add_filter('woocommerce_checkout_fields', [$this, 'disabling_fields'], 999);
63 }
64
65 public function disabling_fields($fields) {
66
67 // checkout page
68 // - is any checkout template active ?
69 // - - then it is overriding the template
70 // - - - then add the filter
71
72 if(is_checkout()) {
73
74 $template_id = $this->get_template_id('checkout', 0);
75
76 if(!empty($template_id)) {
77
78 $current_page_id = get_the_ID();
79 $mapper = new Elementor_Data_Map();
80
81 $dt = $mapper->get_elementor_data($template_id);
82 $els = $mapper->get_widget_data('shopengine-checkout-form-billing', $dt);
83
84 if(!empty($els[0]->settings)) {
85
86 $obj = $els[0]->settings;
87 unset($els);
88
89 if(!empty($obj->shopengine_hide_billing_first_name_field)) {
90
91 unset($fields['billing']['billing_first_name']);
92 }
93
94 if(!empty($obj->shopengine_hide_billing_last_name_field)) {
95
96 unset($fields['billing']['billing_last_name']);
97 }
98
99 if(!empty($obj->shopengine_hide_billing_company_field)) {
100
101 unset($fields['billing']['billing_company']);
102 }
103
104 if(!empty($obj->shopengine_hide_billing_country_field)) {
105
106 unset($fields['billing']['billing_country']);
107 }
108
109 if(!empty($obj->shopengine_hide_billing_address_1_field)) {
110
111 unset($fields['billing']['billing_address_1']);
112 }
113
114 if(!empty($obj->shopengine_hide_billing_address_2_field)) {
115
116 unset($fields['billing']['billing_address_2']);
117 }
118
119 if(!empty($obj->shopengine_hide_billing_city_field)) {
120
121 unset($fields['billing']['billing_city']);
122 }
123
124 if(!empty($obj->shopengine_hide_billing_state_field)) {
125
126 unset($fields['billing']['billing_state']);
127 }
128
129 if(!empty($obj->shopengine_hide_billing_postcode_field)) {
130
131 unset($fields['billing']['billing_postcode']);
132 }
133
134 if(!empty($obj->shopengine_hide_billing_phone_field)) {
135
136 unset($fields['billing']['billing_phone']);
137 }
138
139 if(!empty($obj->shopengine_hide_billing_email_field)) {
140
141 unset($fields['billing']['billing_email']);
142 }
143 }
144
145 $els = $mapper->get_widget_data('shopengine-checkout-form-shipping', $dt);
146
147 if(!empty($els[0]->settings)) {
148
149 $obj = $els[0]->settings;
150 unset($els);
151
152 if(!empty($obj->shopengine_hide_billing_first_name_field)) {
153
154 unset($fields['shipping']['shipping_first_name']);
155 }
156
157 if(!empty($obj->shopengine_hide_shipping_last_name_field)) {
158
159 unset($fields['shipping']['shipping_last_name']);
160 }
161
162 if(!empty($obj->shopengine_hide_shipping_company_field)) {
163
164 unset($fields['shipping']['shipping_company']);
165 }
166
167 if(!empty($obj->shopengine_hide_shipping_country_field)) {
168
169 unset($fields['shipping']['shipping_country']);
170 }
171
172 if(!empty($obj->shopengine_hide_shipping_address_1_field)) {
173
174 unset($fields['shipping']['shipping_address_1']);
175 }
176
177 if(!empty($obj->shopengine_hide_shipping_address_2_field)) {
178
179 unset($fields['shipping']['shipping_address_2']);
180 }
181
182 if(!empty($obj->shopengine_hide_shipping_city_field)) {
183
184 unset($fields['shipping']['shipping_city']);
185 }
186
187 if(!empty($obj->shopengine_hide_shipping_state_field)) {
188
189 unset($fields['shipping']['shipping_state']);
190 }
191
192 if(!empty($obj->shopengine_hide_shipping_postcode_field)) {
193
194 unset($fields['shipping']['shipping_postcode']);
195 }
196 }
197
198 } else {
199
200 // var_dump('ohh....... no checkout template is active!');
201
202 }
203 }
204
205
206 return $fields;
207 }
208
209 public function get_template_id($type, $def = '') {
210
211 return get_option(Action::PK__SHOPENGINE_TEMPLATE . '__' . $type, $def);
212 }
213 }
214