Adv_Accordion.php
1 year ago
Adv_Tabs.php
1 year ago
Advanced_Data_Table.php
1 year ago
Better_Payment.php
4 years ago
Betterdocs_Category_Box.php
1 year ago
Betterdocs_Category_Grid.php
1 year ago
Betterdocs_Search_Form.php
1 year ago
Business_Reviews.php
1 year ago
Caldera_Forms.php
1 year ago
Career_Page.php
4 years ago
Contact_Form_7.php
1 year ago
Content_Ticker.php
1 year ago
Countdown.php
1 year ago
Creative_Button.php
1 year ago
Cta_Box.php
1 year ago
Data_Table.php
1 year ago
Dual_Color_Header.php
1 year ago
EmbedPress.php
4 years ago
Event_Calendar.php
1 year ago
Facebook_Feed.php
1 year ago
Fancy_Text.php
1 year ago
Feature_List.php
1 year ago
Filterable_Gallery.php
1 year ago
Flip_Box.php
1 year ago
FluentForm.php
1 year ago
Formstack.php
1 year ago
GravityForms.php
1 year ago
Image_Accordion.php
1 year ago
Info_Box.php
1 year ago
Interactive_Circle.php
1 year ago
Login_Register.php
1 year ago
NFT_Gallery.php
1 year ago
NinjaForms.php
1 year ago
Post_Grid.php
1 year ago
Post_Timeline.php
1 year ago
Pricing_Table.php
1 year ago
Product_Grid.php
1 year ago
Progress_Bar.php
1 year ago
SVG_Draw.php
1 year ago
Simple_Menu.php
1 year ago
Sticky_Video.php
1 year ago
Team_Member.php
1 year ago
Testimonial.php
1 year ago
Tooltip.php
1 year ago
Twitter_Feed.php
1 year ago
TypeForm.php
1 year ago
WeForms.php
2 years ago
Woo_Cart.php
1 year ago
Woo_Checkout.php
1 year ago
Woo_Product_Carousel.php
1 year ago
Woo_Product_Compare.php
2 years ago
Woo_Product_Gallery.php
1 year ago
Woo_Product_List.php
1 year ago
WpForms.php
1 year ago
index.php
3 years ago
Woo_Product_Compare.php
112 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Essential_Addons_Elementor\Elements; |
| 4 | |
| 5 | use Elementor\Controls_Manager; |
| 6 | use Elementor\Widget_Base; |
| 7 | use Essential_Addons_Elementor\Traits\Woo_Product_Comparable; |
| 8 | |
| 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | exit; |
| 11 | } // Exit if accessed directly |
| 12 | |
| 13 | /** |
| 14 | * Class Woo_Product_Compare |
| 15 | * @package namespace Essential_Addons_Elementor\Pro\Elements; |
| 16 | */ |
| 17 | class Woo_Product_Compare extends Widget_Base { |
| 18 | use Woo_Product_Comparable; |
| 19 | |
| 20 | protected $products_list = []; |
| 21 | protected $remove_action = 'eael-wcpc-remove-product'; |
| 22 | |
| 23 | /** |
| 24 | * @inheritDoc |
| 25 | */ |
| 26 | public function get_name() { |
| 27 | return 'eael-woo-product-compare'; |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * @inheritDoc |
| 32 | */ |
| 33 | public function get_title() { |
| 34 | return esc_html__( 'Woo Product Compare', 'essential-addons-for-elementor-lite' ); |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * @inheritDoc |
| 39 | */ |
| 40 | public function get_icon() { |
| 41 | return 'eaicon-product-compare'; |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * @inheritDoc |
| 46 | */ |
| 47 | public function get_keywords() { |
| 48 | return [ |
| 49 | 'woocommerce product compare', |
| 50 | 'woocommerce product comparison', |
| 51 | 'product compare', |
| 52 | 'product comparison', |
| 53 | 'products compare', |
| 54 | 'products comparison', |
| 55 | 'wc', |
| 56 | 'woocommerce', |
| 57 | 'products', |
| 58 | 'compare', |
| 59 | 'comparison', |
| 60 | 'ea', |
| 61 | 'essential addons', |
| 62 | ]; |
| 63 | } |
| 64 | |
| 65 | public function get_custom_help_url() { |
| 66 | return 'https://essential-addons.com/elementor/docs/woo-product-compare/'; |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * @inheritDoc |
| 71 | */ |
| 72 | public function get_categories() { |
| 73 | return [ 'essential-addons-elementor', 'woocommerce-elements' ]; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * @inheritDoc |
| 78 | */ |
| 79 | protected function register_controls() { |
| 80 | $this->init_content_wc_notice_controls(); |
| 81 | if ( ! function_exists( 'WC' ) ) { |
| 82 | return; |
| 83 | } |
| 84 | |
| 85 | /*----Content Tab----*/ |
| 86 | do_action( 'eael/wcpc/before-content-controls', $this ); |
| 87 | $this->init_content_product_compare_controls(); |
| 88 | $this->init_content_table_settings_controls(); |
| 89 | do_action( 'eael/wcpc/after-content-controls', $this ); |
| 90 | |
| 91 | /*----Style Tab----*/ |
| 92 | do_action( 'eael/wcpc/before-style-controls', $this ); |
| 93 | $this->init_style_content_controls(); |
| 94 | $this->init_style_table_controls(); |
| 95 | do_action( 'eael/wcpc/after-style-controls', $this ); |
| 96 | |
| 97 | } |
| 98 | |
| 99 | protected function render() { |
| 100 | if ( ! function_exists( 'WC' ) ) { |
| 101 | return; |
| 102 | } |
| 103 | $ds = $this->get_settings_for_display(); |
| 104 | $product_ids = $this->get_settings_for_display( 'product_ids' ); |
| 105 | $products = $this->get_products_list( $product_ids ); |
| 106 | $fields = $this->fields(); |
| 107 | |
| 108 | $this->render_compare_table( compact( 'products', 'fields', 'ds' ) ); |
| 109 | } |
| 110 | |
| 111 | } |
| 112 |