start_controls_section( 'section_data_source', [ 'label' => __('Data Source', 'cannaiq-menus'), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'dispensary_id', [ 'label' => __('Store ID', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::NUMBER, 'default' => '', 'description' => __('Enter your store/dispensary ID from CannaIQ', 'cannaiq-menus'), ] ); $this->add_control( 'limit', [ 'label' => __('Products Limit', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::NUMBER, 'default' => 12, 'min' => 1, 'max' => 100, ] ); $this->end_controls_section(); // Content Section - Filters $this->start_controls_section( 'section_filters', [ 'label' => __('Filters', 'cannaiq-menus'), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'category', [ 'label' => __('Category', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __('All Categories', 'cannaiq-menus'), 'Flower' => __('Flower', 'cannaiq-menus'), 'Vaporizers' => __('Vaporizers', 'cannaiq-menus'), 'Concentrates' => __('Concentrates', 'cannaiq-menus'), 'Edibles' => __('Edibles', 'cannaiq-menus'), 'Pre-Rolls' => __('Pre-Rolls', 'cannaiq-menus'), 'Topicals' => __('Topicals', 'cannaiq-menus'), 'Tinctures' => __('Tinctures', 'cannaiq-menus'), 'Accessories' => __('Accessories', 'cannaiq-menus'), ], ] ); $this->add_control( 'strain_type', [ 'label' => __('Strain Type', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __('All Strains', 'cannaiq-menus'), 'sativa' => __('Sativa', 'cannaiq-menus'), 'indica' => __('Indica', 'cannaiq-menus'), 'hybrid' => __('Hybrid', 'cannaiq-menus'), 'cbd' => __('CBD', 'cannaiq-menus'), ], ] ); $this->add_control( 'brand', [ 'label' => __('Brand Name', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::TEXT, 'default' => '', 'description' => __('Filter by brand name (exact match)', 'cannaiq-menus'), ] ); $this->add_control( 'on_sale', [ 'label' => __('On Sale Only', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'default' => '', ] ); $this->add_control( 'min_thc', [ 'label' => __('Minimum THC %', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::NUMBER, 'default' => '', 'min' => 0, 'max' => 100, ] ); $this->add_control( 'max_price', [ 'label' => __('Maximum Price', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::NUMBER, 'default' => '', 'min' => 0, ] ); $this->add_control( 'search', [ 'label' => __('Search Term', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::TEXT, 'default' => '', 'description' => __('Search in product name, brand, description', 'cannaiq-menus'), ] ); $this->add_control( 'sort_by', [ 'label' => __('Sort By', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => 'name', 'options' => [ 'name' => __('Name (A-Z)', 'cannaiq-menus'), 'name_desc' => __('Name (Z-A)', 'cannaiq-menus'), 'price' => __('Price (Low to High)', 'cannaiq-menus'), 'price_desc' => __('Price (High to Low)', 'cannaiq-menus'), 'thc' => __('THC % (Low to High)', 'cannaiq-menus'), 'thc_desc' => __('THC % (High to Low)', 'cannaiq-menus'), 'brand' => __('Brand (A-Z)', 'cannaiq-menus'), ], ] ); $this->end_controls_section(); // Layout Section $this->start_controls_section( 'section_layout', [ 'label' => __('Layout', 'cannaiq-menus'), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'layout', [ 'label' => __('Layout', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => 'grid', 'options' => [ 'grid' => __('Grid', 'cannaiq-menus'), 'list' => __('List', 'cannaiq-menus'), 'masonry' => __('Masonry', 'cannaiq-menus'), ], ] ); $this->add_responsive_control( 'columns', [ 'label' => __('Columns', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => '3', 'tablet_default' => '2', 'mobile_default' => '1', 'options' => [ '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', ], 'selectors' => [ '{{WRAPPER}} .cannaiq-product-loop-grid' => 'grid-template-columns: repeat({{VALUE}}, 1fr);', ], 'condition' => [ 'layout' => ['grid', 'masonry'], ], ] ); $this->add_responsive_control( 'gap', [ 'label' => __('Gap', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::SLIDER, 'size_units' => ['px', 'em', 'rem'], 'range' => [ 'px' => ['min' => 0, 'max' => 100], ], 'default' => ['size' => 20, 'unit' => 'px'], 'selectors' => [ '{{WRAPPER}} .cannaiq-product-loop-grid' => 'gap: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .cannaiq-product-loop-list' => 'gap: {{SIZE}}{{UNIT}};', ], ] ); $this->end_controls_section(); // Card Display Section $this->start_controls_section( 'section_card_display', [ 'label' => __('Card Display', 'cannaiq-menus'), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'show_image', [ 'label' => __('Show Image', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'default' => 'yes', ] ); $this->add_control( 'show_brand', [ 'label' => __('Show Brand', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'default' => 'yes', ] ); $this->add_control( 'show_name', [ 'label' => __('Show Name', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'default' => 'yes', ] ); $this->add_control( 'show_category', [ 'label' => __('Show Category', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'default' => 'yes', ] ); $this->add_control( 'show_strain_type', [ 'label' => __('Show Strain Type', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'default' => 'yes', ] ); $this->add_control( 'show_thc', [ 'label' => __('Show THC %', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'default' => 'yes', ] ); $this->add_control( 'show_cbd', [ 'label' => __('Show CBD %', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'default' => '', ] ); $this->add_control( 'show_effects', [ 'label' => __('Show Effects', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'default' => 'yes', ] ); $this->add_control( 'effects_limit', [ 'label' => __('Effects Limit', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::NUMBER, 'default' => 3, 'min' => 1, 'max' => 10, 'condition' => [ 'show_effects' => 'yes', ], ] ); $this->add_control( 'show_price', [ 'label' => __('Show Price', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'default' => 'yes', ] ); $this->add_control( 'show_weight', [ 'label' => __('Show Weight/Size', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'default' => 'yes', ] ); $this->add_control( 'show_sale_badge', [ 'label' => __('Show Sale Badge', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'default' => 'yes', ] ); $this->end_controls_section(); // Style Section - Card $this->start_controls_section( 'section_style_card', [ 'label' => __('Card', 'cannaiq-menus'), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'card_background', [ 'label' => __('Background Color', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#ffffff', 'selectors' => [ '{{WRAPPER}} .cannaiq-product-card' => 'background-color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'card_padding', [ 'label' => __('Padding', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => ['px', 'em', '%'], 'default' => [ 'top' => '15', 'right' => '15', 'bottom' => '15', 'left' => '15', 'unit' => 'px', ], 'selectors' => [ '{{WRAPPER}} .cannaiq-product-card' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Border::get_type(), [ 'name' => 'card_border', 'selector' => '{{WRAPPER}} .cannaiq-product-card', ] ); $this->add_control( 'card_border_radius', [ 'label' => __('Border Radius', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => ['px', '%'], 'default' => [ 'top' => '8', 'right' => '8', 'bottom' => '8', 'left' => '8', 'unit' => 'px', ], 'selectors' => [ '{{WRAPPER}} .cannaiq-product-card' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Box_Shadow::get_type(), [ 'name' => 'card_shadow', 'selector' => '{{WRAPPER}} .cannaiq-product-card', ] ); $this->end_controls_section(); // Style Section - Image $this->start_controls_section( 'section_style_image', [ 'label' => __('Image', 'cannaiq-menus'), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'image_height', [ 'label' => __('Height', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::SLIDER, 'size_units' => ['px', 'vh'], 'range' => [ 'px' => ['min' => 100, 'max' => 500], ], 'default' => ['size' => 200, 'unit' => 'px'], 'selectors' => [ '{{WRAPPER}} .cannaiq-product-image' => 'height: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'image_fit', [ 'label' => __('Object Fit', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => 'contain', 'options' => [ 'contain' => __('Contain', 'cannaiq-menus'), 'cover' => __('Cover', 'cannaiq-menus'), 'fill' => __('Fill', 'cannaiq-menus'), ], 'selectors' => [ '{{WRAPPER}} .cannaiq-product-image img' => 'object-fit: {{VALUE}};', ], ] ); $this->add_control( 'image_border_radius', [ 'label' => __('Border Radius', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => ['px', '%'], 'selectors' => [ '{{WRAPPER}} .cannaiq-product-image' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); // Style Section - Typography $this->start_controls_section( 'section_style_typography', [ 'label' => __('Typography', 'cannaiq-menus'), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'name_color', [ 'label' => __('Name Color', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#1a1a1a', 'selectors' => [ '{{WRAPPER}} .cannaiq-product-name' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'name_typography', 'label' => __('Name Typography', 'cannaiq-menus'), 'selector' => '{{WRAPPER}} .cannaiq-product-name', ] ); $this->add_control( 'brand_color', [ 'label' => __('Brand Color', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#666666', 'selectors' => [ '{{WRAPPER}} .cannaiq-product-brand' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'price_color', [ 'label' => __('Price Color', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#2ecc71', 'selectors' => [ '{{WRAPPER}} .cannaiq-product-price' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'price_typography', 'label' => __('Price Typography', 'cannaiq-menus'), 'selector' => '{{WRAPPER}} .cannaiq-product-price', ] ); $this->end_controls_section(); // Style Section - Badges $this->start_controls_section( 'section_style_badges', [ 'label' => __('Badges', 'cannaiq-menus'), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'strain_sativa_color', [ 'label' => __('Sativa Badge Color', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#f39c12', ] ); $this->add_control( 'strain_indica_color', [ 'label' => __('Indica Badge Color', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#9b59b6', ] ); $this->add_control( 'strain_hybrid_color', [ 'label' => __('Hybrid Badge Color', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#2ecc71', ] ); $this->add_control( 'sale_badge_color', [ 'label' => __('Sale Badge Background', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#e74c3c', 'selectors' => [ '{{WRAPPER}} .cannaiq-sale-badge' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'effect_badge_background', [ 'label' => __('Effect Badge Background', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#f0f0f0', 'selectors' => [ '{{WRAPPER}} .cannaiq-effect-badge' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_section(); } protected function render() { $settings = $this->get_settings_for_display(); $products = $this->fetch_products($settings); if (empty($products)) { echo '
' . __('No products found.', 'cannaiq-menus') . '
'; return; } $layout_class = 'cannaiq-product-loop-' . $settings['layout']; ?>