theme-elements
6 years ago
accordion.php
6 years ago
audio.php
6 years ago
before-after.php
6 years ago
button.php
6 years ago
carousel-navigation.php
6 years ago
contact-box.php
6 years ago
contact-form.php
6 years ago
custom-list.php
6 years ago
divider.php
6 years ago
gallery.php
6 years ago
gmap.php
6 years ago
heading-modern.php
6 years ago
icon.php
6 years ago
image.php
6 years ago
mailchimp.php
6 years ago
modern-button.php
6 years ago
quote.php
6 years ago
recent-comments.php
6 years ago
recent-posts-grid-carousel.php
6 years ago
recent-posts-land-style.php
6 years ago
recent-posts-masonry.php
6 years ago
recent-posts-tiles-carousel.php
6 years ago
recent-posts-tiles.php
6 years ago
recent-posts-timeline.php
6 years ago
recent-products.php
6 years ago
search.php
6 years ago
staff.php
6 years ago
svg.php
6 years ago
tabs.php
6 years ago
testimonial.php
6 years ago
text.php
6 years ago
touch-slider.php
6 years ago
video.php
6 years ago
recent-products.php
761 lines
| 1 | <?php |
| 2 | namespace Auxin\Plugin\CoreElements\Elementor\Elements; |
| 3 | |
| 4 | use Elementor\Plugin; |
| 5 | use Elementor\Widget_Base; |
| 6 | use Elementor\Controls_Manager; |
| 7 | use Elementor\Group_Control_Typography; |
| 8 | use Elementor\Scheme_Typography; |
| 9 | |
| 10 | |
| 11 | if ( ! defined( 'ABSPATH' ) ) { |
| 12 | exit; // Exit if accessed directly. |
| 13 | } |
| 14 | |
| 15 | /** |
| 16 | * Elementor 'RecentProducts' widget. |
| 17 | * |
| 18 | * Elementor widget that displays an 'RecentProducts' with lightbox. |
| 19 | * |
| 20 | * @since 1.0.0 |
| 21 | */ |
| 22 | class RecentProducts extends Widget_Base { |
| 23 | |
| 24 | /** |
| 25 | * Get widget name. |
| 26 | * |
| 27 | * Retrieve 'RecentProducts' widget name. |
| 28 | * |
| 29 | * @since 1.0.0 |
| 30 | * @access public |
| 31 | * |
| 32 | * @return string Widget name. |
| 33 | */ |
| 34 | public function get_name() { |
| 35 | return 'aux_recent_product'; |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * Get widget title. |
| 40 | * |
| 41 | * Retrieve 'RecentProducts' widget title. |
| 42 | * |
| 43 | * @since 1.0.0 |
| 44 | * @access public |
| 45 | * |
| 46 | * @return string Widget title. |
| 47 | */ |
| 48 | public function get_title() { |
| 49 | return __('Recent Products', 'auxin-elements' ); |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Get widget icon. |
| 54 | * |
| 55 | * Retrieve 'RecentProducts' widget icon. |
| 56 | * |
| 57 | * @since 1.0.0 |
| 58 | * @access public |
| 59 | * |
| 60 | * @return string Widget icon. |
| 61 | */ |
| 62 | public function get_icon() { |
| 63 | return 'eicon-woocommerce auxin-badge'; |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Get widget categories. |
| 68 | * |
| 69 | * Retrieve 'RecentProducts' widget icon. |
| 70 | * |
| 71 | * @since 1.0.0 |
| 72 | * @access public |
| 73 | * |
| 74 | * @return string Widget icon. |
| 75 | */ |
| 76 | public function get_categories() { |
| 77 | return array( 'auxin-dynamic' ); |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * Retrieve the terms in a given taxonomy or list of taxonomies. |
| 82 | * |
| 83 | * Retrieve 'RecentProducts' widget icon. |
| 84 | * |
| 85 | * @since 1.0.0 |
| 86 | * @access public |
| 87 | * |
| 88 | * @return string Widget icon. |
| 89 | */ |
| 90 | public function get_terms() { |
| 91 | // Get terms |
| 92 | $terms = get_terms( |
| 93 | array( |
| 94 | 'taxonomy' => 'product_cat', |
| 95 | 'orderby' => 'count', |
| 96 | 'hide_empty' => true |
| 97 | ) |
| 98 | ); |
| 99 | |
| 100 | // Then create a list |
| 101 | $list = array( ' ' => __('All Categories', 'auxin-elements' ) ) ; |
| 102 | |
| 103 | if ( ! is_wp_error( $terms ) && is_array( $terms ) ){ |
| 104 | foreach ( $terms as $key => $value ) { |
| 105 | $list[$value->term_id] = $value->name; |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | return $list; |
| 110 | } |
| 111 | |
| 112 | /** |
| 113 | * Register 'RecentProducts' widget controls. |
| 114 | * |
| 115 | * Adds different input fields to allow the user to change and customize the widget settings. |
| 116 | * |
| 117 | * @since 1.0.0 |
| 118 | * @access protected |
| 119 | */ |
| 120 | protected function _register_controls() { |
| 121 | |
| 122 | /*-----------------------------------------------------------------------------------*/ |
| 123 | /* layout_section |
| 124 | /*-----------------------------------------------------------------------------------*/ |
| 125 | |
| 126 | $this->start_controls_section( |
| 127 | 'layout_section', |
| 128 | array( |
| 129 | 'label' => __('Layout', 'auxin-elements' ), |
| 130 | 'tab' => Controls_Manager::TAB_LAYOUT |
| 131 | ) |
| 132 | ); |
| 133 | |
| 134 | $this->add_responsive_control( |
| 135 | 'columns', |
| 136 | array( |
| 137 | 'label' => __( 'Columns', 'auxin-elements' ), |
| 138 | 'type' => Controls_Manager::SELECT, |
| 139 | 'default' => '4', |
| 140 | 'tablet_default' => 'inherit', |
| 141 | 'mobile_default' => '1', |
| 142 | 'options' => array( |
| 143 | 'inherit' => __( 'Inherited from larger', 'auxin-elements' ), |
| 144 | '1' => '1', |
| 145 | '2' => '2', |
| 146 | '3' => '3', |
| 147 | '4' => '4', |
| 148 | '5' => '5', |
| 149 | '6' => '6' |
| 150 | ), |
| 151 | 'frontend_available' => true, |
| 152 | ) |
| 153 | ); |
| 154 | |
| 155 | // $this->add_control( |
| 156 | // 'content_layout', |
| 157 | // array( |
| 158 | // 'label' => __('Content layout', 'auxin-elements'), |
| 159 | // 'type' => Controls_Manager::SELECT, |
| 160 | // 'default' => 'default', |
| 161 | // 'options' => array( |
| 162 | // 'default' => __('Full Content', 'auxin-elements'), |
| 163 | // 'entry-boxed' => __('Boxed Content', 'auxin-elements') |
| 164 | // ) |
| 165 | // ) |
| 166 | // ); |
| 167 | |
| 168 | $this->end_controls_section(); |
| 169 | |
| 170 | /*-----------------------------------------------------------------------------------*/ |
| 171 | /* display_section |
| 172 | /*-----------------------------------------------------------------------------------*/ |
| 173 | |
| 174 | $this->start_controls_section( |
| 175 | 'display_section', |
| 176 | array( |
| 177 | 'label' => __('Display', 'auxin-elements' ), |
| 178 | 'tab' => Controls_Manager::TAB_LAYOUT |
| 179 | ) |
| 180 | ); |
| 181 | |
| 182 | $this->add_control( |
| 183 | 'display_price', |
| 184 | array( |
| 185 | 'label' => __('Display products price','auxin-elements' ), |
| 186 | 'type' => Controls_Manager::SWITCHER, |
| 187 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 188 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 189 | 'return_value' => 'yes', |
| 190 | 'default' => 'yes' |
| 191 | ) |
| 192 | ); |
| 193 | |
| 194 | $this->add_control( |
| 195 | 'display_sale_badge', |
| 196 | array( |
| 197 | 'label' => __('Display sale badge','auxin-elements' ), |
| 198 | 'type' => Controls_Manager::SWITCHER, |
| 199 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 200 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 201 | 'return_value' => 'yes', |
| 202 | 'default' => 'yes' |
| 203 | ) |
| 204 | ); |
| 205 | |
| 206 | $this->add_control( |
| 207 | 'show_media', |
| 208 | array( |
| 209 | 'label' => __('Display post media (image, video, etc)','auxin-elements' ), |
| 210 | 'label_block' => true, |
| 211 | 'type' => Controls_Manager::SWITCHER, |
| 212 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 213 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 214 | 'return_value' => 'yes', |
| 215 | 'default' => 'yes', |
| 216 | 'label_block' => true |
| 217 | ) |
| 218 | ); |
| 219 | |
| 220 | |
| 221 | $this->add_control( |
| 222 | 'preloadable', |
| 223 | array( |
| 224 | 'label' => __('Preload image','auxin-elements' ), |
| 225 | 'type' => Controls_Manager::SWITCHER, |
| 226 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 227 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 228 | 'return_value' => 'yes', |
| 229 | 'default' => 'no', |
| 230 | 'condition' => array( |
| 231 | 'show_media' => 'yes', |
| 232 | ) |
| 233 | ) |
| 234 | ); |
| 235 | |
| 236 | $this->add_control( |
| 237 | 'preload_preview', |
| 238 | array( |
| 239 | 'label' => __('While loading image display','auxin-elements' ), |
| 240 | 'label_block' => true, |
| 241 | 'type' => Controls_Manager::SELECT, |
| 242 | 'options' => auxin_get_preloadable_previews(), |
| 243 | 'return_value' => 'yes', |
| 244 | 'default' => 'yes', |
| 245 | 'condition' => array( |
| 246 | 'preloadable' => 'yes' |
| 247 | ) |
| 248 | ) |
| 249 | ); |
| 250 | |
| 251 | $this->add_control( |
| 252 | 'preload_bgcolor', |
| 253 | array( |
| 254 | 'label' => __( 'Placeholder color while loading image', 'auxin-elements' ), |
| 255 | 'type' => Controls_Manager::COLOR, |
| 256 | 'condition' => array( |
| 257 | 'preloadable' => 'yes', |
| 258 | 'preload_preview' => array('simple-spinner', 'simple-spinner-light', 'simple-spinner-dark') |
| 259 | ) |
| 260 | ) |
| 261 | ); |
| 262 | |
| 263 | $this->add_control( |
| 264 | 'display_title', |
| 265 | array( |
| 266 | 'label' => __('Display product title', 'auxin-elements' ), |
| 267 | 'type' => Controls_Manager::SWITCHER, |
| 268 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 269 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 270 | 'return_value' => 'yes', |
| 271 | 'default' => 'yes' |
| 272 | ) |
| 273 | ); |
| 274 | |
| 275 | $this->add_control( |
| 276 | 'display_categories', |
| 277 | array( |
| 278 | 'label' => __('Display Categories','auxin-elements' ), |
| 279 | 'type' => Controls_Manager::SWITCHER, |
| 280 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 281 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 282 | 'return_value' => 'yes', |
| 283 | 'default' => 'yes' |
| 284 | ) |
| 285 | ); |
| 286 | |
| 287 | $this->add_control( |
| 288 | 'display_button', |
| 289 | array( |
| 290 | 'label' => __('Display Add To Cart','auxin-elements' ), |
| 291 | 'type' => Controls_Manager::SWITCHER, |
| 292 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 293 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 294 | 'return_value' => 'yes', |
| 295 | 'default' => 'yes' |
| 296 | ) |
| 297 | ); |
| 298 | |
| 299 | $this->end_controls_section(); |
| 300 | |
| 301 | /*-----------------------------------------------------------------------------------*/ |
| 302 | /* query_section |
| 303 | /*-----------------------------------------------------------------------------------*/ |
| 304 | |
| 305 | $this->start_controls_section( |
| 306 | 'query_section', |
| 307 | array( |
| 308 | 'label' => __('Query', 'auxin-elements' ), |
| 309 | ) |
| 310 | ); |
| 311 | |
| 312 | $this->add_control( |
| 313 | 'cat', |
| 314 | array( |
| 315 | 'label' => __('Categories', 'auxin-elements'), |
| 316 | 'description' => __('Specifies a category that you want to show posts from it.', 'auxin-elements' ), |
| 317 | 'type' => Controls_Manager::SELECT2, |
| 318 | 'multiple' => true, |
| 319 | 'options' => $this->get_terms(), |
| 320 | 'default' => array( ' ' ), |
| 321 | ) |
| 322 | ); |
| 323 | |
| 324 | $this->add_control( |
| 325 | 'num', |
| 326 | array( |
| 327 | 'label' => __('Number of posts to show', 'auxin-elements'), |
| 328 | 'label_block' => true, |
| 329 | 'type' => Controls_Manager::NUMBER, |
| 330 | 'default' => '8', |
| 331 | 'min' => 1, |
| 332 | 'step' => 1 |
| 333 | ) |
| 334 | ); |
| 335 | |
| 336 | $this->add_control( |
| 337 | 'exclude_without_media', |
| 338 | array( |
| 339 | 'label' => __('Exclude posts without media','auxin-elements' ), |
| 340 | 'type' => Controls_Manager::SWITCHER, |
| 341 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 342 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 343 | 'return_value' => 'yes', |
| 344 | 'default' => 'no' |
| 345 | ) |
| 346 | ); |
| 347 | |
| 348 | $this->add_control( |
| 349 | 'exclude_custom_post_formats', |
| 350 | array( |
| 351 | 'label' => __('Exclude custom post formats','auxin-elements' ), |
| 352 | 'type' => Controls_Manager::SWITCHER, |
| 353 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 354 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 355 | 'return_value' => 'yes', |
| 356 | 'default' => 'no', |
| 357 | ) |
| 358 | ); |
| 359 | |
| 360 | $this->add_control( |
| 361 | 'exclude_quote_link', |
| 362 | array( |
| 363 | 'label' => __('Exclude quote and link post formats','auxin-elements' ), |
| 364 | 'type' => Controls_Manager::SWITCHER, |
| 365 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 366 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 367 | 'return_value' => 'yes', |
| 368 | 'default' => 'no', |
| 369 | 'condition' => array( |
| 370 | 'exclude_custom_post_formats' => 'yes', |
| 371 | ) |
| 372 | ) |
| 373 | ); |
| 374 | |
| 375 | $this->add_control( |
| 376 | 'order_by', |
| 377 | array( |
| 378 | 'label' => __('Order by', 'auxin-elements'), |
| 379 | 'type' => Controls_Manager::SELECT, |
| 380 | 'default' => 'date', |
| 381 | 'options' => array( |
| 382 | 'date' => __('Date', 'auxin-elements'), |
| 383 | 'menu_order date' => __('Menu Order', 'auxin-elements'), |
| 384 | 'title' => __('Title', 'auxin-elements'), |
| 385 | 'ID' => __('ID', 'auxin-elements'), |
| 386 | 'rand' => __('Random', 'auxin-elements'), |
| 387 | 'comment_count' => __('Comments', 'auxin-elements'), |
| 388 | 'modified' => __('Date Modified', 'auxin-elements'), |
| 389 | 'author' => __('Author', 'auxin-elements'), |
| 390 | 'post__in' => __('Inserted Post IDs', 'auxin-elements') |
| 391 | ), |
| 392 | ) |
| 393 | ); |
| 394 | |
| 395 | $this->add_control( |
| 396 | 'order', |
| 397 | array( |
| 398 | 'label' => __('Order', 'auxin-elements'), |
| 399 | 'type' => Controls_Manager::SELECT, |
| 400 | 'default' => 'DESC', |
| 401 | 'options' => array( |
| 402 | 'DESC' => __('Descending', 'auxin-elements'), |
| 403 | 'ASC' => __('Ascending', 'auxin-elements'), |
| 404 | ), |
| 405 | ) |
| 406 | ); |
| 407 | |
| 408 | $this->add_control( |
| 409 | 'only_products__in', |
| 410 | array( |
| 411 | 'label' => __('Only products','auxin-elements' ), |
| 412 | 'description' => __('If you intend to display ONLY specific products, you should specify the products here. You have to insert the Products IDs that are separated by comma (eg. 53,34,87,25).', 'auxin-elements' ), |
| 413 | 'type' => Controls_Manager::TEXT |
| 414 | ) |
| 415 | ); |
| 416 | |
| 417 | $this->add_control( |
| 418 | 'include', |
| 419 | array( |
| 420 | 'label' => __('Include products','auxin-elements' ), |
| 421 | 'description' => __('If you intend to include additional products, you should specify the products here. You have to insert the Products IDs that are separated by comma (eg. 53,34,87,25)', 'auxin-elements' ), |
| 422 | 'type' => Controls_Manager::TEXT |
| 423 | ) |
| 424 | ); |
| 425 | |
| 426 | $this->add_control( |
| 427 | 'exclude', |
| 428 | array( |
| 429 | 'label' => __('Exclude products','auxin-elements' ), |
| 430 | 'description' => __('If you intend to exclude specific products from result, you should specify the products here. You have to insert the Products IDs that are separated by comma (eg. 53,34,87,25)', 'auxin-elements' ), |
| 431 | 'type' => Controls_Manager::TEXT |
| 432 | ) |
| 433 | ); |
| 434 | |
| 435 | $this->add_control( |
| 436 | 'offset', |
| 437 | array( |
| 438 | 'label' => __('Start offset','auxin-elements' ), |
| 439 | 'description' => __('Number of post to displace or pass over.', 'auxin-elements' ), |
| 440 | 'type' => Controls_Manager::NUMBER |
| 441 | ) |
| 442 | ); |
| 443 | |
| 444 | $this->end_controls_section(); |
| 445 | |
| 446 | /*-----------------------------------------------------------------------------------*/ |
| 447 | /* paginate_section |
| 448 | /*-----------------------------------------------------------------------------------*/ |
| 449 | |
| 450 | // $this->start_controls_section( |
| 451 | // 'paginate_section', |
| 452 | // array( |
| 453 | // 'label' => __('Paginate', 'auxin-elements' ), |
| 454 | // ) |
| 455 | // ); |
| 456 | |
| 457 | // $this->add_control( |
| 458 | // 'loadmore_type', |
| 459 | // array( |
| 460 | // 'label' => __('Load More Type','auxin-elements' ), |
| 461 | // 'type' => 'aux-visual-select', |
| 462 | // 'options' => array( |
| 463 | // '' => array( |
| 464 | // 'label' => __('None', 'auxin-elements' ), |
| 465 | // 'image' => AUXIN_URL . 'images/visual-select/load-more-none.svg' |
| 466 | // ), |
| 467 | // 'scroll' => array( |
| 468 | // 'label' => __('Infinite Scroll', 'auxin-elements' ), |
| 469 | // 'image' => AUXIN_URL . 'images/visual-select/load-more-infinite.svg' |
| 470 | // ), |
| 471 | // 'next' => array( |
| 472 | // 'label' => __('Next Button', 'auxin-elements' ), |
| 473 | // 'image' => AUXIN_URL . 'images/visual-select/load-more-button.svg' |
| 474 | // ), |
| 475 | // 'next-prev' => array( |
| 476 | // 'label' => __('Next Prev', 'auxin-elements' ), |
| 477 | // 'image' => AUXIN_URL . 'images/visual-select/load-more-next-prev.svg' |
| 478 | // ) |
| 479 | // ), |
| 480 | // 'default' => 'scroll' |
| 481 | // ) |
| 482 | // ); |
| 483 | |
| 484 | // $this->end_controls_section(); |
| 485 | |
| 486 | /*-----------------------------------------------------------------------------------*/ |
| 487 | /* image_style_section |
| 488 | /*-----------------------------------------------------------------------------------*/ |
| 489 | |
| 490 | $this->start_controls_section( |
| 491 | 'image_style_section', |
| 492 | array( |
| 493 | 'label' => __( 'Image', 'auxin-elements' ), |
| 494 | 'tab' => Controls_Manager::TAB_STYLE, |
| 495 | 'condition' => array( |
| 496 | 'show_media' => 'yes', |
| 497 | ), |
| 498 | ) |
| 499 | ); |
| 500 | |
| 501 | $this->add_control( |
| 502 | 'image_aspect_ratio', |
| 503 | array( |
| 504 | 'label' => __('Image aspect ratio', 'auxin-elements'), |
| 505 | 'type' => Controls_Manager::SELECT, |
| 506 | 'default' => '0.75', |
| 507 | 'options' => array( |
| 508 | '0.75' => __('Horizontal 4:3' , 'auxin-elements'), |
| 509 | '0.56' => __('Horizontal 16:9', 'auxin-elements'), |
| 510 | '1.00' => __('Square 1:1' , 'auxin-elements'), |
| 511 | '1.33' => __('Vertical 3:4' , 'auxin-elements') |
| 512 | ), |
| 513 | 'condition' => array( |
| 514 | 'show_media' => 'yes', |
| 515 | ), |
| 516 | ) |
| 517 | ); |
| 518 | |
| 519 | $this->add_control( |
| 520 | 'img_border_radius', |
| 521 | array( |
| 522 | 'label' => __( 'Border Radius', 'auxin-elements' ), |
| 523 | 'type' => Controls_Manager::DIMENSIONS, |
| 524 | 'size_units' => array( 'px', '%' ), |
| 525 | 'selectors' => array( |
| 526 | '{{WRAPPER}} .aux-media-frame img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 527 | ), |
| 528 | 'condition' => array( |
| 529 | 'show_media' => 'yes', |
| 530 | ), |
| 531 | ) |
| 532 | ); |
| 533 | |
| 534 | $this->end_controls_section(); |
| 535 | |
| 536 | /*-----------------------------------------------------------------------------------*/ |
| 537 | /* title_style_section |
| 538 | /*-----------------------------------------------------------------------------------*/ |
| 539 | |
| 540 | $this->start_controls_section( |
| 541 | 'title_style_section', |
| 542 | array( |
| 543 | 'label' => __( 'Title', 'auxin-elements' ), |
| 544 | 'tab' => Controls_Manager::TAB_STYLE, |
| 545 | 'condition' => array( |
| 546 | 'display_title' => 'yes', |
| 547 | ), |
| 548 | ) |
| 549 | ); |
| 550 | |
| 551 | $this->add_control( |
| 552 | 'title_color', |
| 553 | array( |
| 554 | 'label' => __( 'Color', 'auxin-elements' ), |
| 555 | 'type' => Controls_Manager::COLOR, |
| 556 | 'selectors' => array( |
| 557 | '{{WRAPPER}} .woocommerce-loop-product__title' => 'color: {{VALUE}};', |
| 558 | ), |
| 559 | 'condition' => array( |
| 560 | 'display_title' => 'yes', |
| 561 | ), |
| 562 | ) |
| 563 | ); |
| 564 | |
| 565 | $this->add_group_control( |
| 566 | Group_Control_Typography::get_type(), |
| 567 | array( |
| 568 | 'name' => 'title_typography', |
| 569 | 'scheme' => Scheme_Typography::TYPOGRAPHY_1, |
| 570 | 'selector' => '{{WRAPPER}} .woocommerce-loop-product__title', |
| 571 | 'condition' => array( |
| 572 | 'display_title' => 'yes', |
| 573 | ), |
| 574 | ) |
| 575 | ); |
| 576 | |
| 577 | $this->add_responsive_control( |
| 578 | 'title_margin_bottom', |
| 579 | array( |
| 580 | 'label' => __( 'Spacing', 'auxin-elements' ), |
| 581 | 'type' => Controls_Manager::SLIDER, |
| 582 | 'range' => array( |
| 583 | 'px' => array( |
| 584 | 'max' => 100, |
| 585 | ), |
| 586 | ), |
| 587 | 'selectors' => array( |
| 588 | '{{WRAPPER}} .woocommerce-loop-product__title' => 'margin-bottom: {{SIZE}}{{UNIT}};', |
| 589 | ), |
| 590 | 'condition' => array( |
| 591 | 'display_title' => 'yes', |
| 592 | ), |
| 593 | ) |
| 594 | ); |
| 595 | |
| 596 | $this->end_controls_section(); |
| 597 | |
| 598 | /*-----------------------------------------------------------------------------------*/ |
| 599 | /* category_style_section |
| 600 | /*-----------------------------------------------------------------------------------*/ |
| 601 | |
| 602 | $this->start_controls_section( |
| 603 | 'category_style_section', |
| 604 | array( |
| 605 | 'label' => __( 'Category', 'auxin-elements' ), |
| 606 | 'tab' => Controls_Manager::TAB_STYLE, |
| 607 | 'condition' => array( |
| 608 | 'display_categories' => 'yes', |
| 609 | ), |
| 610 | ) |
| 611 | ); |
| 612 | |
| 613 | $this->start_controls_tabs( 'category_colors' ); |
| 614 | |
| 615 | $this->start_controls_tab( |
| 616 | 'category_color_normal', |
| 617 | array( |
| 618 | 'label' => __( 'Normal' , 'auxin-elements' ), |
| 619 | 'condition' => array( |
| 620 | 'display_categories' => 'yes', |
| 621 | ), |
| 622 | ) |
| 623 | ); |
| 624 | |
| 625 | $this->add_control( |
| 626 | 'category_color', |
| 627 | array( |
| 628 | 'label' => __( 'Color', 'auxin-elements' ), |
| 629 | 'type' => Controls_Manager::COLOR, |
| 630 | 'selectors' => array( |
| 631 | '{{WRAPPER}} .auxshp-meta-terms a, {{WRAPPER}} .auxshp-meta-terms' => 'color: {{VALUE}};', |
| 632 | ), |
| 633 | 'condition' => array( |
| 634 | 'display_categories' => 'yes', |
| 635 | ), |
| 636 | ) |
| 637 | ); |
| 638 | |
| 639 | $this->end_controls_tab(); |
| 640 | |
| 641 | $this->start_controls_tab( |
| 642 | 'category_color_hover', |
| 643 | array( |
| 644 | 'label' => __( 'Hover' , 'auxin-elements' ), |
| 645 | 'condition' => array( |
| 646 | 'display_categories' => 'yes', |
| 647 | ), |
| 648 | ) |
| 649 | ); |
| 650 | |
| 651 | $this->add_control( |
| 652 | 'category_hover_color', |
| 653 | array( |
| 654 | 'label' => __( 'Color', 'auxin-elements' ), |
| 655 | 'type' => Controls_Manager::COLOR, |
| 656 | 'selectors' => array( |
| 657 | '{{WRAPPER}} .auxshp-meta-terms a:hover' => 'color: {{VALUE}};', |
| 658 | ), |
| 659 | 'condition' => array( |
| 660 | 'display_categories' => 'yes', |
| 661 | ), |
| 662 | ) |
| 663 | ); |
| 664 | |
| 665 | $this->end_controls_tab(); |
| 666 | |
| 667 | $this->end_controls_tabs(); |
| 668 | |
| 669 | $this->add_group_control( |
| 670 | Group_Control_Typography::get_type(), |
| 671 | array( |
| 672 | 'name' => 'category_typography', |
| 673 | 'scheme' => Scheme_Typography::TYPOGRAPHY_1, |
| 674 | 'selector' => '{{WRAPPER}} .auxshp-meta-terms, {{WRAPPER}} .auxshp-meta-terms a', |
| 675 | 'condition' => array( |
| 676 | 'display_categories' => 'yes', |
| 677 | ), |
| 678 | ) |
| 679 | ); |
| 680 | |
| 681 | $this->add_responsive_control( |
| 682 | 'category_margin_bottom', |
| 683 | array( |
| 684 | 'label' => __( 'Bottom space', 'auxin-elements' ), |
| 685 | 'type' => Controls_Manager::SLIDER, |
| 686 | 'range' => array( |
| 687 | 'px' => array( |
| 688 | 'max' => 100, |
| 689 | ), |
| 690 | ), |
| 691 | 'selectors' => array( |
| 692 | '{{WRAPPER}} .product_meta' => 'margin-bottom: {{SIZE}}{{UNIT}};', |
| 693 | ), |
| 694 | 'condition' => array( |
| 695 | 'display_categories' => 'yes', |
| 696 | ), |
| 697 | ) |
| 698 | ); |
| 699 | |
| 700 | $this->end_controls_section(); |
| 701 | } |
| 702 | |
| 703 | /** |
| 704 | * Render image box widget output on the frontend. |
| 705 | * |
| 706 | * Written in PHP and used to generate the final HTML. |
| 707 | * |
| 708 | * @since 1.0.0 |
| 709 | * @access protected |
| 710 | */ |
| 711 | protected function render() { |
| 712 | // Check whether required resources are available |
| 713 | if( ! auxin_is_plugin_active( 'woocommerce/woocommerce.php' ) ) { |
| 714 | auxin_elementor_plugin_missing_notice( array( 'plugin_name' => __( 'WooCommerce', 'auxin-elements' ) ) ); |
| 715 | return; |
| 716 | } |
| 717 | |
| 718 | $settings = $this->get_settings_for_display(); |
| 719 | |
| 720 | $args = array( |
| 721 | // Display Section |
| 722 | 'display_price' => $settings['display_price'], |
| 723 | 'display_sale_badge' => $settings['display_sale_badge'], |
| 724 | 'show_media' => $settings['show_media'], |
| 725 | 'preloadable' => $settings['preloadable'], |
| 726 | 'preload_preview' => $settings['preload_preview'], |
| 727 | 'preload_bgcolor' => $settings['preload_bgcolor'], |
| 728 | 'display_title' => $settings['display_title'], |
| 729 | 'display_categories' => $settings['display_categories'], |
| 730 | 'display_button' => $settings['display_button'], |
| 731 | |
| 732 | // Layout Section |
| 733 | 'desktop_cnum' => $settings['columns'], |
| 734 | 'tablet_cnum' => $settings['columns_tablet'], |
| 735 | 'phone_cnum' => $settings['columns_mobile'], |
| 736 | // 'content_layout' => $settings['content_layout'], |
| 737 | |
| 738 | |
| 739 | // Query Section |
| 740 | 'cat' => $settings['cat'], |
| 741 | 'num' => $settings['num'], |
| 742 | 'exclude_without_media' => $settings['exclude_without_media'], |
| 743 | 'exclude_custom_post_formats' => $settings['exclude_custom_post_formats'], |
| 744 | 'exclude_quote_link' => $settings['exclude_quote_link'], |
| 745 | 'order_by' => $settings['order_by'], |
| 746 | 'order' => $settings['order'], |
| 747 | 'only_products__in' => $settings['only_products__in'], |
| 748 | 'include' => $settings['include'], |
| 749 | 'exclude' => $settings['exclude'], |
| 750 | 'offset' => $settings['offset'], |
| 751 | |
| 752 | // Style Section |
| 753 | 'image_aspect_ratio' => $settings['image_aspect_ratio'], |
| 754 | ); |
| 755 | |
| 756 | // get the shortcode base blog page |
| 757 | echo auxin_widget_the_recent_products_callback( $args ); |
| 758 | } |
| 759 | |
| 760 | } |
| 761 |