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 / Single / RelatedProduct.php

RelatedProduct.php in ShopBuilder – WooCommerce Builder For Elementor 1.0.0, at app/Elementor/Widgets/Single/RelatedProduct.php

68 lines 1.6 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\Single;
9
10 // Do not allow directly accessing this file.
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit( 'This script cannot be accessed directly.' );
13 }
14
15 use RadiusTheme\SB\Abstracts\LoopWithProductSlider;
16
17 /**
18 * Product Description class
19 */
20 class RelatedProduct extends LoopWithProductSlider {
21
22 /**
23 * Construct function
24 *
25 * @param array $data default array.
26 * @param mixed $args default arg.
27 */
28 public function __construct( $data = [], $args = null ) {
29 $this->rtsb_base = 'rtsb-related-product';
30 $this->rtsb_name = esc_html__( 'Related Product - Default', 'shopbuilder' );
31 parent::__construct( $data, $args );
32 }
33
34 /**
35 * Apply hooks function.
36 *
37 * @return void
38 */
39 public function apply_hooks() {
40 parent::apply_hooks();
41 $controllers = $this->get_settings_for_display();
42 add_filter( 'woocommerce_output_related_products_args', [ $this, 'products_args' ] );
43 if ( empty( $controllers['show_title'] ) ) {
44 add_filter( 'woocommerce_product_related_products_heading', '__return_false' );
45 } elseif ( ! empty( $controllers['loop_title_text'] ) ) {
46 add_filter(
47 'woocommerce_product_related_products_heading',
48 function( $text ) use ( $controllers ) {
49 return $controllers['loop_title_text'];
50 }
51 );
52 }
53 }
54
55 /**
56 * Widget Selector
57 *
58 * @return array
59 */
60 public function template_data_arg() {
61 return [
62 'template' => 'elementor/single-product/related-product',
63 ];
64 }
65
66
67 }
68