PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 3.4.1
ShopBuilder – WooCommerce Builder For Elementor v3.4.1
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 / templates / elementor / archive / catalog-ordering.php

catalog-ordering.php in ShopBuilder – WooCommerce Builder For Elementor 3.4.1, at templates/elementor/archive/catalog-ordering.php

67 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Template variables:
4 *
5 * @var $controllers array Widgets/Addons Settings
6 */
7
8 use RadiusTheme\SB\Helpers\Fns;
9
10 // Do not allow directly accessing this file.
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit( 'This script cannot be accessed directly.' );
13 }
14
15 $ajax_filter = Fns::product_filters_has_ajax( apply_filters( 'rtsb/builder/set/current/page/type', '' ) );
16 $class = rtsb()->has_pro() && $ajax_filter ? ' has-ajax-filter' : ' no-ajax-filter';
17 ?>
18 <div class="rtsb-archive-catalog-ordering<?php echo esc_attr( $class ); ?>">
19 <?php
20
21 $show_default_orderby = 'menu_order' === apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby', 'menu_order' ) );
22 // phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
23 $catalog_orderby_options = apply_filters(
24 'woocommerce_catalog_orderby',
25 [
26 'menu_order' => __( 'Default sorting', 'shopbuilder' ),
27 'popularity' => __( 'Sort by popularity', 'shopbuilder' ),
28 'rating' => __( 'Sort by average rating', 'shopbuilder' ),
29 'date' => __( 'Sort by latest', 'shopbuilder' ),
30 'price' => __( 'Sort by price: low to high', 'shopbuilder' ),
31 'price-desc' => __( 'Sort by price: high to low', 'shopbuilder' ),
32 ]
33 );
34 $default_orderby = wc_get_loop_prop( 'is_search' ) ? 'relevance' : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby', '' ) );
35 // phpcs:disable
36 $orderby = isset( $_GET['orderby'] ) ? wc_clean( wp_unslash( $_GET['orderby'] ) ) : $default_orderby;
37 // phpcs:enable
38 if ( wc_get_loop_prop( 'is_search' ) ) {
39 $catalog_orderby_options = array_merge( [ 'relevance' => __( 'Relevance', 'shopbuilder' ) ], $catalog_orderby_options );
40
41 unset( $catalog_orderby_options['menu_order'] );
42 }
43
44 if ( ! $show_default_orderby ) {
45 unset( $catalog_orderby_options['menu_order'] );
46 }
47
48 if ( ! wc_review_ratings_enabled() ) {
49 unset( $catalog_orderby_options['rating'] );
50 }
51
52 if ( ! array_key_exists( $orderby, $catalog_orderby_options ) ) {
53 $orderby = current( array_keys( $catalog_orderby_options ) );
54 }
55
56 wc_get_template(
57 'loop/orderby.php',
58 [
59 'catalog_orderby_options' => $catalog_orderby_options,
60 'orderby' => $orderby,
61 'show_default_orderby' => $show_default_orderby,
62 'use_label' => false,
63 ]
64 );
65 ?>
66 </div>
67