For Users

Installation

First way to install plugin:

  1. Download plugin from your BeRocket account
  2. Open your site admin panel and go to Plugins -> Add New -> Upload Plugin
  3. Click Browse and select downloaded zip file and click Install Now
  4. Click Activate Plugin

 

Second way to install plugin:  

  1. Download plugin from your BeRocket account
  2. Open your site via FTP
  3. Go to WordPress folder/wp-content/plugins
  4. Extract files from downloaded zip file and copy extracted folders to plugins folder
  5. Open your site admin panel and go to Plugins
  6. Find WooCommerce AJAX Products Filter and click Activate under it

Setup

Add Filters

  • Open your site admin panel and go to Appearance -> Widgets
  • Find and add AJAX Product Filters to widget area that you want
  • Select attributes and options that you need
  • Click Save button

Compatibility With Theme

If you use theme with components that different from components on standard theme, that can cause some problems after products filtering. You can fix this problem yourself.

  1. Open admin panel of your site and go to WooCommerce -> Product Filters
  2. For fix problem you need to set right next fields Products selector, Product count selector, Product order by selector and Products pagination selector
  3. By default that used:
    • Products selector: ul.products
    • Product count selector: .woocommerce-result-count
    • Product order by selector: form.woocommerce-ordering
    • Products pagination selector: .woocommerce-pagination
  4. What value you need to set you can see at shop page via page inspector of your browser (If you do not know how to do it, then ask the author's themes)

Account/Product Key

BeRocket Account and Product key uses for auto update plugins from BeRocket site.

Where can you find Account Key?

  1. Open BeRocket site and Login (The Login button you can find in header menu)
  2. Go to My Account (The My Account button you can find in header menu)
  3. From right side on page you can find all information about your BeRocket account including Account Key

  4. You can click on account key and copy it
  5. What can you do with Account Key?

Where can you find Product Key?

  1. Open BeRocket site and Login (The Login button you can find in header menu)
  2. Go to My Account (The My Account button you can find in header menu)
  3. Click on key icon on right side from plugin name WooCommerce AJAX Products Filter

  4. You can click on Product key and copy it
  5. In left field you can type any notice for this key and click DONE to save
  6. What can you do with Product Key?

Settings

WooCommerce AJAX Products Filter have settings in different places

Main

Main settings are in Admin Panel -> WooCommerce -> Product Filters

This is all main settings of WooCommerce AJAX Products Filter plugin

General

Contains settings for customization links, page load and global widget display.

  • Plugin key - uses for updates plugin from BeRocket site. You can get this on BeRocket site -> My Account page on click key icon

    Where can you find Product Key (Plugin key)?

    For example: if you set right plugin key and press Test button

  • "No Products" message - this message uses only if Template ajax load fix disabled. If after filtering no products returns displays this message
  • Add position relative to products holder - fix products holder, to display load block only over products
  • "No Products" class - add custom class to "no products" block
  • Products selector - selector for tag that is holding products. Change this if after filtering products don't display or display incorrect. Don't change this if you don't know what it is
  • Product count selector - selector for tag with product result count("Showing 1–8 of 61 results"). Change this if after filtering product result didn't update. Don't change this if you don't know what it is
    • Remove product count - enable this if your theme doesn't have product count
  • Product order by selector - selector for order by form with drop down menu. Change this if after filtering order by drop down display twice or not display. Don't change this if you don't know what it is
    • Remove order by drop down menu - enable this if your theme doesn't have order by drop down menu
  • Products pagination selector - selector for tag that is pagination. Change this if after filtering pagination display twice or not display. Don't change this if you don't know what it is
    • Remove pagination - enable this if your theme doesn't have pagination
  • Sorting control - if disabled order by drop down didn't use ajax for sorting.
  • SEO friendly urls - change URLs after filtering and uses this link for open filtered products.
    • If this option is on url will be changed when filter is selected/changed - uses only GET query.

      For example: you set color blue and link will be http://wp-shop.example/shop/?filters=color[1]

    • Use slug in URL - by default filters uses id in URL. If you enable this option filters in URL will be use slug instead id. Don't use symbols '-', '_' and '+' in slug.

      For example: you set color blue and link will be http://wp-shop.example/shop/?filters=color[blue]

    • Nice URL - use permalinks instead GET query. You can change permalink style in WordPress permalinks settings.

      For example: you set color blue and link will be http://wp-shop.example/shop/filters/color/1/

  • Turn all filters off - If you want to hide filters without losing current configuration just turn them off
  • Show all values - Show attributes values without products
  • Hide values - hide attribute values without products or selected values
    • Hide values without products - values can be shown on click show values button on widgets. Works only if Show all values is enabled
    • Hide selected values - hide values on select or selected values. Values can be shown on click show values button on widgets

  • Jump to first page - if enabled load first page after filtering
  • Scroll page to the top - if enabled scroll page to the top of products. Also you can fix this scroll with setup amount of pixels from products top
  • Reload amount of products - if you use products count in widgets enable this to recount products after filtering
  • Show selected filters - if selected show selected filter above products
  • Data cache - caching widgets values for improve page load
    • Disable - don't use caching
    • WordPress Cache - using functions that WordPress have by default for caching values
    • Persistent Cache Plugins - using functions that uses caching plugins like W3 Total Cache
  • Template ajax load fix - if disabled plugin use standard WordPress AJAX functions. If enabled uses different products load style.

    If you disable this function products may load faster, but you theme must use WordPress and WooCommerce default templates.

    • PHP - better compatibilities with different themes, send to browser only needed informations
    • JavaScript (jQuery) - maximum compatibilities with different themes, send to browser full page
    • JavaScript - like PHP, but all manipulation with page doing on browser via JavaScript
  • Product per row fix - uses only if Template ajax load fix disabled. Fix products per row amount after filtering
  • Thousand Separator - Uses only in sliders with numbers.

    For example: if you set this  to ',', then 1000000 will be 1,000,000

  • Decimal Separator - Uses only in sliders with numbers.

    For example: if you set this  to '-', then 12.25 will be 12-25.

    Use different values for Thousand Separator and Decimal Separator

  • Number Of Decimal - number of digits after Decimal Separator.

    For example: if you set this  to '2', then 135 will be 135.00, but 12.1234 will be 12.12

Design

Contains settings for customization style of checkbox, buttons, text and sliders.

  • Widget Title - style of AJAX Products Filter widget title
  • Label(checkbox/radio) - attribute values style in checkbox and radio type of widget
  • Select-box - drop down menu style in select type of widget
  • Slider Inputs - style of text inside input that contains values in slider type of widget
  • Description Block - background color of description block in widget
  • Description Border - border color of description block in widget
  • Description Title Text - style of title text inside description in widget
  • Description Text - style of text inside description in widget
  • Selected filters area text - text style inside selected filters area that may be as widget or as block above products
  • Selected filters mouse over text - text style when mouse over selected filters inside selected filters area that may be as widgets or as block above products
  • Selected filters link background - buttons background color inside selected filters area
  • Selected filters link border - buttons border color inside selected filters area
  • Checkbox and Radio - style of chcekbox or radio icons in widgets

    Default Firefox checkbox and radio . Checkbox and radio if select Icon

    • Border color - line around icons
    • Border width - width of line around icons
    • Border radius - rounded corners of line around icons
    • Size - size of icons
    • Font color - color of icons
    • Background - background color of icons
    • Icon - if set to NONE style of icons is not used, else uses all styles and icons that selected
  • Slider - style of slider in widgets

    For example: you can set Button size and Button border width to 0 and set Line height to 18

    After that set Line color to #9999FF, Back line color to #BBBBBB and Line border width to 0

    • Line color - slider line selected section color
    • Back line color - slider line unselected section color
    • Line height - slider line height
    • Line border color - color of border around slider line
    • Line border width - width of border around slider line
    • Button size - size of buttons for sliders. You can set this to 0
    • Button color - color of buttons for sliders
    • Button border color - slider buttons border color
    • Button border width -  slider buttons border width. You can set this to 0
    • Button border radius - rounded corners of slider buttons. You can set this to 0
  • Loading products icon - icons that display on loading filtered products
  • Text at load icon - text that display with loading icon
    • Above - text above icon
    • Under - text under icon
    • Before - text before icon
    • After - text after icon

  • Description show and hide - what user need to do to show and to hide description
    • Show on - What user need to do to show description in widgets
      • Click - user need to click on icon to show description
      • Mouse over icon - user need to hover on icon to show description
    • Hide on - What user need to do to hide description in widgets
      • Click anywhere - user need to click at any place outside description
      • Mouse out of icon - user need to move cursor outside description and icon
  • Product count style - product count that display on left side from attribute values
    • First drop down menu to select how numbers will be displayed
    • Position - how far from values the numbers will be displayed
      • Normal - right after values
      • Right - on right side from values
      • Right from name - right after values with padding
JavaScript

Contains fields for custom users JavaScript code on different actions.

  • Before Update - before plugin update data from widgets and send to server
  • On Update - when server AJAX load answer from server. Access to the data returned via AJAX is variable global_ajax_data. To adds information to the AJAX data use berocket_ajax_response_without_fix hook if "Template ajax load fix" or uses PHP fixes or embed? to the page with other fixes.
  • After Update - after plugin place products on page
Custom CSS

Contains field for place user custom CSS to page

User custom CSS style - you can add to page any CSS styles

Definitions - variable that you can use inside User custom CSS style field

Shortcode

Contains a copy of widget AJAX Products Filter.

BeRocket Account

BeRocket account settings are in Admin Panel -> Settings -> BeRocket Account.

Contains field for place BeRocket Account Key

Where can you find Account Key?

  1. Copy Account Key from BeRocket site
  2. Paste this key to Account key field
  3. Press Test button
  4. If you use right Account Key you will see

  5. Then press Save button

Widget

The widget from plugin called AJAX Products Filter. You can place this widget tto any widget area like other widgets.

When you place widget it will be looks like this

With different settings will be available different options.

General settings

  • Widget Type - type of widget with different settings
    • Filter - widget for filtering products (main type of widget)
    • Update Products button - buttons for update widget after set the filters . When you place one or more Update Products button widget on page, filtering will not be started automatically after filters select
    • Selected Filters area - after filtering all selected filters will be displayed in this widget
    • Search Box - filters with search button that can be placed on any pages and will be redirect user to selected page
    Title - title displays above widget

Filter settings

  • Filter By - drop down menu that used to select values for filtering in widget
    • Attribute - attribute that you can set in Admin Panel -> Products -> Attributes
    • Stock status - filter in stock or out of stock products. Only works if you set show out of stock products
    • Product sub-categories - filtering by categories. Uses only sub-categories of selected category
    • Tag - filtering by products tag.
    • Custom Taxonomy - filtering by any other taxonomy
  • Type - method to select attribute values
    • Checkbox - checkboxes with the possibility to choose any count of values

    • Radio - radio buttons with the possibility to choose only one value

    • Select - drop down menu with the possibility to choose only one value

    • Color - blocks that will be filled with selected color with the possibility to choose any count of values

    • Slider - widget with the possibility to choose range of values

  • Operator - operator that uses between attribute values
  • Values Order - type of values to sort like number or like text
Advanced Settings
  • Hide this widget on load? - if enabled will hide widget on page load
  • Show product count per attributes? - at right side from attribute values name displays count of products with this attribute value
  • Hide collapse arrow? - hides arrow at right side from widget title
  • Values per row - how many values will be displayed in one row

    For example: if Values per row set to 2

  • Icons - panel where you can select icons which will be added befor and after widget title and before and after values
  • Description - when you set some description then at right side from widget title will be displayed the info button that show small pop-up window with description text

    For example: if you set description to "Select color of products"

  • CSS Class - custom CSS classes that will be added to widget
  • Filter Box Height - if you need to limit widget height set value this field
  • Scroll Theme - works only if you set Filter Box Height and widget height will be bigger than this value
  • Child/Parent Limitation - uses for create widget that will be depend from another widget
  • Child depth - child depth from parent. Displays only if you set Child/Parent Limitation to Child

For example: you have attribute color with structure like this

First widget with title "Color 1" will be with Child/Parent Limitation set to Parent, then second widget with title "Color 2" will be with Child/Parent Limitation set to Child and Child depth set to 1.

Widget on page load:

After selecting in widget with title Color 1 green and blue values

Attribute

Widget with Filter By set to Attribute have some additional fields.

  • Attribute - products attributes from Products -> Attributes page in admin panel
    • Price - additional special attributes uses current products prices as values. Add some additional fields
      • As type uses only slider
      • Didn't have Operator, Show product count per attributes?, Values per row and Child/Parent Limitation
      • Text before price and after - text that displays before and after slider values fields
      • Use custom values - values that uses in slider
      • Use min price - select this button and set minimum price for slider in field under button
      • Use max price - select this button and set maximum price for slider in field under button

Other Settings

Product sub-categories, Tag and Custom Taxonomy have some additional options.

Product sub-categories

  • Product Category - category to show sub-categories
  • Deep level - depth of search in categories

Tag

  • Tag has additional type Tag cloud, but doesn't have type Color
  • Type Tag cloud has additional settings in Advanced settings
    • Tags Cloud Height - height to generate tag cloud
    • Min Font Size - font size for tag with minimum amount of products
    • Max Font Size - font size for tag with maximum amount of products
    • Max Tags Count - tag count in tag cloud

Custom Taxonomy

  • Custom Taxonomies - all available custom taxonomies

Selected Filters Area

  • Show if nothing is selected - Show "Nothing is selected" when filters are not selected
  • Hide collapse arrow? - hides arrow at right side from widget title
  • Hide this widget on load? - if enabled will hide widget on page load

Search Box

  • Attributes - filters that will be added to search box
    • URL to search - URL that will be used to redirect on search
    • Attributes count - amount of filters in search box
    • Attribute # - settings for attribute number # ( copies some settings from "Filter" widget type )
      • Title - title displays above filter
      • Filter By - drop down menu that used to select values for filtering
      • Attribute - products attributes from Products -> Attributes page in admin panel
      • Custom taxonomy - filtering by any other taxonomy
      • Type - method to select attribute values

For Developers

Action hooks

berocket_aapf_widget_before_start

Used for display information before AJAX Product Filters widgets.

Usage

<?php
function my_block_before_berocket_widget () {
//your code here
}

add_action( 'berocket_aapf_widget_before_start', 'my_block_before_berocket_widget' );
?>

berocket_aapf_widget_after_start

Used for display information after AJAX Product Filters widgets title and ul tag.

Usage

<?php
function my_block_after_berocket_widget_title () {
//your code here
}

add_action( 'berocket_aapf_widget_after_start', 'my_block_after_berocket_widget_title' );
?>

berocket_aapf_widget_before_end

Used for display information before AJAX Product Filters widgets closing ul tag.

Usage

<?php
function my_block_before_berocket_widget_end () {
//your code here
}

add_action( 'berocket_aapf_widget_before_end', 'my_block_before_berocket_widget_end' );
?>

berocket_aapf_widget_after_end

Used for display information after AJAX Product Filters widgets.

Usage

<?php
function my_block_after_berocket_widget () {
//your code here
}

add_action( 'berocket_aapf_widget_after_end', 'my_block_after_berocket_widget' );
?>

berocket_aapf_admin_update

Used when saving AJAX Product Filters widgets settings

Parameters

  1. instance - widget current settings with changes
  2. new_instance - new widget settings
  3. old_instance - old widget settings

Usage

<?php
function my_func_berocket_widget_updates ( $instance, $new_instance, $old_instance ) {
//your code here
}

add_action( 'berocket_aapf_admin_update', 'my_func_berocket_widget_updates', 10, 3 );
?>

Filter hooks

berocket_aapf_update_info

Information about plugin for BeRocket Updater

Parameters

  1. info - array with plugin information
    • id - plugin id on BeRocket site
    • version - current plugin version
    • plugin - plugin file name
    • slug - plugin name in WordPress
    • key - product key from plugin settings

Usage

<?php
function change_plugin_info ( $info ) {
//your code here
    return $info;
}

add_filter( 'berocket_aapf_update_info', 'change_plugin_info' );
?>

berocket_aapf_shortcode_options

Filters for shortcode settings

Parameters

  1. attributes - array with settings

Usage

<?php
function change_shortcode_settings ( $atts ) {
//your code here
    return $atts;
}

add_filter( 'berocket_aapf_shortcode_options', 'change_shortcode_settings' );
?>

berocket_aapf_filters_on_page_load

Filters for options that plugin adds to main wp_query on page load with selected filters

Parameters

  1. arguments - array with all options. Variables that plugin can add to wp_query: meta_key, tax_query, fields, where, join, meta_query

Usage

<?php
function change_filters_on_load ( $args ) {
//your code here
    return $args;
}

add_filter( 'berocket_aapf_filters_on_page_load', 'change_filters_on_load' );
?>

br_get_template_part

Change templates for plugin part

Parameters

  1. template - current template path
  2. name - template name

Usage

<?php
function set_template_berocket ( $template, $name ) {
//your code here
    return $template;
}

add_filter( 'br_get_template_part', 'set_template_berocket', 10, 2 );
?>

berocket_aapf_listener_br_options

Filters for plugin settings on load

Parameters

  1. settings - array with plugin settings

Usage

<?php
function change_berocket_aapf_settings ( $settings ) {
//your code here
    return $settings;
}

add_filter( 'berocket_aapf_listener_br_options', 'change_berocket_aapf_settings' );
?>

berocket_aapf_widget_title

Filters for AJAX Product Filters widget title

Parameters

  1. title - widget title

Usage

<?php
function my_filter_berocket_widget_title ( $title ) {
//your code here
    return $title;
}

add_filter( 'berocket_aapf_widget_title', 'my_filter_berocket_widget_title' );
?>

berocket_aapf_widget_terms

Filters for taxonomy terms that used in AJAX Product Filters widgets

Parameters

  1. terms - array with taxonomy terms

Usage

<?php
function my_filter_berocket_widget_terms ( $terms ) {
//your code here
    return $terms;
}

add_filter( 'berocket_aapf_widget_terms', 'my_filter_berocket_widget_terms' );
?>

berocket_aapf_widget_class

Filters for AJAX Product Filters widgets classes

Parameters

  1. class - string with class name

Usage

<?php
function my_filter_berocket_widget_class ( $class ) {
//your code here
    return $class;
}

add_filter( 'berocket_aapf_widget_class', 'my_filter_berocket_widget_class' );
?>

berocket_aapf_widget_css_class

Filters for AJAX Product Filters widgets custom classes from widget settings

Parameters

  1. css_class - string with classes names

Usage

<?php
function my_filter_berocket_widget_css_class ( $css_class ) {
//your code here
    return $css_class;
}

add_filter( 'berocket_aapf_widget_css_class', 'my_filter_berocket_widget_css_class' );
?>

berocket_aapf_widget_style

Filters for AJAX Product Filters widgets inline CSS styles

Parameters

  1. style - inline CSS styles

Usage

<?php
function my_filter_berocket_widget_style ( $style ) {
//your code here
    return $style;
}

add_filter( 'berocket_aapf_widget_style', 'my_filter_berocket_widget_style' );
?>

berocket_aapf_hide_out_of_stock_items

Hide out of stock products

Parameters

  1. hide - boolean variable, if set to true out of stock products will be hidden

Usage

<?php
function my_set_hide_out_of_stock ( $hide ) {
//your code here
    return $hide;
}

add_filter( 'berocket_aapf_hide_out_of_stock_items', 'my_set_hide_out_of_stock' );
?>

berocket_aapf_get_price_range

Filters for price list for widget with price filtering

Parameters

  1. price_range - array with prices

Usage

<?php
function set_prices_berocket_widget ( $price_range ) {
//your code here
    return $price_range;
}

add_filter( 'berocket_aapf_get_price_range', 'set_prices_berocket_widget' );
?>

berocket_aapf_listener_wp_query_args

Filters for wp_query arguments

Parameters

  1. args - array with arguments

Usage

<?php
function set_args_berocket_aapf ( $args ) {
//your code here
    return $args;
}

add_filter( 'berocket_aapf_listener_wp_query_args', 'set_args_berocket_aapf' );
?>

berocket_aapf_admin_update_instance

Filters for AJAX Product Filters widget settings on widget settings update

Parameters

  1. instance - widget settings

Usage

<?php
function my_filter_berocket_widget_instance ( $instance ) {
//your code here
    return $instance;
}

add_filter( 'berocket_aapf_admin_update_instance', 'my_filter_berocket_widget_instance' );
?>

berocket_aapf_form_defaults

Filters for AJAX Product Filters widget default settings on widget create

Parameters

  1. default - default widget settings

Usage

<?php
function set_berocket_widget_default_settings ( $default ) {
//your code here
    return $default;
}

add_filter( 'berocket_aapf_form_defaults', 'set_berocket_widget_default_settings' );
?>

berocket_aapf_listener_no_products_message

Filters for message, that show when with selected filters no products

Parameters

  1. block - div block with message

Usage

<?php
function set_berocket_no_products ( $block ) {
//your code here
    return $block;
}

add_filter( 'berocket_aapf_listener_no_products_message', 'set_berocket_no_products' );
?>

berocket_aapf_add_product_class

Filters for classes that plugin add to products

Parameters

  1. classes - array with classes

Usage

<?php
function my_filter_berocket_product_classes ( $classes ) {
//your code here
    return $classes;
}

add_filter( 'berocket_aapf_add_product_class', 'my_filter_berocket_product_classes' );
?>

berocket_aapf_get_attributes

Filters for attributes that used in AJAX Product Filters widgets

Parameters

  1. attributes - array with attributes

Usage

<?php
function my_filter_berocket_attributes ( $attributes ) {
//your code here
    return $attributes;
}

add_filter( 'berocket_aapf_get_attributes', 'my_filter_berocket_attributes' );
?>

berocket_aapf_listener_taxonomies

Filters for taxonomies list that uses for products filtering

Parameters

  1. taxonomies - array with taxonomies

Usage

<?php
function my_filter_berocket_taxonomies ( $taxonomies ) {
//your code here
    return $taxonomies;
}

add_filter( 'berocket_aapf_listener_taxonomies', 'my_filter_berocket_taxonomies' );
?>

berocket_aapf_listener_taxonomies_operator

Filters for taxonomies operator list that uses for taxonomies list

Parameters

  1. operator_taxonomies - array with taxonomies operator

Usage

<?php
function my_filter_berocket_tax_operator ( $operator_taxonomies ) {
//your code here
    return $operator_taxonomies;
}

add_filter( 'berocket_aapf_listener_taxonomies_operator', 'my_filter_berocket_tax_operator' );
?>

BeRocket_updater_add_plugin

Filters for adding plugins to BeRocket Updater

Parameters

  1. plugins - plugins list that already added. Contains array with information about plugin

Warning

Don't change array structure and information if you didn't know for what is it.

Usage

<?php
function get_berocket_plugin_list ( $plugins ) {
//your code here
    return $plugins;
}

add_filter( 'BeRocket_updater_add_plugin', 'get_berocket_plugin_list', 20 );
?>

BeRocket_updater_error_log

Error log that uses JavaScript console to display messages

Parameters

  1. error_log - array with errors, messages and other data

Usage

<?php
function my_errors ( $error_log ) {
//your code here
    $error_log[] = $my_data;
    return $error_log;
}

add_filter( 'BeRocket_updater_error_log', 'my_errors' );
?>

berocket_ajax_response_without_fix

Filters for adding additional data to ajax response

Parameters

  1. response - response with data

Warning

Don't change array structure and information if you didn't know for what is it.

Usage

 

<?php
function berocket_ajax_response_filters ( $response ) {
//your code here
    $response['my_data'] = $my_data;
    return $response;
}

add_filter( 'berocket_ajax_response_without_fix', 'berocket_ajax_response_filters' );
?>

Functions

includes/functions.php

br_get_woocommerce_version()

Public function to get WooCommerce version

return string. woocommerce version

br_get_template_part($name = '')

Public function to get plugin's template. Default templates places in plugin folder/templates

  • $name - template name

return void

br_is_filtered($filters = true, $limits = true, $price = true) 

Public function to check if any filters are used

  • $filters - is checking checkbox, radio and color type of filters
  • $limits - is checking slider type of filters
  • $price - is checking price filter

return boolean. true if any filters are used or false

br_get_cache( $key, $group, $cache_type ) 

Get cached data

  • $key - cached data name
  • $group - cached data group
  • $cache_type - type of cache 'wordpress' or 'persistent'

return mixed. cached data

br_set_cache( $key, $value, $group, $expire, $cache_type ) 

Set data for caching

  • $key - caching data name
  • $value - caching data value(any type)
  • $group - caching data group
  • $expire - expiration time in seconds
  • $cache_type - type of cache 'wordpress' or 'persistent'

return void

br_is_term_selected( $term, $checked = FALSE, $child_parent = FALSE, $depth = 0 ) 

Public function to check if term is selected

  • $term - term ID to check
  • $checked - if TRUE return ' checked="checked"'
  • $child_parent - if TRUE search child selected
  • $depth - current term depth in hierarchy

return string. ' selected="selected"' if selected, empty string '' if not selected

br_get_selected_term( $taxonomy )

Public function to get all selected terms in taxonomy

  • $taxonomy - taxonomy name

return array. array with selected terms

br_aapf_get_attributes()

Get all possible woocommerce attribute taxonomies

return array. array with taxonomies

br_aapf_parse_order_by( &$args )

Parsing order by data and saving to $args array that was passed into this function

  • $args - arguments for wp_query

return void

br_aapf_args_parser( $args = array() )

Extend $args based on passed filters

  • $args - empty array or array with arguments for wp_query

return array

br_aapf_args_converter($query)

convert arguments in URL to normal filters

return void

g_fonts_list()

Get fonts list from google

return array

fa_icons_list()

Get font awesome list of icons name

return array

berocket_font_select_upload( $text, $id, $name, $value, $show_fa = true, $show_upload = true, $show_remove = true, $data_sc = '' )

Public function to add to plugin settings buttons to upload or select icons

  • $text - text above buttons
  • $id - input ID
  • $name - input name
  • $value - current value link or font awesome icon class
  • $show_fa - show font awesome button and generate font awesome icon table
  • $show_upload - show upload button that allow upload custom icons
  • $show_remove - show remove button that allow clear input
  • $data_sc - add data-sc options with this value into input

return string. HTML code with all needed blocks and buttons

br_get_post_meta_price( $object_id )

Public function to get price of product

  • $object_id - product id

return float. Product price

br_get_category_id( $value, $field = 'slug' )

Public function to get category id by $value in $field

  • $value - value for search
  • $field - by what field is search

return int. Category ID

br_get_category( $id )

Public function to get category by ID

  • $id - category ID

return object. Category

br_get_sub_categories( $field_value, $field_name = 'slug', $args = array() )

Public function to get sub categories from category

  • $field_value - value for search
  • $field_name - by what field is search
  • $args - array with arguments: 'return' - type of return data, 'include_parent' = include parent to cate gories list, 'max_depth' - max depth of sub category

return string|array|object. Categories

br_wp_get_object_terms( $object_id, $taxonomy, $args = array() )

Public function to get terms by id and taxonomy

  • $object_id - term ID
  • $taxonomy - taxonomy

return array. Terms

woocommerce-filters.php

All of these functions is in class BeRocket_AAPF as static functions.

add_rewrite_rules ( $rules )

Filter for permalink rewrite rules. Add rules for nice URLs.

init ()

Function for add rewrite end point for nice URLs.

add_queryvars( $query_vars )

Add new variable to query from permalink rules for nice URLs

update_from_older( $version )

Uses for add options add set some settings after plugin updates

  • $version - old plugin version
load_jquery_ui() 

Register script and styles for admin panel

br_add_options_page()

Register plugin settings page

shortcode( $atts = array() )

Registered shortcode function

apply_user_filters( $query )

Apply filters on page load

br_get_template_part( $name = '' )

Get template part (for templates like the slider).

Default templates places in plugins folder woocommerce-ajax-filters/templates.

To rewrite the template in your theme folder create folder with name woocommerce-filters and places new template with identical name in this folder.

register_br_options()

Add media uploader to pages

register_permalink_option()

Add options to permalink pages

br_custom_user_css()

Add user styling to wordpress pages

selected_area()

Display selected area

br_aapf_get_child()

Get child for selected parent via AJAX, when using Child/Parent setting in widgets

WPML_fix()

Fix for WPML plugin on AJAX loading

Options

WooCommerce AJAX Products Filter use different options in different places.

br_filters_options

Contains all options from plugin settings page.

Array with default values

$defaults = array(
        'plugin_key'                      => '',
        'no_products_message'             => 'There are no products meeting your criteria',
        'pos_relative'                    => '1',
        'no_products_class'               => '',
        'products_holder_id'              => 'ul.products',
        'woocommerce_result_count_class'  => '.woocommerce-result-count',
        'woocommerce_ordering_class'      => 'form.woocommerce-ordering',
        'woocommerce_pagination_class'    => '.woocommerce-pagination',
        'woocommerce_removes'             => array(
            'result_count'                => '',
            'ordering'                    => '',
            'pagination'                  => '',
        ),
        'control_sorting'                 => '',
        'seo_friendly_urls'               => '',
        'slug_urls'                       => '',
        'nice_urls'                       => '',
        'filters_turn_off'                => '',
        'show_all_values'                 => '',
        'hide_value'                      => array(
            'o'                           => '',
            'sel'                         => '',
        ),
        'first_page_jump'                 => '',
        'scroll_shop_top'                 => '',
        'scroll_shop_top_px'              => '-180',
        'recount_products'                => '',
        'selected_area_show'              => '',
        'object_cache'                    => 'wordpress',
        'ajax_request_load'               => '1',
        'ajax_request_load_style'         => 'jquery',
        'product_per_row'                 => '4',
        
        'styles_input'                    => array(
            'checkbox'               => array( 'bcolor' => '', 'bwidth' => '', 'bradius' => '', 'fcolor' => '', 'backcolor' => '', 'icon' => '', 'fontsize' => '' ),
            'radio'                  => array( 'bcolor' => '', 'bwidth' => '', 'bradius' => '', 'fcolor' => '', 'backcolor' => '', 'icon' => '', 'fontsize' => '' ),
            'slider'                 => array( 'line_color' => '', 'line_height' => '', 'line_border_color' => '', 'line_border_width' => '', 'button_size' => '', 
                                               'button_color' => '', 'button_border_color' => '', 'button_border_width' => '', 'button_border_radius' => '' ),
            'product_count'          => 'round',
            'product_count_position' => '',
        ),
        'ajax_load_icon'                  => '',
        'ajax_load_text'                  => array(
            'top'                         => '',
            'bottom'                      => '',
            'left'                        => '',
            'right'                       => '',
        ),
        'description'                     => array(
            'show'                        => 'click',
            'hide'                        => 'click',
        ),
        'user_func'                       => array(
            'before_update'               => '',
            'on_update'                   => '',
            'after_update'                => '',
        ),
        'user_custom_css'                 => '',
        'br_opened_tab'                   => 'general',
        'number_style'                    => array(
            'thousand_separate' => '',
            'decimal_separate'  => '.',
            'decimal_number'    => '2',
        ),
        'debug_mode'                      => '',
    );

br_filters_version

Contains current plugin version. Uses for correct plugin update.

berocket_permalink_option

Contains all settings from permalink page.

Array with default values

$default_permalink = array (
        'variable' => 'filters',
        'value'    => '/values',
        'split'    => '/',
    );

BeRocket_account_option

Contains BeRocket Account key.

Array with default values

$default_account = array (
        'account_key' => '',
    );

 

Files

  • woocommerce-filters.php - main plugin file
  • css - folder with CSS files
    • admin.css - styles for admin panel
    • colpick.css - styles for color picker block
    • font-awesome.min.css - standard Font Awesome styles
    • jquery-ui.min.css - styles for jQuery UI
    • widget.css - styles for pages with widgets
    • images - folder with images for jQuery UI
    • scrollbar - styles for custom scrollbar
    • styler - form styler
  • fonts - Font Awesome fonts
  • images - images that uses in plugin
  • includes - folder with additional PHP files
    • functions.php - public functions
    • updater.php - BeRocket Updater for plugins update from BeRocket site
    • widget.php - AJAX Product Filters widget
  • js - folder with JavaScript files
    • admin.js - JavaScript for admin panel settings and widget settings
    • colpick.js - JavaScript for color picker in admin panel settings
    • j.doe.cloud.min.js - generate tag cloud in tag widget
    • jquery-ui.min.js - jQuery UI uses only in admin panel
    • mobiles.min.js - additional JavaScript for jQuery UI for mobile devices
    • widget.min.js - JavaScript for AJAX Product Filters widgets
    • scrollbar - JavaScript for custom sliderbar
    • styler - JavaScript for form styler
  • templates - templates for widgets and settings
    • admin-settings.php - plugin settings
    • admin.php - templates for AJAX Product Filters widget settings
    • checkbox.php - templates for widget with checkbox type
    • color.php - templates for widget with color type
    • color_ajax.php - templates for color/image picker in widget with color or image type
    • image.php - templates for widget with image type
    • permalink_option.php - templates for options in permalink settings
    • radio.php - templates for widget with radio type
    • select.php - templates for widget with select type
    • slider.php - templates for widget with slider type
    • tag_cloud.php - templates for tag widget with tag cloud type
    • widget_start.php - templates before all widget types
    • widget_end.php - templates after all widget types
    • widget_selected_area.php - templates for Selected Filters area
    • widget_update_button.php - templates for Update Products button