PluginProbe
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder / 3.1.4
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder v3.1.4
3.1.4 3.0.8 3.0.9 3.1.0 3.1.2 3.1.3 3.0.7 3.0.5 3.0.4 3.0.3 3.0.2 trunk 1.5.0 1.5.1 1.5.2 1.6.1 1.6.2 1.6.3 1.6.4 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 All 93 releases
← All changes | modules/mini-cart/module.php +63 -67 2.0.43.1.4 View file →
@@ -3,95 +3,91 @@
3 3 namespace UltimateStoreKit\Modules\MiniCart;
4 4
5 5 use UltimateStoreKit\Base\Ultimate_Store_Kit_Module_Base;
6 6
7 -if (!defined('ABSPATH')) exit; // Exit if accessed directly
7 +if ( ! defined( 'ABSPATH' ) )
8 + exit; // Exit if accessed directly
8 9
9 10 class Module extends Ultimate_Store_Kit_Module_Base {
10 11
11 12
12 - const TEMPLATE_MINI_CART = 'cart/mini-cart.php';
13 - const OPTION_NAME_USE_MINI_CART = 'use_mini_cart_template';
13 + const TEMPLATE_MINI_CART = 'cart/mini-cart.php';
14 + const OPTION_NAME_USE_MINI_CART = 'use_mini_cart_template';
14 15
15 - public function __construct() {
16 + public function __construct() {
16 17
17 - parent::__construct();
18 + parent::__construct();
18 19
19 20 wp_enqueue_script( 'wc-cart-fragments' );
20 21
21 - // add_filter('woocommerce_add_to_cart_fragments', [$this, 'ultimate_store_kit_mini_cart_fragment']);
22 - // add_filter('woocommerce_locate_template', [$this, 'woocommerce_locate_template'], 12, 3);
23 - }
22 + add_filter( 'woocommerce_add_to_cart_fragments', [ $this, 'ultimate_store_kit_mini_cart_fragment' ] );
23 + add_filter( 'woocommerce_locate_template', [ $this, 'woocommerce_locate_template' ], 12, 3 );
24 + }
24 25
25 - public function render_markup() {
26 -?>
27 - <div class="toolset">
28 - <div class="ts-container">
29 - <div class="ts-nav-container"></div>
30 - <div class="ts-content-container">
31 - <div id="first" class="ts-content-item">
32 - <div class="widget_shopping_cart_content"></div>
33 - </div>
34 - </div>
35 - </div>
36 - </div>
37 - <?php
38 - }
26 + public function render_markup() {
27 + ?>
28 + <div class="toolset">
29 + <div class="ts-container">
30 + <div class="ts-nav-container"></div>
31 + <div class="ts-content-container">
32 + <div id="first" class="ts-content-item">
33 + <div class="widget_shopping_cart_content"></div>
34 + </div>
35 + </div>
36 + </div>
37 + </div>
38 + <?php
39 + }
39 40
40 - public function get_name() {
41 - return 'usk-mini-cart';
42 - }
41 + public function get_name() {
42 + return 'usk-mini-cart';
43 + }
43 44
44 - public function get_widgets() {
45 + public function get_widgets() {
45 46
46 - $widgets = ['Mini_Cart'];
47 + $widgets = [ 'Mini_Cart' ];
47 48
48 - return $widgets;
49 - }
49 + return $widgets;
50 + }
50 51
51 - public function woocommerce_locate_template($template, $template_name, $template_path) {
52 + public function woocommerce_locate_template( $template, $template_name, $template_path ) {
52 53
53 - if (self::TEMPLATE_MINI_CART !== $template_name) {
54 - return $template;
55 - }
54 + if ( self::TEMPLATE_MINI_CART !== $template_name ) {
55 + return $template;
56 + }
56 57
57 - $plugin_path = BDTUSK_MODULES_PATH . 'mini-cart/templates/';
58 + $plugin_path = BDTUSK_MODULES_PATH . 'mini-cart/templates/';
58 59
59 - if (file_exists($plugin_path . $template_name)) {
60 - $template = $plugin_path . $template_name;
61 - }
60 + if ( file_exists( $plugin_path . $template_name ) ) {
61 + $template = $plugin_path . $template_name;
62 + }
62 63
63 - // if(class_exists('\UltimateStoreKit\Modules\MiniCart\Templates\Cart\Mini_Cart')) {
64 - // unset($template['cart/mini-cart.php']);
65 - // }
64 + return $template;
65 + }
66 66
67 - return $template;
68 - }
67 + public function ultimate_store_kit_mini_cart_fragment( $fragments ) {
68 + global $woocommerce;
69 69
70 - public function ultimate_store_kit_mini_cart_fragment($fragments) {
71 - global $woocommerce;
70 + ob_start();
72 71
73 - ob_start();
72 + ?>
73 + <span class="usk-mini-cart-inner">
74 + <span class="usk-cart-button-text">
75 + <span class="usk-mini-cart-price-amount">
76 + <?php echo wp_kses_post( WC()->cart->get_cart_subtotal() ); ?>
77 + </span>
78 + </span>
79 + <span class="usk-mini-cart-button-icon">
80 + <span class="usk-cart-badge">
81 + <?php echo wp_kses_post( WC()->cart->get_cart_contents_count() ); ?>
82 + </span>
83 + <span class="usk-cart-icon">
84 + <i class="usk-icon-cart" aria-hidden="true"></i>
85 + </span>
86 + </span>
87 + </span>
88 + <?php
89 + $fragments['div.usk-mini-cart-toggle-btn .usk-mini-cart-inner'] = ob_get_clean();
74 90
75 - ?>
76 - <span class="bdt-mini-cart-inner">
77 - <span class="bdt-cart-button-text">
78 - <span class="bdt-mini-cart-price-amount">
79 - <?php echo WC()->cart->get_cart_subtotal(); ?>
80 - </span>
81 - </span>
82 - <span class="bdt-mini-cart-button-icon">
83 - <span class="bdt-cart-badge">
84 - <?php echo WC()->cart->get_cart_contents_count(); ?>
85 - </span>
86 - <span class="bdt-cart-icon">
87 - <i class="eicon" aria-hidden="true"></i>
88 - </span>
89 - </span>
90 - </span>
91 -
92 -<?php
93 - $fragments['a.bdt-mini-cart-button .bdt-mini-cart-inner'] = ob_get_clean();
94 -
95 - return $fragments;
96 - }
91 + return $fragments;
92 + }
97 93 }