PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.2.0
ShopBuilder – WooCommerce Builder For Elementor v2.2.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 / templates / elementor / archive / catalog-ordering.php

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

60 lines 2.0 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 $show_default_orderby = 'menu_order' === apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby', 'menu_order' ) );
21 $catalog_orderby_options = apply_filters(
22 'woocommerce_catalog_orderby',
23 [
24 'menu_order' => __( 'Default sorting', 'shopbuilder' ),
25 'popularity' => __( 'Sort by popularity', 'shopbuilder' ),
26 'rating' => __( 'Sort by average rating', 'shopbuilder' ),
27 'date' => __( 'Sort by latest', 'shopbuilder' ),
28 'price' => __( 'Sort by price: low to high', 'shopbuilder' ),
29 'price-desc' => __( 'Sort by price: high to low', 'shopbuilder' ),
30 ]
31 );
32
33 $default_orderby = apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby', '' ) );
34 // phpcs:disable WordPress.Security.NonceVerification.Recommended
35 $orderby = isset( $_GET['orderby'] ) ? wc_clean( wp_unslash( $_GET['orderby'] ) ) : $default_orderby;
36 // phpcs:enable WordPress.Security.NonceVerification.Recommended
37
38 if ( ! $show_default_orderby ) {
39 unset( $catalog_orderby_options['menu_order'] );
40 }
41
42 if ( ! wc_review_ratings_enabled() ) {
43 unset( $catalog_orderby_options['rating'] );
44 }
45
46 if ( ! array_key_exists( $orderby, $catalog_orderby_options ) ) {
47 $orderby = current( array_keys( $catalog_orderby_options ) );
48 }
49
50 wc_get_template(
51 'loop/orderby.php',
52 [
53 'catalog_orderby_options' => $catalog_orderby_options,
54 'orderby' => $orderby,
55 'show_default_orderby' => $show_default_orderby,
56 ]
57 );
58 ?>
59 </div>
60