PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.10.8
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.10.8
3.13.3 3.13.2 3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 2.8.16 All 261 releases
wpfunnels / includes / core / widgets / bricks / OrderDetailsWidget.php

OrderDetailsWidget.php in WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell 3.10.8, at includes/core/widgets/bricks/OrderDetailsWidget.php

215 lines 7.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Namespace for the OrderDetailsWidget class.
5 *
6 * This namespace defines the location of the OrderDetailsWidget class within the WPFunnels\Widgets\Bricks namespace.
7 */
8 namespace WPFunnels\Widgets\Bricks;
9
10 require_once get_template_directory() . '/includes/elements/base.php';
11
12 use \Bricks\Element;
13 use Error;
14
15 if (! defined('ABSPATH')) {
16 exit;
17 } // Exit if accessed directly
18
19
20 /**
21 * Class OrderDetailsWidget
22 *
23 * Represents a widget for displaying order details.
24 *
25 * @package WPFunnels\Widgets\Bricks
26 */
27 class OrderDetailsWidget extends Element
28 {
29
30 // Element properties
31 public $category = 'wpfunnels'; // Use predefined element category 'general'
32 public $name = 'wpfnl_order_deatils'; // Make sure to prefix your elements
33 public $icon = 'fa-solid fa-cart-shopping'; // Themify icon font class
34 public $css_selector = '.wpfunnels-bricks-order-details-icon'; // Default CSS selector
35 public $scripts = []; // Script(s) run when element is rendered on frontend or updated in builder
36
37
38 /**
39 * Return localised element label
40 *
41 * @return string
42 * @since 3.1.0
43 */
44 public function get_label()
45 {
46 return esc_html__('Order Detail', 'wpfnl');
47 }
48
49
50 /**
51 * Set builder control groups
52 *
53 * @since 3.1.0
54 */
55 public function set_control_groups()
56 {
57 $this->control_groups['wpfunnels'] = [
58 'title' => esc_html__('wpfunnels', 'wpfnl'), // Localized control group title
59 'tab' => 'content', // Set to either "content" or "style"
60 ];
61 }
62
63 /**
64 * Set builder controls
65 *
66 * @since 3.1.0
67 */
68 public function set_controls()
69 {
70
71 $wpfnl_thankyou_order_overview = get_post_meta($this->post_id, '_wpfnl_thankyou_order_overview', true);
72 $wpfnl_thankyou_order_details = get_post_meta($this->post_id, '_wpfnl_thankyou_order_details', true);
73 $wpfnl_thankyou_billing_details = get_post_meta($this->post_id, '_wpfnl_thankyou_billing_details', true);
74 $wpfnl_thankyou_shipping_details = get_post_meta($this->post_id, '_wpfnl_thankyou_shipping_details', true);
75
76 if (!$wpfnl_thankyou_order_overview) {
77 $wpfnl_thankyou_order_overview = 'on';
78 }
79 if (!$wpfnl_thankyou_order_details) {
80 $wpfnl_thankyou_order_details = 'on';
81 }
82 if (!$wpfnl_thankyou_billing_details) {
83 $wpfnl_thankyou_billing_details = 'on';
84 }
85 if (!$wpfnl_thankyou_shipping_details) {
86 $wpfnl_thankyou_shipping_details = 'on';
87 }
88
89
90 $this->controls['enable_order_review'] = [
91 'tab' => 'content',
92 'group' => 'wpfunnels',
93 'label' => esc_html__('Show Order Overview', 'wpfnl'),
94 'type' => 'select',
95 'options' => [
96 'on' => esc_html__( 'On', 'wpfnl' ),
97 'off' => esc_html__( 'Off', 'wpfnl' ),
98 ],
99 'inline' => true,
100 'clearable' => false,
101 'pasteStyles' => false,
102 'default' => $wpfnl_thankyou_order_overview,
103 ];
104
105 $this->controls['enable_order_details'] = [
106 'tab' => 'content',
107 'group' => 'wpfunnels',
108 'label' => esc_html__('Show Order Details', 'wpfnl'),
109 'type' => 'select',
110 'options' => [
111 'on' => esc_html__( 'On', 'wpfnl' ),
112 'off' => esc_html__( 'Off', 'wpfnl' ),
113 ],
114 'inline' => true,
115 'clearable' => false,
116 'pasteStyles' => false,
117 'default' => $wpfnl_thankyou_order_details,
118 ];
119
120 $this->controls['enable_billing_details'] = [
121 'tab' => 'content',
122 'group' => 'wpfunnels',
123 'label' => esc_html__('Show Billing Details', 'wpfnl'),
124 'type' => 'select',
125 'options' => [
126 'on' => esc_html__( 'On', 'wpfnl' ),
127 'off' => esc_html__( 'Off', 'wpfnl' ),
128 ],
129 'inline' => true,
130 'clearable' => false,
131 'pasteStyles' => false,
132 'default' => $wpfnl_thankyou_billing_details,
133 ];
134
135 $this->controls['enable_shipping_details'] = [
136 'tab' => 'content',
137 'group' => 'wpfunnels',
138 'label' => esc_html__('Show Shipping Details', 'wpfnl'),
139 'type' => 'select',
140 'options' => [
141 'on' => esc_html__( 'On', 'wpfnl' ),
142 'off' => esc_html__( 'Off', 'wpfnl' ),
143 ],
144 'inline' => true,
145 'clearable' => false,
146 'pasteStyles' => false,
147 'default' => $wpfnl_thankyou_shipping_details,
148 ];
149 }
150
151
152 /**
153 * Render the widget output on the frontend.
154 *
155 * Written in PHP and used to generate the final HTML.
156 *
157 * @since 3.1.0
158 *
159 * @access public
160 */
161 public function render()
162 {
163
164 $output = '';
165 $order_overview = 'on';
166 $order_details = 'on';
167 $billing_details = 'on';
168 $shipping_details = 'on';
169
170 if (isset($this->settings['enable_order_review']) && !empty($this->settings['enable_order_review']) ) {
171 $order_overview = $this->settings['enable_order_review'];
172 update_post_meta($this->post_id, '_wpfnl_thankyou_order_overview', $this->settings['enable_order_review']);
173 }else{
174 $order_overview = 'off';
175 update_post_meta( $this->post_id, '_wpfnl_thankyou_order_overview', 'off' );
176 }
177
178 if (isset($this->settings['enable_order_details']) && !empty($this->settings['enable_order_details']) ) {
179 $order_details = $this->settings['enable_order_details'];
180 update_post_meta($this->post_id, '_wpfnl_thankyou_order_details', $this->settings['enable_order_details']);
181 }else{
182 $order_details = 'off';
183 update_post_meta( $this->post_id, '_wpfnl_thankyou_order_details', 'off' );
184 }
185
186 if (isset($this->settings['enable_billing_details']) && !empty($this->settings['enable_billing_details']) ) {
187 $billing_details = $this->settings['enable_billing_details'];
188 update_post_meta($this->post_id, '_wpfnl_thankyou_billing_details', $this->settings['enable_billing_details']);
189 }else{
190 $billing_details = 'off';
191 update_post_meta( $this->post_id, '_wpfnl_thankyou_billing_details', 'off' );
192 }
193
194 if (isset($this->settings['enable_shipping_details']) && !empty($this->settings['enable_shipping_details']) ) {
195 $shipping_details = $this->settings['enable_shipping_details'];
196 update_post_meta($this->post_id, '_wpfnl_thankyou_shipping_details', $this->settings['enable_shipping_details']);
197 }else{
198 $shipping_details = 'off';
199 update_post_meta( $this->post_id, '_wpfnl_thankyou_shipping_details', 'off' );
200 }
201
202 ?>
203 <?php if( !isset($_GET['optin']) ) {
204 ?>
205 <div class = "wpfnl-bricks-order-details-form wpfnl-bricks-display-order-overview-<?php echo esc_attr( $order_overview ); ?> wpfnl-bricks-display-order-details-<?php echo esc_attr( $order_details ); ?> wpfnl-bricks-display-billing-address-<?php echo esc_attr( $billing_details ); ?> wpfnl-bricks-display-shipping-address-<?php echo esc_attr( $shipping_details ); ?>">
206 <?php
207 echo do_shortcode( '[wpfunnels_order_details step_id='.$this->post_id.']' );
208 ?>
209 </div>
210 <?php }
211
212 }
213
214 }
215