PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 1.0.0
ShopBuilder – WooCommerce Builder For Elementor v1.0.0
3.4.2 3.4.1 3.4.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 All 63 releases
shopbuilder / app / Elementor / Widgets / Cart / CartTable.php

CartTable.php in ShopBuilder – WooCommerce Builder For Elementor 1.0.0, at app/Elementor/Widgets/Cart/CartTable.php

99 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Main ProductDescription class.
4 *
5 * @package RadiusTheme\SB
6 */
7
8 namespace RadiusTheme\SB\Elementor\Widgets\Cart;
9
10 use RadiusTheme\SB\Helpers\Fns;
11 use RadiusTheme\SB\Abstracts\ElementorWidgetBase;
12 use RadiusTheme\SB\Elementor\Widgets\Controls\CartTableSettings;
13
14 // Do not allow directly accessing this file.
15 if ( ! defined( 'ABSPATH' ) ) {
16 exit( 'This script cannot be accessed directly.' );
17 }
18
19 /**
20 * Product Description class
21 */
22 class CartTable extends ElementorWidgetBase {
23 /**
24 * Construct function
25 *
26 * @param array $data default array.
27 * @param mixed $args default arg.
28 */
29 public function __construct( $data = [], $args = null ) {
30 $this->rtsb_name = esc_html__( 'Cart Table', 'shopbuilder' );
31 $this->rtsb_base = 'rtsb-product-carttable';
32 parent::__construct( $data, $args );
33 }
34 /**
35 * Widget Field
36 *
37 * @return array
38 */
39 public function widget_fields() {
40 $fields = CartTableSettings::widget_fields( $this );
41 return apply_filters( 'rtsb/elements/elementor/cart/' . $this->rtsb_base, $fields, $this );
42 }
43 /**
44 * Set Widget Keyword.
45 *
46 * @return array
47 */
48 public function get_keywords() {
49 return [ 'Cart' ] + parent::get_keywords();
50 }
51 /**
52 * Set Widget Keyword.
53 *
54 * @return array
55 */
56 public function cart_empty_message() {
57 $controllers = $this->get_settings_for_display();
58 return $controllers['cart_empty_message'];
59 }
60 /**
61 * Set Widget Keyword.
62 *
63 * @return array
64 */
65 public function return_to_shop_text() {
66 $controllers = $this->get_settings_for_display();
67 return $controllers['return_to_shop_text'];
68 }
69 /**
70 * Render Function
71 *
72 * @return void
73 */
74 protected function render() {
75 $controllers = $this->get_settings_for_display();
76 $this->theme_support();
77 $data = [
78 'template' => 'elementor/cart/cart-table',
79 'controllers' => $controllers,
80 'is_builder' => $this->is_builder_mode(),
81 ];
82 if ( $data['is_builder'] ) {
83 wc_load_cart();
84 }
85
86 if ( ! empty( $controllers['cart_empty_message'] ) ) {
87 add_filter( 'wc_empty_cart_message', [ $this, 'cart_empty_message' ] );
88 }
89
90 if ( ! empty( $controllers['return_to_shop_text'] ) ) {
91 add_filter( 'woocommerce_return_to_shop_text', [ $this, 'return_to_shop_text' ] );
92 }
93
94 Fns::load_template( $data['template'], $data );
95 $this->theme_support( 'render_reset' );
96 }
97
98 }
99