Version Description
- Enhancement - Option to hide selected values and/or without products. Add at the bottom button to show them
- Enhancement - Filters are using product variations now
- Enhancement - translation( WPML ) support
- Enhancement/Fix - radio-box had issues and there was no chance to remove selection
- Fix - Pagination has issues with link building
- Fix - Jump to first page wasn't working correctly and jump each time even when user want to change page
Download this release
Release Info
Developer | dholovnia |
Plugin | Advanced AJAX Product Filters |
Version | 1.1.0.7 |
Comparing to | |
See all releases |
Code changes from version 1.1.0.6 to 1.1.0.7
- README.md +261 -0
- contributors.txt +1 -1
- css/widget.css +44 -5
- images/gray-left-arrow.png +0 -0
- includes/functions.php +20 -0
- includes/widget.php +77 -31
- js/admin.js +1 -0
- js/widget.min.js +89 -23
- readme.txt +19 -3
- templates/admin-settings.php +62 -35
- templates/admin.php +14 -14
- templates/checkbox.php +14 -4
- templates/radio.php +16 -5
- woocommerce-filters.php +50 -13
README.md
ADDED
@@ -0,0 +1,261 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Advanced AJAX Product Filters ===
|
2 |
+
Plugin Name: Advanced AJAX Product Filters
|
3 |
+
Contributors: dholovnia, berocket
|
4 |
+
Donate link: http://berocket.com
|
5 |
+
Tags: filters, product filters, ajax product filters, advanced product filters, woocommerce filters, woocommerce product filters, woocommerce ajax product filters, widget, plugin
|
6 |
+
Requires at least: 4.0
|
7 |
+
Tested up to: 4.2.2
|
8 |
+
Stable tag: 1.1.0.7
|
9 |
+
License: GPLv2 or later
|
10 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
+
|
12 |
+
WooCommerce AJAX Product Filters - advanced AJAX product filters plugin for WooCommerce.
|
13 |
+
|
14 |
+
== Description ==
|
15 |
+
|
16 |
+
WooCommerce AJAX Product Filters - advanced AJAX product filters plugin for WooCommerce. Add unlimited filters with one widget.
|
17 |
+
|
18 |
+
= Features: =
|
19 |
+
|
20 |
+
* AJAX Filters, Pagination and Sorting!
|
21 |
+
* Unlimited Filters
|
22 |
+
* Multiple User Interface Elements
|
23 |
+
* SEO Friendly Urls ( with HTML5 PushState )
|
24 |
+
* Filter Visibility By Product Category And Globals.
|
25 |
+
* Accessible through shortcode
|
26 |
+
* Filter box height limit with scroll themes
|
27 |
+
* Working great with custom widget area
|
28 |
+
* Drag and Drop Filter Building
|
29 |
+
* And More...
|
30 |
+
|
31 |
+
= Additional Features in Paid Plugin: =
|
32 |
+
|
33 |
+
* Filter by Attribute, Tag, Custom Taxonomy, Color, Sub-categories and Availability( in stock | out of stock | any )
|
34 |
+
* Customize filters look through admin
|
35 |
+
* Option to re-count products amount in values when some value selected
|
36 |
+
* Tag Cloud for Tag filter
|
37 |
+
* Description can be added for the attributes
|
38 |
+
* Slider can use strings as a value
|
39 |
+
* Filters can be collapsed by clicking on title, option to collapse filter on start
|
40 |
+
* Price Filter Custom Min and Max values
|
41 |
+
* Add custom CSS on admin settings page
|
42 |
+
* Show icons before/after widget title and/or before/after values
|
43 |
+
* Option to upload "Loading..." gif image and set label after/before/above/under it
|
44 |
+
* Show icons before/after widget title and/or before/after values
|
45 |
+
* Scroll top position can be controlled by the admin
|
46 |
+
* Option to hide on mobile devices
|
47 |
+
* Much better support for custom theme
|
48 |
+
* Enhancements of the free features
|
49 |
+
|
50 |
+
= Paid Plugin Link =
|
51 |
+
http://berocket.com/product/woocommerce-ajax-products-filter
|
52 |
+
|
53 |
+
= Demo =
|
54 |
+
http://woocommerce-product-filter.berocket.com
|
55 |
+
|
56 |
+
|
57 |
+
= How It Works: =
|
58 |
+
*check installation*
|
59 |
+
|
60 |
+
|
61 |
+
= In recent updates: =
|
62 |
+
* Scroll to the top
|
63 |
+
* Hash for old browsers added for better support
|
64 |
+
* Sort by default WooCommerce value
|
65 |
+
* Fixed out-of-stock filter
|
66 |
+
* Jump to first page when filter changed
|
67 |
+
* Option to add text before and after price input fields
|
68 |
+
* Now only used values must be shown, not all
|
69 |
+
* Minor fixes
|
70 |
+
|
71 |
+
|
72 |
+
|
73 |
+
= Shortcode: =
|
74 |
+
* In editor `[br_filters attribute=price type=slider title="Price Filter"]`
|
75 |
+
* In PHP `do_shortcode('[br_filters attribute=price type=slider title="Price Filter"]');`
|
76 |
+
|
77 |
+
= Shortcode Options: =
|
78 |
+
* `attribute`(required) - product attribute, eg price or length. Don't forget that woocommerce adding pa_ suffix for created attributes.
|
79 |
+
So if you create new attribute `jump` its name is `pa_jump`
|
80 |
+
* `type`(required) - checkbox, radio, slider or select
|
81 |
+
* `operator` - OR or AND
|
82 |
+
* `title` - whatever you want to see as title. Can be empty
|
83 |
+
* `product_cat` - parent category id
|
84 |
+
* `cat_propagation` - should we propagate this filter to child categories? set 1 to turn this on
|
85 |
+
* `height` - max filter box height. When height is met scroll will be added
|
86 |
+
* `scroll_theme` - pretty clear name, scroll theme. Will be used if height is set and real height of box is more
|
87 |
+
|
88 |
+
|
89 |
+
= Advanced Settings (Widget area): =
|
90 |
+
|
91 |
+
* Product Category - if you want to pin your filter to category of the product this is good place to do it.
|
92 |
+
Eg. You selling Phones and Cases for them. If user choose Category "Phones" filter "Have Wi-Fi" will appear
|
93 |
+
but if user will choose "Cases" it will not be there as Admin set that "Have Wi-Fi" filter will be visible only on
|
94 |
+
"Phones" category.
|
95 |
+
* Filter Box Height - if your filter have too much options it is nice to limit height of the filter to not prolong
|
96 |
+
the page too much. Scroll will appear.
|
97 |
+
* Scroll theme - if "Filter Box Height" is set and box length is more than "Filter Box Height" scroll appear and
|
98 |
+
how it looks depends on the theme you choose.
|
99 |
+
|
100 |
+
|
101 |
+
= Advanced Settings (Plugin Settings): =
|
102 |
+
* Plugin settings can be found in admin area, WooCommerce -> Product Filters
|
103 |
+
* "No Products" message - Text that will be shown if no products found
|
104 |
+
* "No Products" class - Add class and use it to style "No Products" box
|
105 |
+
* Products selector - Selector for tag that is holding products
|
106 |
+
* Sorting control - Take control over WooCommerce's sorting selectbox
|
107 |
+
* SEO friendly urls - url will be changed when filter is selected/changed
|
108 |
+
* Turn all filters off - If you want to hide filters without losing current configuration just turn them off
|
109 |
+
|
110 |
+
|
111 |
+
|
112 |
+
== Installation ==
|
113 |
+
|
114 |
+
= Step 1: =
|
115 |
+
* First you need to add attributes to the products ( WooCommerce plugin should be installed and activated already )
|
116 |
+
* Go to Admin area -> Products -> Attributes and add attributes your products will have, add them all
|
117 |
+
* Click attribute's name where type is select and add values to it. Predefine product options
|
118 |
+
* Go to your products and add attributes to each of them
|
119 |
+
|
120 |
+
= Step 2: =
|
121 |
+
* Install and activate plugin
|
122 |
+
* First of all go to Admin area -> WooCommerce -> Product Filter and check what global options you can manage
|
123 |
+
* After that go to Admin area -> Appearance -> Widgets
|
124 |
+
* In Available Widgets ( left side of the screen ) find AJAX Product Filters
|
125 |
+
* Drag it to Sidebar you choose
|
126 |
+
* Enter title, choose attribute that will be used for filtering products, choose filter type,
|
127 |
+
choose operator( whether product should have all selected values (AND) or one of them (OR) ),
|
128 |
+
* Click save and go to your shop to check how it work.
|
129 |
+
* That's it =)
|
130 |
+
|
131 |
+
|
132 |
+
== Frequently Asked Questions ==
|
133 |
+
|
134 |
+
---
|
135 |
+
|
136 |
+
== Screenshots ==
|
137 |
+
|
138 |
+
---
|
139 |
+
|
140 |
+
== Changelog ==
|
141 |
+
|
142 |
+
= 1.1.0.7 =
|
143 |
+
* Enhancement - Option to hide selected values and/or without products. Add at the bottom button to show them
|
144 |
+
* Enhancement - Filters are using product variations now
|
145 |
+
* Enhancement - translation( WPML ) support
|
146 |
+
* Enhancement/Fix - radio-box had issues and there was no chance to remove selection
|
147 |
+
* Fix - Pagination has issues with link building
|
148 |
+
* Fix - Jump to first page wasn't working correctly and jump each time even when user want to change page
|
149 |
+
|
150 |
+
= 1.1.0.6 =
|
151 |
+
* Enhancement - Scroll to the top
|
152 |
+
* Enhancement/Fix - Hash for old browsers added for better support
|
153 |
+
* Enhancement/Fix - Sort by default WooCommerce value
|
154 |
+
* Fix - out-of-stock filter working correctly
|
155 |
+
|
156 |
+
= 1.1.0.5 =
|
157 |
+
* Enhancement - Option to add text before and after price input fields
|
158 |
+
* Enhancement - Jump to first page when filter changed
|
159 |
+
* Fix - Now only used values must be shown, not all
|
160 |
+
* Fix - Products are limited by category we are in
|
161 |
+
* Fix - Products amount on the first page is correct now
|
162 |
+
|
163 |
+
= 1.1.0.4 =
|
164 |
+
* Minor fix
|
165 |
+
|
166 |
+
= 1.1.0.3 =
|
167 |
+
* Enhancement - Custom CSS class can be added per widget/filter
|
168 |
+
* Enhancement - Update button. If added products will be updated only when user click Update button
|
169 |
+
* Enhancement - Radio-box can be unselected by clicking it again
|
170 |
+
* Enhancement/Fix - Urls are shortened using better structure to save filters. `~` symbol is not used now
|
171 |
+
* Fix - issue with shortened tags for shortcode.
|
172 |
+
* Fix - on widgets page widget now has subcategories(hierarchy)
|
173 |
+
* Fix - all categories are visible, not only that have products inside(popular)
|
174 |
+
* Minor fixes
|
175 |
+
|
176 |
+
= 1.1.0.2 =
|
177 |
+
* Fix - another js issue that stops plugin from work
|
178 |
+
* Fix - order by name, name_numeric and attribute ID wasn't working
|
179 |
+
|
180 |
+
= 1.1.0.1 =
|
181 |
+
* Fix - js issue that stops plugin from work
|
182 |
+
|
183 |
+
= 1.1.0 =
|
184 |
+
* Enhancement - Show all values - on plugin settings page you can enable option to show all values no matter if they are used or not
|
185 |
+
* Enhancement - Values order - you can set values order when editing attribute. You can set how to order (by id, name or custom). If
|
186 |
+
you set to order `by custom` you can drag&drop values up and down and set your own order.
|
187 |
+
* Small fixes
|
188 |
+
|
189 |
+
= 1.0.4.5 =
|
190 |
+
* Enhancement - values order added. Now order of values can be controlled through attribute options
|
191 |
+
* Enhancement/Fix - Better support for for category pages
|
192 |
+
* Other small fixes
|
193 |
+
|
194 |
+
= 1.0.4.4 =
|
195 |
+
* Enhancement - adding callback for before_update, on_update, after_update events.
|
196 |
+
* Other small fixes
|
197 |
+
|
198 |
+
= 1.0.4.3 =
|
199 |
+
* Enhancement - shortcode added
|
200 |
+
* Critical/Fix - If slider match none its values wasn't counted
|
201 |
+
* Enhancement/Fix - Changing attribute data location from url to action-element, providing more flexibility for template
|
202 |
+
* Enhancement/Templating - Using full products loop instead of including product content template
|
203 |
+
* Fix - Pagination with SEO url issue
|
204 |
+
|
205 |
+
= 1.0.4.2 =
|
206 |
+
* Enhancement/Fix - Better support for SEO urls with permalinks on/off
|
207 |
+
* Fix - Critical bug that was returning incorrect products.
|
208 |
+
|
209 |
+
= 1.0.4.1 =
|
210 |
+
* Enhancement - Adding AJAX for pagination.
|
211 |
+
* Enhancement - Adding PushState for pagination.
|
212 |
+
* Enhancement/Fix - Pagination wasn't updating when filters used.
|
213 |
+
* Enhancement/Fix - Text with amount of results (Eg "Showing all 2 results") wasn't updating after filters applied
|
214 |
+
* Enhancement/Fix - When choosing Slider in admin Operator became hidden
|
215 |
+
* Fix - All sliders except price wasn't working with SEO url
|
216 |
+
* Fix - When changing attribute to/from price in admin all filters jumping
|
217 |
+
* Fix - After filter applied all products was showed. Even those with Draft status.
|
218 |
+
|
219 |
+
= 1.0.4 =
|
220 |
+
* Enhancement - SEO friendly urls with possibility for users to share/bookmark their search. Will be shortened in future
|
221 |
+
* Enhancement - Option added to turn SEO friendly urls on/off. Off by default as this is first version of this feature
|
222 |
+
* Enhancement - Option to turn filters on/off globally
|
223 |
+
* Enhancement - Option to take control over (default) sorting function, make it AJAXy and work with filters
|
224 |
+
* Fix - Sorting remain correct after using filters. Sorting wasn't counted before
|
225 |
+
* Fix - If there are 2 or more sliders they are not working correctly.
|
226 |
+
* Fix - Values in slider was converted to float even when value ia not a price.
|
227 |
+
* Fix - If there are 2 or more values for attribute it was not validated when used in slider.
|
228 |
+
|
229 |
+
= 1.0.3.6 =
|
230 |
+
* Fix - Removed actions that provide warning messages
|
231 |
+
* Enhancement - Actions and filters inside plugin
|
232 |
+
|
233 |
+
= 1.0.3.3 =
|
234 |
+
* Enhancement/Fix - Showing products and options now depending on woocommerce_hide_out_of_stock_items option
|
235 |
+
* Enhancement/Fix - If not enough data available( quantity of options < 2 ) filters will not be shown.
|
236 |
+
* Fix - If in category, only products/options from this category will be shown
|
237 |
+
|
238 |
+
= 1.0.3.2 =
|
239 |
+
* Fix - wrong path was committed in previous version that killed plugin
|
240 |
+
|
241 |
+
= 1.0.3 =
|
242 |
+
* Enhancement - CSS and JavaScript files minimized
|
243 |
+
* Enhancement - Settings page added
|
244 |
+
* Enhancement - "No Products" message and it's class can be changed through admin
|
245 |
+
* Enhancement - Option added that can enable control over sorting( if visible )
|
246 |
+
* Enhancement - User can select several categories instead of one. Now you don't need to create several same filters
|
247 |
+
for different categories.
|
248 |
+
* Enhancement - Added option "include subcats?". if selected filter will be shown in selected categories and their
|
249 |
+
subcategories
|
250 |
+
* Fix - Adding support to themes that require product div to have "product" class
|
251 |
+
* Fix - Slider in categories wasn't initialized
|
252 |
+
* Fix - Subcategories wasn't working. Only Main categories were showing filters
|
253 |
+
* Templating - return woocommerce/theme default structure for product
|
254 |
+
* Templating - html parts moved to separate files in templates folder. You can overwrite them by creating folder
|
255 |
+
"woocommerce-filters" and file with same name as in plugin templates folder.
|
256 |
+
|
257 |
+
= 1.0.2 =
|
258 |
+
* Fix - better support for older PHP versions
|
259 |
+
|
260 |
+
= 1.0.1 =
|
261 |
+
* First public version
|
contributors.txt
CHANGED
@@ -1 +1 @@
|
|
1 |
-
BeRocket
|
1 |
+
BeRocket
|
css/widget.css
CHANGED
@@ -52,6 +52,49 @@ ul.berocket_aapf_widget{
|
|
52 |
margin-bottom: 30px;
|
53 |
}
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
ul.berocket_aapf_widget li{
|
56 |
list-style-type: none;
|
57 |
padding-left: 0;
|
@@ -107,15 +150,11 @@ span.product-size{
|
|
107 |
font-style: italic;
|
108 |
padding: 4px 9px;
|
109 |
text-align: right;
|
110 |
-
width:
|
111 |
background: white;
|
112 |
line-height: 1.1em;
|
113 |
}
|
114 |
|
115 |
-
.berocket_aapf_widget li.slider{
|
116 |
-
width: 80%;
|
117 |
-
}
|
118 |
-
|
119 |
.berocket_aapf_widget li.slider span.right{
|
120 |
float: right;
|
121 |
text-align: right;
|
52 |
margin-bottom: 30px;
|
53 |
}
|
54 |
|
55 |
+
ul.berocket_aapf_widget .berocket_widget_show_values{
|
56 |
+
cursor: pointer;
|
57 |
+
display: block;
|
58 |
+
position: relative;
|
59 |
+
margin-bottom: 10px;
|
60 |
+
top: 10px;
|
61 |
+
font-size: 0.9em;
|
62 |
+
}
|
63 |
+
|
64 |
+
ul.berocket_aapf_widget .berocket_widget_show_values span{
|
65 |
+
margin-right: 20px;
|
66 |
+
display: inline-block;
|
67 |
+
width: 1.8em;
|
68 |
+
height: 1em;
|
69 |
+
background: transparent url('../images/gray-left-arrow.png') no-repeat center center;
|
70 |
+
}
|
71 |
+
|
72 |
+
ul.berocket_aapf_widget .berocket_widget_show_values span.show_button
|
73 |
+
{
|
74 |
+
-moz-transform: rotate(270deg);
|
75 |
+
-ms-transform: rotate(270deg);
|
76 |
+
-webkit-transform: rotate(270deg);
|
77 |
+
-o-transform: rotate(270deg);
|
78 |
+
transform: rotate(270deg);
|
79 |
+
}
|
80 |
+
|
81 |
+
ul.berocket_aapf_widget .berocket_widget_show_values span.hide_button
|
82 |
+
{
|
83 |
+
-moz-transform: rotate(90deg);
|
84 |
+
-ms-transform: rotate(90deg);
|
85 |
+
-webkit-transform: rotate(90deg);
|
86 |
+
-o-transform: rotate(90deg);
|
87 |
+
transform: rotate(90deg);
|
88 |
+
}
|
89 |
+
|
90 |
+
ul.berocket_aapf_widget li.berocket_hide_o_value, ul.berocket_aapf_widget li.berocket_hide_sel_value{
|
91 |
+
display: none !important;
|
92 |
+
}
|
93 |
+
|
94 |
+
ul.berocket_aapf_widget.show_o_sel_values li.berocket_hide_o_value, ul.berocket_aapf_widget.show_o_sel_values li.berocket_hide_sel_value{
|
95 |
+
display: block !important;
|
96 |
+
}
|
97 |
+
|
98 |
ul.berocket_aapf_widget li{
|
99 |
list-style-type: none;
|
100 |
padding-left: 0;
|
150 |
font-style: italic;
|
151 |
padding: 4px 9px;
|
152 |
text-align: right;
|
153 |
+
width: 60%;
|
154 |
background: white;
|
155 |
line-height: 1.1em;
|
156 |
}
|
157 |
|
|
|
|
|
|
|
|
|
158 |
.berocket_aapf_widget li.slider span.right{
|
159 |
float: right;
|
160 |
text-align: right;
|
images/gray-left-arrow.png
ADDED
Binary file
|
includes/functions.php
CHANGED
@@ -1,5 +1,25 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
if( ! function_exists( 'br_get_template_part' ) ){
|
5 |
/**
|
1 |
<?php
|
2 |
|
3 |
+
if( ! function_exists( 'br_get_woocommerce_version' ) ){
|
4 |
+
/**
|
5 |
+
* Public function to get WooCommerce version
|
6 |
+
*
|
7 |
+
* @return float|NULL
|
8 |
+
*/
|
9 |
+
function br_get_woocommerce_version() {
|
10 |
+
if ( ! function_exists( 'get_plugins' ) )
|
11 |
+
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
12 |
+
|
13 |
+
$plugin_folder = get_plugins( '/' . 'woocommerce' );
|
14 |
+
$plugin_file = 'woocommerce.php';
|
15 |
+
|
16 |
+
if ( isset( $plugin_folder[$plugin_file]['Version'] ) ) {
|
17 |
+
return $plugin_folder[$plugin_file]['Version'];
|
18 |
+
} else {
|
19 |
+
return NULL;
|
20 |
+
}
|
21 |
+
}
|
22 |
+
}
|
23 |
|
24 |
if( ! function_exists( 'br_get_template_part' ) ){
|
25 |
/**
|
includes/widget.php
CHANGED
@@ -6,11 +6,12 @@ define('BEROCKETAAPF', 'BeRocket_AAPF_Widget');
|
|
6 |
function BeRocket_AAPF_load_widgets() {
|
7 |
register_widget( 'BeRocket_AAPF_widget' );
|
8 |
}
|
9 |
-
|
10 |
-
|
11 |
-
add_action( '
|
12 |
-
add_action( '
|
13 |
-
|
|
|
14 |
|
15 |
/**
|
16 |
* BeRocket_AAPF_Widget - main filter widget. One filter for any needs
|
@@ -22,13 +23,13 @@ class BeRocket_AAPF_Widget extends WP_Widget {
|
|
22 |
*/
|
23 |
function BeRocket_AAPF_Widget() {
|
24 |
/* Widget settings. */
|
25 |
-
$widget_ops = array( 'classname' => 'widget_berocket_aapf', 'description' => 'Add Filters to Products page' );
|
26 |
|
27 |
/* Widget control settings. */
|
28 |
$control_ops = array( 'id_base' => 'berocket_aapf_widget' );
|
29 |
|
30 |
/* Create the widget. */
|
31 |
-
$this->WP_Widget( 'berocket_aapf_widget', 'AJAX Product Filters', $widget_ops, $control_ops );
|
32 |
|
33 |
add_filter( 'berocket_aapf_listener_wp_query_args', 'br_aapf_args_parser' );
|
34 |
}
|
@@ -45,19 +46,19 @@ class BeRocket_AAPF_Widget extends WP_Widget {
|
|
45 |
|
46 |
global $wp_query, $wp;
|
47 |
|
48 |
-
wp_register_style( 'berocket_aapf_widget-style', plugins_url( '../css/widget.css', __FILE__ ) );
|
49 |
wp_enqueue_style( 'berocket_aapf_widget-style' );
|
50 |
|
51 |
/* custom scrollbar */
|
52 |
-
wp_enqueue_script( 'berocket_aapf_widget-scroll-script', plugins_url( '../js/scrollbar/Scrollbar.concat.min.js', __FILE__ ), array( 'jquery' ) );
|
53 |
-
wp_register_style( 'berocket_aapf_widget-scroll-style', plugins_url( '../css/scrollbar/Scrollbar.min.css', __FILE__ ) );
|
54 |
wp_enqueue_style( 'berocket_aapf_widget-scroll-style' );
|
55 |
|
56 |
/* main scripts */
|
57 |
wp_enqueue_script( 'jquery-ui-core' );
|
58 |
wp_enqueue_script( 'jquery-ui-slider' );
|
59 |
-
wp_enqueue_script( 'berocket_aapf_widget-script', plugins_url( '../js/widget.min.js', __FILE__ ), array( 'jquery' ) );
|
60 |
-
wp_enqueue_script( 'berocket_aapf_widget-hack-script', plugins_url( '../js/mobiles.min.js', __FILE__ ), array( 'jquery' ) );
|
61 |
|
62 |
$wp_query_product_cat = '-1';
|
63 |
if ( @ $wp_query->query['product_cat'] ) {
|
@@ -87,6 +88,8 @@ class BeRocket_AAPF_Widget extends WP_Widget {
|
|
87 |
'default_sorting' => get_option('woocommerce_default_catalog_orderby'),
|
88 |
'first_page' => @ $br_options['first_page_jump'],
|
89 |
'scroll_shop_top' => @ $br_options['scroll_shop_top'],
|
|
|
|
|
90 |
)
|
91 |
);
|
92 |
|
@@ -184,6 +187,8 @@ class BeRocket_AAPF_Widget extends WP_Widget {
|
|
184 |
set_query_var( 'style', apply_filters( 'berocket_aapf_widget_style', $style ) );
|
185 |
set_query_var( 'scroll_theme', $scroll_theme );
|
186 |
set_query_var( 'x', time() );
|
|
|
|
|
187 |
|
188 |
// widget title and start tag ( <ul> ) can be found in templates/widget_start.php
|
189 |
br_get_template_part('widget_start');
|
@@ -289,6 +294,15 @@ class BeRocket_AAPF_Widget extends WP_Widget {
|
|
289 |
if ( $meta_values[0] or $woocommerce_hide_out_of_stock_items != 'yes' ) {
|
290 |
$price_range[] = $meta_values[0];
|
291 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
292 |
}
|
293 |
|
294 |
if ( @ count( $price_range ) < 2 ) {
|
@@ -432,8 +446,8 @@ class BeRocket_AAPF_Widget extends WP_Widget {
|
|
432 |
* @return string|void
|
433 |
*/
|
434 |
function form( $instance ) {
|
435 |
-
wp_enqueue_script( 'berocket_aapf_widget-admin-script', plugins_url('../js/admin.js', __FILE__), array('jquery') );
|
436 |
-
wp_register_style( 'berocket_aapf_widget-style', plugins_url('../css/admin.css', __FILE__) );
|
437 |
wp_enqueue_style( 'berocket_aapf_widget-style' );
|
438 |
|
439 |
/* Set up some default widget settings. */
|
@@ -492,38 +506,70 @@ class BeRocket_AAPF_Widget extends WP_Widget {
|
|
492 |
$wp_query = new WP_Query( $args );
|
493 |
}
|
494 |
|
495 |
-
|
|
|
496 |
|
497 |
-
|
498 |
|
499 |
-
|
500 |
|
501 |
-
|
502 |
-
|
503 |
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
|
509 |
-
|
510 |
|
511 |
-
|
512 |
|
513 |
-
|
514 |
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
|
519 |
-
|
|
|
|
|
520 |
}
|
521 |
-
ob_end_clean();
|
522 |
|
523 |
echo json_encode( $_RESPONSE );
|
524 |
|
525 |
die();
|
526 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
527 |
|
528 |
function get_product_categories( $current_product_cat = '', $parent = 0, $data = array(), $depth = 0 ) {
|
529 |
$args = array(
|
6 |
function BeRocket_AAPF_load_widgets() {
|
7 |
register_widget( 'BeRocket_AAPF_widget' );
|
8 |
}
|
9 |
+
require_once dirname( __FILE__ ).'/functions.php';
|
10 |
+
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) && br_get_woocommerce_version() >= 2.1 ) {
|
11 |
+
add_action( 'widgets_init', 'BeRocket_AAPF_load_widgets' );
|
12 |
+
add_action( 'wp_ajax_nopriv_berocket_aapf_listener', array( 'BeRocket_AAPF_Widget', 'listener' ) );
|
13 |
+
add_action( 'wp_ajax_berocket_aapf_listener', array( 'BeRocket_AAPF_Widget', 'listener' ) );
|
14 |
+
}
|
15 |
|
16 |
/**
|
17 |
* BeRocket_AAPF_Widget - main filter widget. One filter for any needs
|
23 |
*/
|
24 |
function BeRocket_AAPF_Widget() {
|
25 |
/* Widget settings. */
|
26 |
+
$widget_ops = array( 'classname' => 'widget_berocket_aapf', 'description' => __('Add Filters to Products page', BeRocket_AJAX_domain) );
|
27 |
|
28 |
/* Widget control settings. */
|
29 |
$control_ops = array( 'id_base' => 'berocket_aapf_widget' );
|
30 |
|
31 |
/* Create the widget. */
|
32 |
+
$this->WP_Widget( 'berocket_aapf_widget', __('AJAX Product Filters', BeRocket_AJAX_domain), $widget_ops, $control_ops );
|
33 |
|
34 |
add_filter( 'berocket_aapf_listener_wp_query_args', 'br_aapf_args_parser' );
|
35 |
}
|
46 |
|
47 |
global $wp_query, $wp;
|
48 |
|
49 |
+
wp_register_style( 'berocket_aapf_widget-style', plugins_url( '../css/widget.css', __FILE__ ), array(), BeRocket_AJAX_filters_version );
|
50 |
wp_enqueue_style( 'berocket_aapf_widget-style' );
|
51 |
|
52 |
/* custom scrollbar */
|
53 |
+
wp_enqueue_script( 'berocket_aapf_widget-scroll-script', plugins_url( '../js/scrollbar/Scrollbar.concat.min.js', __FILE__ ), array( 'jquery' ), BeRocket_AJAX_filters_version );
|
54 |
+
wp_register_style( 'berocket_aapf_widget-scroll-style', plugins_url( '../css/scrollbar/Scrollbar.min.css', __FILE__ ), array(), BeRocket_AJAX_filters_version );
|
55 |
wp_enqueue_style( 'berocket_aapf_widget-scroll-style' );
|
56 |
|
57 |
/* main scripts */
|
58 |
wp_enqueue_script( 'jquery-ui-core' );
|
59 |
wp_enqueue_script( 'jquery-ui-slider' );
|
60 |
+
wp_enqueue_script( 'berocket_aapf_widget-script', plugins_url( '../js/widget.min.js', __FILE__ ), array( 'jquery' ), BeRocket_AJAX_filters_version );
|
61 |
+
wp_enqueue_script( 'berocket_aapf_widget-hack-script', plugins_url( '../js/mobiles.min.js', __FILE__ ), array( 'jquery' ), BeRocket_AJAX_filters_version );
|
62 |
|
63 |
$wp_query_product_cat = '-1';
|
64 |
if ( @ $wp_query->query['product_cat'] ) {
|
88 |
'default_sorting' => get_option('woocommerce_default_catalog_orderby'),
|
89 |
'first_page' => @ $br_options['first_page_jump'],
|
90 |
'scroll_shop_top' => @ $br_options['scroll_shop_top'],
|
91 |
+
'hide_sel_value' => @ $br_options['hide_value']['sel'],
|
92 |
+
'ajax_request_load' => @ $br_options['ajax_request_load'],
|
93 |
)
|
94 |
);
|
95 |
|
187 |
set_query_var( 'style', apply_filters( 'berocket_aapf_widget_style', $style ) );
|
188 |
set_query_var( 'scroll_theme', $scroll_theme );
|
189 |
set_query_var( 'x', time() );
|
190 |
+
set_query_var( 'hide_o_value', @ $br_options['hide_value']['o'] );
|
191 |
+
set_query_var( 'hide_sel_value', @ $br_options['hide_value']['sel'] );
|
192 |
|
193 |
// widget title and start tag ( <ul> ) can be found in templates/widget_start.php
|
194 |
br_get_template_part('widget_start');
|
294 |
if ( $meta_values[0] or $woocommerce_hide_out_of_stock_items != 'yes' ) {
|
295 |
$price_range[] = $meta_values[0];
|
296 |
}
|
297 |
+
$product_variation = get_children ( array ( 'post_parent' => $ID, 'post_type' => 'product_variation', 'numberposts' => -1, 'post_status' => 'any' ) );
|
298 |
+
if ( is_array( $product_variation ) ) {
|
299 |
+
foreach ( $product_variation as $variation ) {
|
300 |
+
$meta_values = get_post_meta( $variation->ID, '_price' );
|
301 |
+
if ( $meta_values[0] or $woocommerce_hide_out_of_stock_items != 'yes' ) {
|
302 |
+
$price_range[] = $meta_values[0];
|
303 |
+
}
|
304 |
+
}
|
305 |
+
}
|
306 |
}
|
307 |
|
308 |
if ( @ count( $price_range ) < 2 ) {
|
446 |
* @return string|void
|
447 |
*/
|
448 |
function form( $instance ) {
|
449 |
+
wp_enqueue_script( 'berocket_aapf_widget-admin-script', plugins_url('../js/admin.js', __FILE__), array('jquery'), BeRocket_AJAX_filters_version );
|
450 |
+
wp_register_style( 'berocket_aapf_widget-style', plugins_url('../css/admin.css', __FILE__), array(), BeRocket_AJAX_filters_version );
|
451 |
wp_enqueue_style( 'berocket_aapf_widget-style' );
|
452 |
|
453 |
/* Set up some default widget settings. */
|
506 |
$wp_query = new WP_Query( $args );
|
507 |
}
|
508 |
|
509 |
+
if( @ ! $br_options['ajax_request_load'] ) {
|
510 |
+
ob_start();
|
511 |
|
512 |
+
if ( $wp_query->have_posts() ) {
|
513 |
|
514 |
+
do_action('woocommerce_before_shop_loop');
|
515 |
|
516 |
+
woocommerce_product_loop_start();
|
517 |
+
woocommerce_product_subcategories();
|
518 |
|
519 |
+
while ( have_posts() ) {
|
520 |
+
the_post();
|
521 |
+
wc_get_template_part( 'content', 'product' );
|
522 |
+
}
|
523 |
|
524 |
+
woocommerce_product_loop_end();
|
525 |
|
526 |
+
do_action('woocommerce_after_shop_loop');
|
527 |
|
528 |
+
wp_reset_postdata();
|
529 |
|
530 |
+
$_RESPONSE['products'] = ob_get_contents();
|
531 |
+
} else {
|
532 |
+
echo apply_filters( 'berocket_aapf_listener_no_products_message', "<div class='no-products" . ( ( $br_options['no_products_class'] ) ? ' '.$br_options['no_products_class'] : '' ) . "'>" . $br_options['no_products_message'] . "</div>" );
|
533 |
|
534 |
+
$_RESPONSE['no_products'] = ob_get_contents();
|
535 |
+
}
|
536 |
+
ob_end_clean();
|
537 |
}
|
|
|
538 |
|
539 |
echo json_encode( $_RESPONSE );
|
540 |
|
541 |
die();
|
542 |
}
|
543 |
+
public static function woocommerce_before_main_content() {
|
544 |
+
?>||EXPLODE||<?php
|
545 |
+
}
|
546 |
+
public static function woocommerce_after_main_content() {
|
547 |
+
?>||EXPLODE||<?php
|
548 |
+
}
|
549 |
+
public static function pre_get_posts() {
|
550 |
+
add_action('woocommerce_before_shop_loop', array( __CLASS__, 'woocommerce_before_main_content' ), 1);
|
551 |
+
add_action('woocommerce_after_shop_loop', array( __CLASS__, 'woocommerce_after_main_content' ), 999999);
|
552 |
+
}
|
553 |
+
public static function end_clean() {
|
554 |
+
$_RESPONSE['products'] = explode('||EXPLODE||', ob_get_contents())[1];
|
555 |
+
ob_end_clean();
|
556 |
+
global $wp_query, $wp_rewrite;
|
557 |
+
$br_options = apply_filters( 'berocket_aapf_listener_br_options', get_option('br_filters_options') );
|
558 |
+
|
559 |
+
if( $_RESPONSE['products'] == null ) {
|
560 |
+
unset( $_RESPONSE['products'] );
|
561 |
+
ob_start();
|
562 |
+
echo apply_filters( 'berocket_aapf_listener_no_products_message', "<p class='no-products woocommerce-info" . ( ( $br_options['no_products_class'] ) ? ' '.$br_options['no_products_class'] : '' ) . "'>" . $br_options['no_products_message'] . "</p>" );
|
563 |
+
$_RESPONSE['no_products'] = ob_get_contents();
|
564 |
+
ob_end_clean();
|
565 |
+
}
|
566 |
+
echo json_encode( $_RESPONSE );
|
567 |
+
|
568 |
+
die();
|
569 |
+
}
|
570 |
+
public static function start_clean() {
|
571 |
+
ob_start();
|
572 |
+
}
|
573 |
|
574 |
function get_product_categories( $current_product_cat = '', $parent = 0, $data = array(), $depth = 0 ) {
|
575 |
$args = array(
|
js/admin.js
CHANGED
@@ -43,6 +43,7 @@
|
|
43 |
|
44 |
$('.filter_settings_tabs').on('click', 'a', function (event) {
|
45 |
event.preventDefault();
|
|
|
46 |
$id = $(this).attr('href');
|
47 |
$('.tab-item.current').removeClass('current');
|
48 |
$($id).addClass('current');
|
43 |
|
44 |
$('.filter_settings_tabs').on('click', 'a', function (event) {
|
45 |
event.preventDefault();
|
46 |
+
$('#br_opened_tab').val( $(this).attr('href').replace('#', '') );
|
47 |
$id = $(this).attr('href');
|
48 |
$('.tab-item.current').removeClass('current');
|
49 |
$($id).addClass('current');
|
js/widget.min.js
CHANGED
@@ -9,11 +9,11 @@
|
|
9 |
woocommerce_pagination_page = 1,
|
10 |
berocket_aapf_widget_wait_for_button = false,
|
11 |
berocket_aapf_widget_selected_filters = [],
|
12 |
-
berocket_aapf_widget_first_page_jump =
|
13 |
berocket_aapf_widget_scroll_shop_top = the_ajax_script.scroll_shop_top;
|
14 |
|
15 |
if( $('.woocommerce-pagination').hasClass('.woocommerce-pagination') ){
|
16 |
-
woocommerce_pagination_page = parseInt( $('.woocommerce-pagination .current').text() );
|
17 |
if( woocommerce_pagination_page < 1 ) woocommerce_pagination_page = 1;
|
18 |
}
|
19 |
|
@@ -177,12 +177,12 @@
|
|
177 |
}else{
|
178 |
args.location = the_ajax_script.current_page_url;
|
179 |
|
180 |
-
cur_page = $('.woocommerce-pagination span.current').text();
|
181 |
if( prev_page = location.href.replace(/.+\/page\/([0-9]+).+/, "$1") ){
|
182 |
if( ! parseInt( cur_page ) ){
|
183 |
cur_page = prev_page;
|
184 |
}
|
185 |
-
if(berocket_aapf_widget_first_page_jump) {
|
186 |
cur_page = 1;
|
187 |
}
|
188 |
args.location = args.location.replace(/\/?/,"") + "/page/" + cur_page + "/";
|
@@ -190,7 +190,7 @@
|
|
190 |
if( ! parseInt( cur_page ) ){
|
191 |
cur_page = prev_page;
|
192 |
}
|
193 |
-
if(berocket_aapf_widget_first_page_jump) {
|
194 |
cur_page = 1;
|
195 |
}
|
196 |
args.location = args.location.replace(/\/?/,"") + "/?page=" + cur_page + "";
|
@@ -214,7 +214,26 @@
|
|
214 |
}
|
215 |
$("html, body").animate({ scrollTop: top_scroll_offset }, "slow");
|
216 |
}
|
217 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
$('.woocommerce-result-count').remove();
|
219 |
$('.woocommerce-pagination').remove();
|
220 |
$('form.woocommerce-ordering').remove();
|
@@ -237,6 +256,7 @@
|
|
237 |
|
238 |
$('.berocket_aapf_widget_loading').remove();
|
239 |
|
|
|
240 |
aapf_action_init();
|
241 |
|
242 |
// call user func after_update
|
@@ -245,7 +265,8 @@
|
|
245 |
}, "json");
|
246 |
}
|
247 |
|
248 |
-
function updateLocation( args, pushstate ){
|
|
|
249 |
uri_request_array = [];
|
250 |
uri_request = '';
|
251 |
temp_terms = [];
|
@@ -328,12 +349,12 @@
|
|
328 |
return uri_request;
|
329 |
}
|
330 |
|
331 |
-
cur_page = $('.woocommerce-pagination span.current').text();
|
332 |
if( prev_page = parseInt( location.href.replace(/.+\/page\/([0-9]+).+/, "$1") ) ){
|
333 |
if( ! parseInt( cur_page ) ){
|
334 |
cur_page = prev_page;
|
335 |
}
|
336 |
-
if(berocket_aapf_widget_first_page_jump) {
|
337 |
cur_page = 1;
|
338 |
}
|
339 |
uri = uri.replace(/\/?$/,"") + "/page/" + cur_page + "/";
|
@@ -373,7 +394,7 @@
|
|
373 |
}
|
374 |
}
|
375 |
}
|
376 |
-
if(berocket_aapf_widget_first_page_jump) {
|
377 |
cur_page = 1;
|
378 |
}
|
379 |
if( something_added && uri_request ){
|
@@ -386,14 +407,20 @@
|
|
386 |
if( cur_page > 1 ){
|
387 |
uri = uri + "&paged=" + parseInt( cur_page );
|
388 |
}
|
|
|
|
|
389 |
}else if( cur_page > 1 ){
|
390 |
uri = uri + "/?paged=" + parseInt( cur_page );
|
391 |
}
|
392 |
}
|
393 |
|
394 |
-
|
395 |
-
|
396 |
-
|
|
|
|
|
|
|
|
|
397 |
}
|
398 |
|
399 |
function aapf_action_init(){
|
@@ -401,14 +428,15 @@
|
|
401 |
$('.woocommerce-pagination').on('click', 'a', function (event) {
|
402 |
event.preventDefault();
|
403 |
if ( $(this).hasClass('next') ) {
|
404 |
-
_next_page = parseInt( $('.woocommerce-pagination span.current').text() ) + 1;
|
405 |
} else if ( $(this).hasClass('prev') ) {
|
406 |
-
_next_page = parseInt( $('.woocommerce-pagination span.current').text() ) - 1;
|
407 |
} else {
|
408 |
_next_page = $(this).text();
|
409 |
}
|
410 |
$('.woocommerce-pagination span.current').removeClass('current');
|
411 |
$(this).after("<span class='page-numbers current'>"+_next_page+"</span>").remove();
|
|
|
412 |
updateProducts(true);
|
413 |
});
|
414 |
}
|
@@ -427,17 +455,44 @@
|
|
427 |
$('.berocket_aapf_widget').on("change", "input, select", function(){
|
428 |
if($(this).attr('type') == 'checkbox' || $(this).attr('type') == 'radio')
|
429 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
430 |
if($(this).prop('checked'))
|
431 |
{
|
432 |
-
$('.'+$
|
|
|
|
|
|
|
433 |
}
|
434 |
else
|
435 |
{
|
436 |
-
$('.'+$
|
437 |
}
|
438 |
} else if($(this).is('select'))
|
439 |
{
|
440 |
-
$('select.'+$(this).data('taxonomy')).val($(this).find('option:selected').val());
|
441 |
}
|
442 |
updateProducts();
|
443 |
});
|
@@ -536,15 +591,26 @@
|
|
536 |
$(document).on('click', '.berocket_label_widgets', function(event) {
|
537 |
if( $(this).prev('input').attr('type') == 'checkbox' || $(this).prev('input').attr('type') == 'radio' ) {
|
538 |
event.preventDefault();
|
539 |
-
|
540 |
-
$('.'+$(this).attr('for')).prop('checked', false);
|
541 |
-
} else {
|
542 |
-
$('.'+$(this).attr('for')).prop('checked', true);
|
543 |
-
}
|
544 |
$(this).prev('input').trigger('change');
|
545 |
}
|
546 |
});
|
547 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
548 |
});
|
549 |
})(jQuery);
|
550 |
|
9 |
woocommerce_pagination_page = 1,
|
10 |
berocket_aapf_widget_wait_for_button = false,
|
11 |
berocket_aapf_widget_selected_filters = [],
|
12 |
+
berocket_aapf_widget_first_page_jump = true,
|
13 |
berocket_aapf_widget_scroll_shop_top = the_ajax_script.scroll_shop_top;
|
14 |
|
15 |
if( $('.woocommerce-pagination').hasClass('.woocommerce-pagination') ){
|
16 |
+
woocommerce_pagination_page = parseInt( $('.woocommerce-pagination .current').first().text() );
|
17 |
if( woocommerce_pagination_page < 1 ) woocommerce_pagination_page = 1;
|
18 |
}
|
19 |
|
177 |
}else{
|
178 |
args.location = the_ajax_script.current_page_url;
|
179 |
|
180 |
+
cur_page = $('.woocommerce-pagination span.current').first().text();
|
181 |
if( prev_page = location.href.replace(/.+\/page\/([0-9]+).+/, "$1") ){
|
182 |
if( ! parseInt( cur_page ) ){
|
183 |
cur_page = prev_page;
|
184 |
}
|
185 |
+
if(berocket_aapf_widget_first_page_jump && the_ajax_script.first_page) {
|
186 |
cur_page = 1;
|
187 |
}
|
188 |
args.location = args.location.replace(/\/?/,"") + "/page/" + cur_page + "/";
|
190 |
if( ! parseInt( cur_page ) ){
|
191 |
cur_page = prev_page;
|
192 |
}
|
193 |
+
if(berocket_aapf_widget_first_page_jump && the_ajax_script.first_page) {
|
194 |
cur_page = 1;
|
195 |
}
|
196 |
args.location = args.location.replace(/\/?/,"") + "/?page=" + cur_page + "";
|
214 |
}
|
215 |
$("html, body").animate({ scrollTop: top_scroll_offset }, "slow");
|
216 |
}
|
217 |
+
args.location = updateLocation(args, true, true);
|
218 |
+
if(the_ajax_script.ajax_request_load) {
|
219 |
+
if( args.location.indexOf('?') > 0 ) {
|
220 |
+
url = args.location+'&explode=explode';
|
221 |
+
} else {
|
222 |
+
url = args.location+'/?explode=explode';
|
223 |
+
}
|
224 |
+
} else {
|
225 |
+
url = the_ajax_script.ajaxurl;
|
226 |
+
}
|
227 |
+
if(the_ajax_script.ajax_request_load) {
|
228 |
+
args.terms = '';
|
229 |
+
args.price = '';
|
230 |
+
args.limits = '';
|
231 |
+
args.product_cat = '';
|
232 |
+
args.action = '';
|
233 |
+
args.orderby = '';
|
234 |
+
args.orderby = '';
|
235 |
+
}
|
236 |
+
$.post(url, args, function (data) {
|
237 |
$('.woocommerce-result-count').remove();
|
238 |
$('.woocommerce-pagination').remove();
|
239 |
$('form.woocommerce-ordering').remove();
|
256 |
|
257 |
$('.berocket_aapf_widget_loading').remove();
|
258 |
|
259 |
+
berocket_aapf_widget_first_page_jump = true;
|
260 |
aapf_action_init();
|
261 |
|
262 |
// call user func after_update
|
265 |
}, "json");
|
266 |
}
|
267 |
|
268 |
+
function updateLocation( args, pushstate, return_request ){
|
269 |
+
if(typeof return_request == 'undefined') return_request = false;
|
270 |
uri_request_array = [];
|
271 |
uri_request = '';
|
272 |
temp_terms = [];
|
349 |
return uri_request;
|
350 |
}
|
351 |
|
352 |
+
cur_page = $('.woocommerce-pagination span.current').first().text();
|
353 |
if( prev_page = parseInt( location.href.replace(/.+\/page\/([0-9]+).+/, "$1") ) ){
|
354 |
if( ! parseInt( cur_page ) ){
|
355 |
cur_page = prev_page;
|
356 |
}
|
357 |
+
if(berocket_aapf_widget_first_page_jump && the_ajax_script.first_page) {
|
358 |
cur_page = 1;
|
359 |
}
|
360 |
uri = uri.replace(/\/?$/,"") + "/page/" + cur_page + "/";
|
394 |
}
|
395 |
}
|
396 |
}
|
397 |
+
if(berocket_aapf_widget_first_page_jump && the_ajax_script.first_page) {
|
398 |
cur_page = 1;
|
399 |
}
|
400 |
if( something_added && uri_request ){
|
407 |
if( cur_page > 1 ){
|
408 |
uri = uri + "&paged=" + parseInt( cur_page );
|
409 |
}
|
410 |
+
}else if( something_added && cur_page > 1 ){
|
411 |
+
uri = uri + "&paged=" + parseInt( cur_page );
|
412 |
}else if( cur_page > 1 ){
|
413 |
uri = uri + "/?paged=" + parseInt( cur_page );
|
414 |
}
|
415 |
}
|
416 |
|
417 |
+
if( return_request ) {
|
418 |
+
return uri;
|
419 |
+
} else {
|
420 |
+
var stateParameters = { BeRocket: "Rules" };
|
421 |
+
history.pushState(stateParameters, "BeRocket Rules", uri);
|
422 |
+
history.pathname = uri;
|
423 |
+
}
|
424 |
}
|
425 |
|
426 |
function aapf_action_init(){
|
428 |
$('.woocommerce-pagination').on('click', 'a', function (event) {
|
429 |
event.preventDefault();
|
430 |
if ( $(this).hasClass('next') ) {
|
431 |
+
_next_page = parseInt( $('.woocommerce-pagination span.current').first().text() ) + 1;
|
432 |
} else if ( $(this).hasClass('prev') ) {
|
433 |
+
_next_page = parseInt( $('.woocommerce-pagination span.current').first().text() ) - 1;
|
434 |
} else {
|
435 |
_next_page = $(this).text();
|
436 |
}
|
437 |
$('.woocommerce-pagination span.current').removeClass('current');
|
438 |
$(this).after("<span class='page-numbers current'>"+_next_page+"</span>").remove();
|
439 |
+
berocket_aapf_widget_first_page_jump = false;
|
440 |
updateProducts(true);
|
441 |
});
|
442 |
}
|
455 |
$('.berocket_aapf_widget').on("change", "input, select", function(){
|
456 |
if($(this).attr('type') == 'checkbox' || $(this).attr('type') == 'radio')
|
457 |
{
|
458 |
+
$label = $(this).parents('li').find('.berocket_label_widgets');
|
459 |
+
if( $label.parents('li').find('input').prop('checked')) {
|
460 |
+
$('.'+$label.attr('for')).prop('checked', false);
|
461 |
+
$('.'+$label.attr('for')).parents('li').removeClass('berocket_hide_sel_value');
|
462 |
+
} else {
|
463 |
+
$('.'+$label.attr('for')).prop('checked', true);
|
464 |
+
if( $label.parents('li').find('input').attr('type') == 'radio' ) {
|
465 |
+
$('.'+$label.attr('for')).parents('.berocket_aapf_widget').find('li').removeClass('berocket_hide_sel_value');
|
466 |
+
}
|
467 |
+
if( the_ajax_script.hide_sel_value ) {
|
468 |
+
$('.'+$label.attr('for')).parents('li').addClass('berocket_hide_sel_value');
|
469 |
+
}
|
470 |
+
$label.addClass('berocket_checked');
|
471 |
+
}
|
472 |
+
$('.'+$label.attr('for')).parents('ul').find('input').trigger('refresh');
|
473 |
+
if( the_ajax_script.hide_sel_value ) {
|
474 |
+
$hiden_objects = $(this).parents('.berocket_aapf_widget').find('.berocket_hide_o_value, .berocket_hide_sel_value');
|
475 |
+
if( $hiden_objects.length == 0 ) {
|
476 |
+
$(this).parents('.berocket_aapf_widget').find('.berocket_widget_show_values').hide();
|
477 |
+
} else {
|
478 |
+
$(this).parents('.berocket_aapf_widget').find('.berocket_widget_show_values').show();
|
479 |
+
}
|
480 |
+
}
|
481 |
+
|
482 |
if($(this).prop('checked'))
|
483 |
{
|
484 |
+
$('.'+$label.attr('for')).prop('checked', true).trigger('refresh');
|
485 |
+
if( the_ajax_script.hide_sel_value ) {
|
486 |
+
$('.'+$label.attr('for')).parents('li').addClass('berocket_hide_sel_value');
|
487 |
+
}
|
488 |
}
|
489 |
else
|
490 |
{
|
491 |
+
$('.'+$label.attr('for')).prop('checked', false).trigger('refresh').parents('li').removeClass('berocket_hide_sel_value');
|
492 |
}
|
493 |
} else if($(this).is('select'))
|
494 |
{
|
495 |
+
$('select.'+$(this).data('taxonomy')).val($(this).find('option:selected').val()).trigger('refresh');
|
496 |
}
|
497 |
updateProducts();
|
498 |
});
|
591 |
$(document).on('click', '.berocket_label_widgets', function(event) {
|
592 |
if( $(this).prev('input').attr('type') == 'checkbox' || $(this).prev('input').attr('type') == 'radio' ) {
|
593 |
event.preventDefault();
|
594 |
+
event.stopPropagation();
|
|
|
|
|
|
|
|
|
595 |
$(this).prev('input').trigger('change');
|
596 |
}
|
597 |
});
|
598 |
|
599 |
+
$('.berocket_aapf_widget .berocket_widget_show_values').click(function(event)
|
600 |
+
{
|
601 |
+
event.preventDefault();
|
602 |
+
var widget_block = $(this).parents('ul.berocket_aapf_widget');
|
603 |
+
if(widget_block.hasClass('show_o_sel_values'))
|
604 |
+
{
|
605 |
+
widget_block.removeClass('show_o_sel_values');
|
606 |
+
$(this).find('span').removeClass('hide_button').addClass('show_button');
|
607 |
+
}
|
608 |
+
else
|
609 |
+
{
|
610 |
+
widget_block.addClass('show_o_sel_values');
|
611 |
+
$(this).find('span').removeClass('show_button').addClass('hide_button');
|
612 |
+
}
|
613 |
+
});
|
614 |
});
|
615 |
})(jQuery);
|
616 |
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Donate link: http://berocket.com
|
|
5 |
Tags: filters, product filters, ajax product filters, advanced product filters, woocommerce filters, woocommerce product filters, woocommerce ajax product filters, widget, plugin
|
6 |
Requires at least: 4.0
|
7 |
Tested up to: 4.2.2
|
8 |
-
Stable tag: 1.1.0.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -30,14 +30,22 @@ WooCommerce AJAX Product Filters - advanced AJAX product filters plugin for WooC
|
|
30 |
|
31 |
= Additional Features in Paid Plugin: =
|
32 |
|
33 |
-
* Filter by Attribute, Tag and
|
34 |
* Customize filters look through admin
|
|
|
35 |
* Tag Cloud for Tag filter
|
|
|
36 |
* Slider can use strings as a value
|
37 |
* Filters can be collapsed by clicking on title, option to collapse filter on start
|
38 |
* Price Filter Custom Min and Max values
|
39 |
* Add custom CSS on admin settings page
|
40 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
= Paid Plugin Link =
|
43 |
http://berocket.com/product/woocommerce-ajax-products-filter
|
@@ -131,6 +139,14 @@ http://woocommerce-product-filter.berocket.com
|
|
131 |
|
132 |
== Changelog ==
|
133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
= 1.1.0.6 =
|
135 |
* Enhancement - Scroll to the top
|
136 |
* Enhancement/Fix - Hash for old browsers added for better support
|
5 |
Tags: filters, product filters, ajax product filters, advanced product filters, woocommerce filters, woocommerce product filters, woocommerce ajax product filters, widget, plugin
|
6 |
Requires at least: 4.0
|
7 |
Tested up to: 4.2.2
|
8 |
+
Stable tag: 1.1.0.7
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
30 |
|
31 |
= Additional Features in Paid Plugin: =
|
32 |
|
33 |
+
* Filter by Attribute, Tag, Custom Taxonomy, Color, Sub-categories and Availability( in stock | out of stock | any )
|
34 |
* Customize filters look through admin
|
35 |
+
* Option to re-count products amount in values when some value selected
|
36 |
* Tag Cloud for Tag filter
|
37 |
+
* Description can be added for the attributes
|
38 |
* Slider can use strings as a value
|
39 |
* Filters can be collapsed by clicking on title, option to collapse filter on start
|
40 |
* Price Filter Custom Min and Max values
|
41 |
* Add custom CSS on admin settings page
|
42 |
+
* Show icons before/after widget title and/or before/after values
|
43 |
+
* Option to upload "Loading..." gif image and set label after/before/above/under it
|
44 |
+
* Show icons before/after widget title and/or before/after values
|
45 |
+
* Scroll top position can be controlled by the admin
|
46 |
+
* Option to hide on mobile devices
|
47 |
+
* Much better support for custom theme
|
48 |
+
* Enhancements of the free features
|
49 |
|
50 |
= Paid Plugin Link =
|
51 |
http://berocket.com/product/woocommerce-ajax-products-filter
|
139 |
|
140 |
== Changelog ==
|
141 |
|
142 |
+
= 1.1.0.7 =
|
143 |
+
* Enhancement - Option to hide selected values and/or without products. Add at the bottom button to show them
|
144 |
+
* Enhancement - Filters are using product variations now
|
145 |
+
* Enhancement - translation( WPML ) support
|
146 |
+
* Enhancement/Fix - radio-box had issues and there was no chance to remove selection
|
147 |
+
* Fix - Pagination has issues with link building
|
148 |
+
* Fix - Jump to first page wasn't working correctly and jump each time even when user want to change page
|
149 |
+
|
150 |
= 1.1.0.6 =
|
151 |
* Enhancement - Scroll to the top
|
152 |
* Enhancement/Fix - Hash for old browsers added for better support
|
templates/admin-settings.php
CHANGED
@@ -3,72 +3,83 @@
|
|
3 |
<?php
|
4 |
settings_fields('br_filters_plugin_options');
|
5 |
$options = get_option('br_filters_options');
|
|
|
6 |
?>
|
7 |
<h2 class="nav-tab-wrapper filter_settings_tabs">
|
8 |
-
<a href="#general" class="nav-tab nav-tab-active"
|
9 |
-
<a href="#design" class="nav-tab"
|
10 |
-
<a href="#javascript" class="nav-tab"
|
11 |
-
<a href="#customcss" class="nav-tab"
|
12 |
</h2>
|
13 |
-
<div id="general" class="tab-item current">
|
14 |
<table class="form-table">
|
15 |
<tr>
|
16 |
-
<th scope="row"
|
17 |
<td>
|
18 |
<input size="50" name="br_filters_options[no_products_message]" type='text' value='<?php echo @$options['no_products_message']?>'/>
|
19 |
<br />
|
20 |
-
<span style="color:#666666;margin-left:2px;"
|
21 |
</td>
|
22 |
</tr>
|
23 |
<tr>
|
24 |
-
<th scope="row"
|
25 |
<td>
|
26 |
<input name="br_filters_options[no_products_class]" type='text' value='<?php echo @$options['no_products_class']?>'/>
|
27 |
<br />
|
28 |
-
<span style="color:#666666;margin-left:2px;"
|
29 |
</td>
|
30 |
</tr>
|
31 |
<tr>
|
32 |
-
<th scope="row"
|
33 |
<td>
|
34 |
<input name="br_filters_options[products_holder_id]" type='text' value='<?php echo @$options['products_holder_id']?$options['products_holder_id']:'ul.products'?>'/>
|
35 |
<br />
|
36 |
-
<span style="color:#666666;margin-left:2px;"
|
37 |
</td>
|
38 |
</tr>
|
39 |
<tr>
|
40 |
-
<th scope="row"
|
41 |
<td>
|
42 |
<input name="br_filters_options[control_sorting]" type='checkbox' value='1' <?php if( @$options['control_sorting'] ) echo "checked='checked'";?>/>
|
43 |
-
<span style="color:#666666;margin-left:2px;"
|
44 |
</td>
|
45 |
</tr>
|
46 |
<tr>
|
47 |
-
<th scope="row"
|
48 |
<td>
|
49 |
<input name="br_filters_options[seo_friendly_urls]" type='checkbox' value='1' <?php if( @$options['seo_friendly_urls'] ) echo "checked='checked'";?>/>
|
50 |
-
<span style="color:#666666;margin-left:2px;"
|
51 |
</td>
|
52 |
</tr>
|
53 |
<tr>
|
54 |
-
<th scope="row"
|
55 |
<td>
|
56 |
<input name="br_filters_options[filters_turn_off]" type='checkbox' value='1' <?php if( @$options['filters_turn_off'] ) echo "checked='checked'";?>/>
|
57 |
-
<span style="color:#666666;margin-left:2px;"
|
58 |
</td>
|
59 |
</tr>
|
60 |
<tr>
|
61 |
-
<th scope="row"
|
62 |
<td>
|
63 |
<input name="br_filters_options[show_all_values]" type='checkbox' value='1' <?php if( @$options['show_all_values'] ) echo "checked='checked'";?>/>
|
64 |
-
<span style="color:#666666;margin-left:2px;"
|
65 |
</td>
|
66 |
</tr>
|
67 |
<tr>
|
68 |
-
<th scope="row"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
<td>
|
70 |
<input name="br_filters_options[first_page_jump]" type='checkbox' value='1' <?php if( @$options['first_page_jump'] ) echo "checked='checked'";?>/>
|
71 |
-
<span style="color:#666666;margin-left:2px;"
|
72 |
</td>
|
73 |
</tr>
|
74 |
<tr>
|
@@ -78,45 +89,53 @@
|
|
78 |
<span style="color:#666666;margin-left:2px;">Check if you want scroll page to the top of shop after filters change</span>
|
79 |
</td>
|
80 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
</table>
|
82 |
</div>
|
83 |
-
<div id="design" class="tab-item">
|
84 |
<a href="http://berocket.com/product/woocommerce-ajax-products-filter" target="_blank">
|
85 |
<img src="<?php echo AAPF_URL; ?>images/paid/styler.png" style="max-width: 100%;" />
|
86 |
</a>
|
87 |
</div>
|
88 |
-
<div id="javascript" class="tab-item">
|
89 |
<table class="form-table">
|
90 |
<tr>
|
91 |
-
<th scope="row"
|
92 |
<td>
|
93 |
<textarea style="min-width: 500px; height: 100px;" name="br_filters_options[user_func][before_update]"><?php echo @$options['user_func']['before_update'] ?></textarea>
|
94 |
<br />
|
95 |
-
<span style="color:#666666;margin-left:2px;"
|
96 |
</td>
|
97 |
</tr>
|
98 |
<tr>
|
99 |
-
<th scope="row"
|
100 |
<td>
|
101 |
<textarea style="min-width: 500px; height: 100px;" name="br_filters_options[user_func][on_update]"><?php echo @$options['user_func']['on_update'] ?></textarea>
|
102 |
<br />
|
103 |
-
<span style="color:#666666;margin-left:2px;"
|
104 |
</td>
|
105 |
</tr>
|
106 |
<tr>
|
107 |
-
<th scope="row"
|
108 |
<td>
|
109 |
<textarea style="min-width: 500px; height: 100px;" name="br_filters_options[user_func][after_update]"><?php echo @$options['user_func']['after_update'] ?></textarea>
|
110 |
<br />
|
111 |
-
<span style="color:#666666;margin-left:2px;"
|
112 |
</td>
|
113 |
</tr>
|
114 |
</table>
|
115 |
</div>
|
116 |
-
<div id="customcss" class="tab-item">
|
117 |
<a href="http://berocket.com/product/woocommerce-ajax-products-filter" target="_blank">
|
118 |
<img src="<?php echo AAPF_URL; ?>images/paid/custom_css.png" style="max-width: 100%;" />
|
119 |
</a>
|
|
|
120 |
</div>
|
121 |
<p class="submit">
|
122 |
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
|
@@ -124,14 +143,22 @@
|
|
124 |
</form>
|
125 |
<h3>Receive more features and control with Paid version of the plugin:</h3>
|
126 |
<ul>
|
127 |
-
<li><b>- Filter by Attribute, Tag and
|
128 |
<li><b>- Customize filters look through admin</b></li>
|
129 |
-
<li><b>-
|
130 |
-
<li><b>- Price Filter Custom Min and Max values</b></li>
|
131 |
<li><b>- Tag Cloud for Tag filter</b></li>
|
132 |
-
<li><b>-
|
133 |
<li><b>- Slider can use strings as a value</b></li>
|
134 |
-
<li><b>-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
</ul>
|
136 |
<h4>Support the plugin by purchasing paid version. This will provide faster growth, better support and much more functionality for the plugin!</h4>
|
137 |
<h4>Both <a href="https://wordpress.org/plugins/woocommerce-ajax-filters/" target="_blank">Free</a> and <a href="http://berocket.com/product/woocommerce-ajax-products-filter" target="_blank">Paid</a> versions of WooCommerce AJAX Product Filters developed by <a href="http://berocket.com" target="_blank">BeRocket</a></h4>
|
3 |
<?php
|
4 |
settings_fields('br_filters_plugin_options');
|
5 |
$options = get_option('br_filters_options');
|
6 |
+
$tabs_array = array( 'general', 'design', 'javascript', 'customcss' );
|
7 |
?>
|
8 |
<h2 class="nav-tab-wrapper filter_settings_tabs">
|
9 |
+
<a href="#general" class="nav-tab <?php if(@$options['br_opened_tab'] == 'general' || !in_array( @$options['br_opened_tab'], $tabs_array ) ) echo 'nav-tab-active'; ?>"><?php _e('General', BeRocket_AJAX_domain) ?></a>
|
10 |
+
<a href="#design" class="nav-tab <?php if(@$options['br_opened_tab'] == 'design' ) echo 'nav-tab-active'; ?>"><?php _e('Design', BeRocket_AJAX_domain) ?></a>
|
11 |
+
<a href="#javascript" class="nav-tab <?php if(@$options['br_opened_tab'] == 'javascript' ) echo 'nav-tab-active'; ?>"><?php _e('JavaScript', BeRocket_AJAX_domain) ?></a>
|
12 |
+
<a href="#customcss" class="nav-tab <?php if(@$options['br_opened_tab'] == 'customcss' ) echo 'nav-tab-active'; ?>"><?php _e('Custom CSS', BeRocket_AJAX_domain) ?></a>
|
13 |
</h2>
|
14 |
+
<div id="general" class="tab-item <?php if(@$options['br_opened_tab'] == 'general' || !in_array( @$options['br_opened_tab'], $tabs_array ) ) echo 'current'; ?>">
|
15 |
<table class="form-table">
|
16 |
<tr>
|
17 |
+
<th scope="row"><?php _e('"No Products" message', BeRocket_AJAX_domain) ?></th>
|
18 |
<td>
|
19 |
<input size="50" name="br_filters_options[no_products_message]" type='text' value='<?php echo @$options['no_products_message']?>'/>
|
20 |
<br />
|
21 |
+
<span style="color:#666666;margin-left:2px;"><?php _e('Text that will be shown if no products found', BeRocket_AJAX_domain) ?></span>
|
22 |
</td>
|
23 |
</tr>
|
24 |
<tr>
|
25 |
+
<th scope="row"><?php _e('"No Products" class', BeRocket_AJAX_domain) ?></th>
|
26 |
<td>
|
27 |
<input name="br_filters_options[no_products_class]" type='text' value='<?php echo @$options['no_products_class']?>'/>
|
28 |
<br />
|
29 |
+
<span style="color:#666666;margin-left:2px;"><?php _e('Add class and use it to style "No Products" box', BeRocket_AJAX_domain) ?></span>
|
30 |
</td>
|
31 |
</tr>
|
32 |
<tr>
|
33 |
+
<th scope="row"><?php _e('Products selector', BeRocket_AJAX_domain) ?></th>
|
34 |
<td>
|
35 |
<input name="br_filters_options[products_holder_id]" type='text' value='<?php echo @$options['products_holder_id']?$options['products_holder_id']:'ul.products'?>'/>
|
36 |
<br />
|
37 |
+
<span style="color:#666666;margin-left:2px;"><?php _e("Selector for tag that is holding products. Don't change this if you don't know what it is", BeRocket_AJAX_domain) ?></span>
|
38 |
</td>
|
39 |
</tr>
|
40 |
<tr>
|
41 |
+
<th scope="row"><?php _e('Sorting control', BeRocket_AJAX_domain) ?></th>
|
42 |
<td>
|
43 |
<input name="br_filters_options[control_sorting]" type='checkbox' value='1' <?php if( @$options['control_sorting'] ) echo "checked='checked'";?>/>
|
44 |
+
<span style="color:#666666;margin-left:2px;"><?php _e("Take control over WooCommerce's sorting selectbox?", BeRocket_AJAX_domain) ?></span>
|
45 |
</td>
|
46 |
</tr>
|
47 |
<tr>
|
48 |
+
<th scope="row"><?php _e('SEO friendly urls', BeRocket_AJAX_domain) ?></th>
|
49 |
<td>
|
50 |
<input name="br_filters_options[seo_friendly_urls]" type='checkbox' value='1' <?php if( @$options['seo_friendly_urls'] ) echo "checked='checked'";?>/>
|
51 |
+
<span style="color:#666666;margin-left:2px;"><?php _e('If this option is on url will be changed when filter is selected/changed', BeRocket_AJAX_domain) ?></span>
|
52 |
</td>
|
53 |
</tr>
|
54 |
<tr>
|
55 |
+
<th scope="row"><?php _e('Turn all filters off', BeRocket_AJAX_domain) ?></th>
|
56 |
<td>
|
57 |
<input name="br_filters_options[filters_turn_off]" type='checkbox' value='1' <?php if( @$options['filters_turn_off'] ) echo "checked='checked'";?>/>
|
58 |
+
<span style="color:#666666;margin-left:2px;"><?php _e('If you want to hide filters without losing current configuration just turn them off', BeRocket_AJAX_domain) ?></span>
|
59 |
</td>
|
60 |
</tr>
|
61 |
<tr>
|
62 |
+
<th scope="row"><?php _e('Show all values', BeRocket_AJAX_domain) ?></th>
|
63 |
<td>
|
64 |
<input name="br_filters_options[show_all_values]" type='checkbox' value='1' <?php if( @$options['show_all_values'] ) echo "checked='checked'";?>/>
|
65 |
+
<span style="color:#666666;margin-left:2px;"><?php _e('Check if you want to show not used attribute values too', BeRocket_AJAX_domain) ?></span>
|
66 |
</td>
|
67 |
</tr>
|
68 |
<tr>
|
69 |
+
<th scope="row"><?php _e('Hide values', BeRocket_AJAX_domain) ?></th>
|
70 |
+
<td>
|
71 |
+
<input name="br_filters_options[hide_value][o]" type='checkbox' value='1' <?php if( @$options['hide_value']['o'] ) echo "checked='checked'";?>/>
|
72 |
+
<span style="color:#666666;margin-left:2px;"><?php _e('Hide values without products', BeRocket_AJAX_domain) ?></span><br>
|
73 |
+
<input name="br_filters_options[hide_value][sel]" type='checkbox' value='1' <?php if( @$options['hide_value']['sel'] ) echo "checked='checked'";?>/>
|
74 |
+
<span style="color:#666666;margin-left:2px;"><?php _e('Hide selected values', BeRocket_AJAX_domain) ?></span>
|
75 |
+
</td>
|
76 |
+
<td>
|
77 |
+
</tr>
|
78 |
+
<tr>
|
79 |
+
<th scope="row"><?php _e('Jump to first page', BeRocket_AJAX_domain) ?></th>
|
80 |
<td>
|
81 |
<input name="br_filters_options[first_page_jump]" type='checkbox' value='1' <?php if( @$options['first_page_jump'] ) echo "checked='checked'";?>/>
|
82 |
+
<span style="color:#666666;margin-left:2px;"><?php _e('Check if you want load first page after filters change', BeRocket_AJAX_domain) ?></span>
|
83 |
</td>
|
84 |
</tr>
|
85 |
<tr>
|
89 |
<span style="color:#666666;margin-left:2px;">Check if you want scroll page to the top of shop after filters change</span>
|
90 |
</td>
|
91 |
</tr>
|
92 |
+
<tr>
|
93 |
+
<th scope="row"><?php _e('Template ajax load fix', BeRocket_AJAX_domain) ?></th>
|
94 |
+
<td>
|
95 |
+
<input name="br_filters_options[ajax_request_load]" type='checkbox' value='1' <?php if( @$options['ajax_request_load'] ) echo "checked='checked'";?>/>
|
96 |
+
<span style="color:#666666;margin-left:2px;"><?php _e('Use all plugins on ajax load(can slow down products loading)', BeRocket_AJAX_domain) ?></span>
|
97 |
+
</td>
|
98 |
+
</tr>
|
99 |
</table>
|
100 |
</div>
|
101 |
+
<div id="design" class="tab-item <?php if(@$options['br_opened_tab'] == 'design' ) echo 'current'; ?>">
|
102 |
<a href="http://berocket.com/product/woocommerce-ajax-products-filter" target="_blank">
|
103 |
<img src="<?php echo AAPF_URL; ?>images/paid/styler.png" style="max-width: 100%;" />
|
104 |
</a>
|
105 |
</div>
|
106 |
+
<div id="javascript" class="tab-item <?php if(@$options['br_opened_tab'] == 'javascript' ) echo 'current'; ?>">
|
107 |
<table class="form-table">
|
108 |
<tr>
|
109 |
+
<th scope="row"><?php _e('Before Update:', BeRocket_AJAX_domain) ?></th>
|
110 |
<td>
|
111 |
<textarea style="min-width: 500px; height: 100px;" name="br_filters_options[user_func][before_update]"><?php echo @$options['user_func']['before_update'] ?></textarea>
|
112 |
<br />
|
113 |
+
<span style="color:#666666;margin-left:2px;"><?php _e("If you want to add own actions on filter activation, eg: alert('1');", BeRocket_AJAX_domain) ?></span>
|
114 |
</td>
|
115 |
</tr>
|
116 |
<tr>
|
117 |
+
<th scope="row"><?php _e('On Update:', BeRocket_AJAX_domain) ?></th>
|
118 |
<td>
|
119 |
<textarea style="min-width: 500px; height: 100px;" name="br_filters_options[user_func][on_update]"><?php echo @$options['user_func']['on_update'] ?></textarea>
|
120 |
<br />
|
121 |
+
<span style="color:#666666;margin-left:2px;"><?php _e("If you want to add own actions right on products update. You can manipulate data here, try: data.products = 'Ha!';", BeRocket_AJAX_domain) ?></span>
|
122 |
</td>
|
123 |
</tr>
|
124 |
<tr>
|
125 |
+
<th scope="row"><?php _e('After Update:', BeRocket_AJAX_domain) ?></th>
|
126 |
<td>
|
127 |
<textarea style="min-width: 500px; height: 100px;" name="br_filters_options[user_func][after_update]"><?php echo @$options['user_func']['after_update'] ?></textarea>
|
128 |
<br />
|
129 |
+
<span style="color:#666666;margin-left:2px;"><?php _e("If you want to add own actions after products updated, eg: alert('1');", BeRocket_AJAX_domain) ?></span>
|
130 |
</td>
|
131 |
</tr>
|
132 |
</table>
|
133 |
</div>
|
134 |
+
<div id="customcss" class="tab-item <?php if(@$options['br_opened_tab'] == 'customcss' ) echo 'current'; ?>">
|
135 |
<a href="http://berocket.com/product/woocommerce-ajax-products-filter" target="_blank">
|
136 |
<img src="<?php echo AAPF_URL; ?>images/paid/custom_css.png" style="max-width: 100%;" />
|
137 |
</a>
|
138 |
+
<input type="hidden" id="br_opened_tab" name="br_filters_options[br_opened_tab]" value="<?php echo @$options['br_opened_tab'] ?>">
|
139 |
</div>
|
140 |
<p class="submit">
|
141 |
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
|
143 |
</form>
|
144 |
<h3>Receive more features and control with Paid version of the plugin:</h3>
|
145 |
<ul>
|
146 |
+
<li><b>- Filter by Attribute, Tag, Custom Taxonomy, Color, Sub-categories and Availability( in stock | out of stock | any )</b></li>
|
147 |
<li><b>- Customize filters look through admin</b></li>
|
148 |
+
<li><b>- Option to re-count products amount in values when some value selected</b></li>
|
|
|
149 |
<li><b>- Tag Cloud for Tag filter</b></li>
|
150 |
+
<li><b>- Description can be added for the attributes</b></li>
|
151 |
<li><b>- Slider can use strings as a value</b></li>
|
152 |
+
<li><b>- Filters can be collapsed by clicking on title, option to collapse filter on start</b></li>
|
153 |
+
<li><b>- Price Filter Custom Min and Max values</b></li>
|
154 |
+
<li><b>- Add custom CSS on admin settings page</b></li>
|
155 |
+
<li><b>- Show icons before/after widget title and/or before/after values</b></li>
|
156 |
+
<li><b>- Option to upload "Loading..." gif image and set label after/before/above/under it</b></li>
|
157 |
+
<li><b>- Show icons before/after widget title and/or before/after values</b></li>
|
158 |
+
<li><b>- Scroll top position can be controlled by the admin</b></li>
|
159 |
+
<li><b>- Option to hide on mobile devices</b></li>
|
160 |
+
<li><b>- Much better support for custom theme</b></li>
|
161 |
+
<li><b>- Enhancements of the free features</b></li>
|
162 |
</ul>
|
163 |
<h4>Support the plugin by purchasing paid version. This will provide faster growth, better support and much more functionality for the plugin!</h4>
|
164 |
<h4>Both <a href="https://wordpress.org/plugins/woocommerce-ajax-filters/" target="_blank">Free</a> and <a href="http://berocket.com/product/woocommerce-ajax-products-filter" target="_blank">Paid</a> versions of WooCommerce AJAX Product Filters developed by <a href="http://berocket.com" target="_blank">BeRocket</a></h4>
|
templates/admin.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
<p>
|
2 |
-
<label
|
3 |
<select id="<?php echo $this->get_field_id( 'widget_type' ); ?>" name="<?php echo $this->get_field_name( 'widget_type' ); ?>" class="berocket_aapf_widget_admin_widget_type_select">
|
4 |
-
<option <?php if ($instance['widget_type'] == 'filter' or ! $instance['widget_type']) echo 'selected'; ?> value="filter"
|
5 |
-
<option <?php if ($instance['widget_type'] == 'update_button') echo 'selected'; ?> value="update_button"
|
6 |
</select>
|
7 |
</label>
|
8 |
</p>
|
@@ -10,14 +10,14 @@
|
|
10 |
<hr />
|
11 |
|
12 |
<p>
|
13 |
-
<label for="<?php echo $this->get_field_id( 'title' ); ?>"
|
14 |
<input id="<?php echo $this->get_field_id( 'title' ); ?>" type="text" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" />
|
15 |
</p>
|
16 |
<div class="berocket_aapf_admin_filter_widget_content" <?php if ( $instance['widget_type'] == 'update_button' or $instance['widget_type'] == 'selected_area' ){ echo 'style="display: none;"';} else { echo 'style="float: none;"'; } ?>>
|
17 |
<p>
|
18 |
-
<label
|
19 |
<select id="<?php echo $this->get_field_id( 'attribute' ); ?>" name="<?php echo $this->get_field_name( 'attribute' ); ?>" class="berocket_aapf_widget_admin_attribute_select">
|
20 |
-
<option <?php if ($instance['attribute'] == 'price') echo 'selected'; ?> value="price"
|
21 |
<?php foreach( $attributes as $k => $v ){ ?>
|
22 |
<option <?php if ($instance['attribute'] == $k) echo 'selected'; ?> value="<?php echo $k ?>"><?php echo $v ?></option>
|
23 |
<?php } ?>
|
@@ -25,7 +25,7 @@
|
|
25 |
</label>
|
26 |
</p>
|
27 |
<p>
|
28 |
-
<label
|
29 |
<select id="<?php echo $this->get_field_id( 'type' ); ?>" name="<?php echo $this->get_field_name( 'type' ); ?>" class="berocket_aapf_widget_admin_type_select">
|
30 |
<?php if ( $instance['attribute'] != 'price' ){ ?>
|
31 |
<option <?php if ($instance['type'] == 'checkbox') echo 'selected'; ?> value="checkbox">Checkbox</option>
|
@@ -38,7 +38,7 @@
|
|
38 |
</p>
|
39 |
|
40 |
<p <?php if ( $instance['attribute'] == 'price' or $instance['type'] == 'slider' ) echo " style='display: none;'"; ?> >
|
41 |
-
<label
|
42 |
<select id="<?php echo $this->get_field_id( 'operator' ); ?>" name="<?php echo $this->get_field_name( 'operator' ); ?>" class="berocket_aapf_widget_admin_operator_select">
|
43 |
<option <?php if ($instance['operator'] == 'AND') echo 'selected'; ?> value="AND">AND</option>
|
44 |
<option <?php if ($instance['operator'] == 'OR') echo 'selected'; ?> value="OR">OR</option>
|
@@ -54,19 +54,19 @@
|
|
54 |
<input id="<?php echo $this->get_field_id( 'text_after_price' ); ?>" type="text" name="<?php echo $this->get_field_name( 'text_after_price' ); ?>" value="<?php echo $instance['text_after_price']; ?>" />
|
55 |
</p>
|
56 |
<p>
|
57 |
-
<a href="#" class='berocket_aapf_advanced_settings_pointer'
|
58 |
</p>
|
59 |
<div class='berocket_aapf_advanced_settings'>
|
60 |
<p>
|
61 |
-
<label for="<?php echo $this->get_field_id( 'css_class' ); ?>"
|
62 |
<input id="<?php echo $this->get_field_id( 'css_class' ); ?>" type="text" name="<?php echo $this->get_field_name( 'css_class' ); ?>" value="<?php echo $instance['css_class']; ?>" class="berocket_aapf_widget_admin_css_class_input" />
|
63 |
<small>(use white space for multiple classes)</small>
|
64 |
</p>
|
65 |
<p>
|
66 |
-
<label
|
67 |
<label class="berocket_aapf_advanced_settings_subcategory">
|
68 |
<input type="checkbox" name="<?php echo $this->get_field_name( 'cat_propagation' ); ?>" <?php if ( $instance['cat_propagation'] ) echo 'checked'; ?> value="1" class="berocket_aapf_widget_admin_height_input" />
|
69 |
-
include subcats?
|
70 |
</label>
|
71 |
</label>
|
72 |
<ul class="berocket_aapf_advanced_settings_categories_list">
|
@@ -93,11 +93,11 @@
|
|
93 |
</ul>
|
94 |
</p>
|
95 |
<p>
|
96 |
-
<label for="<?php echo $this->get_field_id( 'height' ); ?>"
|
97 |
<input id="<?php echo $this->get_field_id( 'height' ); ?>" type="text" name="<?php echo $this->get_field_name( 'height' ); ?>" value="<?php echo $instance['height']; ?>" class="berocket_aapf_widget_admin_height_input" />px
|
98 |
</p>
|
99 |
<p>
|
100 |
-
<label for="<?php echo $this->get_field_id( 'scroll_theme' ); ?>"
|
101 |
<select id="<?php echo $this->get_field_id( 'scroll_theme' ); ?>" name="<?php echo $this->get_field_name( 'scroll_theme' ); ?>" class="berocket_aapf_widget_admin_scroll_theme_select">
|
102 |
<?php
|
103 |
$scroll_themes = array("light", "dark", "minimal", "minimal-dark", "light-2", "dark-2", "light-3", "dark-3", "light-thick", "dark-thick", "light-thin",
|
1 |
<p>
|
2 |
+
<label><?php _e('Widget Type:', BeRocket_AJAX_domain) ?>
|
3 |
<select id="<?php echo $this->get_field_id( 'widget_type' ); ?>" name="<?php echo $this->get_field_name( 'widget_type' ); ?>" class="berocket_aapf_widget_admin_widget_type_select">
|
4 |
+
<option <?php if ($instance['widget_type'] == 'filter' or ! $instance['widget_type']) echo 'selected'; ?> value="filter"><?php _e('Filter', BeRocket_AJAX_domain) ?></option>
|
5 |
+
<option <?php if ($instance['widget_type'] == 'update_button') echo 'selected'; ?> value="update_button"><?php _e('Update Products button', BeRocket_AJAX_domain) ?></option>
|
6 |
</select>
|
7 |
</label>
|
8 |
</p>
|
10 |
<hr />
|
11 |
|
12 |
<p>
|
13 |
+
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e('Title:', BeRocket_AJAX_domain) ?> </label>
|
14 |
<input id="<?php echo $this->get_field_id( 'title' ); ?>" type="text" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" />
|
15 |
</p>
|
16 |
<div class="berocket_aapf_admin_filter_widget_content" <?php if ( $instance['widget_type'] == 'update_button' or $instance['widget_type'] == 'selected_area' ){ echo 'style="display: none;"';} else { echo 'style="float: none;"'; } ?>>
|
17 |
<p>
|
18 |
+
<label><?php _e('Attribute:', BeRocket_AJAX_domain) ?>
|
19 |
<select id="<?php echo $this->get_field_id( 'attribute' ); ?>" name="<?php echo $this->get_field_name( 'attribute' ); ?>" class="berocket_aapf_widget_admin_attribute_select">
|
20 |
+
<option <?php if ($instance['attribute'] == 'price') echo 'selected'; ?> value="price"><?php _e('Price', BeRocket_AJAX_domain) ?></option>
|
21 |
<?php foreach( $attributes as $k => $v ){ ?>
|
22 |
<option <?php if ($instance['attribute'] == $k) echo 'selected'; ?> value="<?php echo $k ?>"><?php echo $v ?></option>
|
23 |
<?php } ?>
|
25 |
</label>
|
26 |
</p>
|
27 |
<p>
|
28 |
+
<label><?php _e('Type:', BeRocket_AJAX_domain) ?>
|
29 |
<select id="<?php echo $this->get_field_id( 'type' ); ?>" name="<?php echo $this->get_field_name( 'type' ); ?>" class="berocket_aapf_widget_admin_type_select">
|
30 |
<?php if ( $instance['attribute'] != 'price' ){ ?>
|
31 |
<option <?php if ($instance['type'] == 'checkbox') echo 'selected'; ?> value="checkbox">Checkbox</option>
|
38 |
</p>
|
39 |
|
40 |
<p <?php if ( $instance['attribute'] == 'price' or $instance['type'] == 'slider' ) echo " style='display: none;'"; ?> >
|
41 |
+
<label><?php _e('Operator:', BeRocket_AJAX_domain) ?>
|
42 |
<select id="<?php echo $this->get_field_id( 'operator' ); ?>" name="<?php echo $this->get_field_name( 'operator' ); ?>" class="berocket_aapf_widget_admin_operator_select">
|
43 |
<option <?php if ($instance['operator'] == 'AND') echo 'selected'; ?> value="AND">AND</option>
|
44 |
<option <?php if ($instance['operator'] == 'OR') echo 'selected'; ?> value="OR">OR</option>
|
54 |
<input id="<?php echo $this->get_field_id( 'text_after_price' ); ?>" type="text" name="<?php echo $this->get_field_name( 'text_after_price' ); ?>" value="<?php echo $instance['text_after_price']; ?>" />
|
55 |
</p>
|
56 |
<p>
|
57 |
+
<a href="#" class='berocket_aapf_advanced_settings_pointer'><?php _e('Advanced Settings', BeRocket_AJAX_domain) ?></a>
|
58 |
</p>
|
59 |
<div class='berocket_aapf_advanced_settings'>
|
60 |
<p>
|
61 |
+
<label for="<?php echo $this->get_field_id( 'css_class' ); ?>"><?php _e('CSS Class:', BeRocket_AJAX_domain) ?> </label>
|
62 |
<input id="<?php echo $this->get_field_id( 'css_class' ); ?>" type="text" name="<?php echo $this->get_field_name( 'css_class' ); ?>" value="<?php echo $instance['css_class']; ?>" class="berocket_aapf_widget_admin_css_class_input" />
|
63 |
<small>(use white space for multiple classes)</small>
|
64 |
</p>
|
65 |
<p>
|
66 |
+
<label><?php _e('Product Category:', BeRocket_AJAX_domain) ?>
|
67 |
<label class="berocket_aapf_advanced_settings_subcategory">
|
68 |
<input type="checkbox" name="<?php echo $this->get_field_name( 'cat_propagation' ); ?>" <?php if ( $instance['cat_propagation'] ) echo 'checked'; ?> value="1" class="berocket_aapf_widget_admin_height_input" />
|
69 |
+
<?php _e('include subcats?', BeRocket_AJAX_domain) ?>
|
70 |
</label>
|
71 |
</label>
|
72 |
<ul class="berocket_aapf_advanced_settings_categories_list">
|
93 |
</ul>
|
94 |
</p>
|
95 |
<p>
|
96 |
+
<label for="<?php echo $this->get_field_id( 'height' ); ?>"><?php _e('Filter Box Height:', BeRocket_AJAX_domain) ?> </label>
|
97 |
<input id="<?php echo $this->get_field_id( 'height' ); ?>" type="text" name="<?php echo $this->get_field_name( 'height' ); ?>" value="<?php echo $instance['height']; ?>" class="berocket_aapf_widget_admin_height_input" />px
|
98 |
</p>
|
99 |
<p>
|
100 |
+
<label for="<?php echo $this->get_field_id( 'scroll_theme' ); ?>"><?php _e('Scroll Theme:', BeRocket_AJAX_domain) ?> </label>
|
101 |
<select id="<?php echo $this->get_field_id( 'scroll_theme' ); ?>" name="<?php echo $this->get_field_name( 'scroll_theme' ); ?>" class="berocket_aapf_widget_admin_scroll_theme_select">
|
102 |
<?php
|
103 |
$scroll_themes = array("light", "dark", "minimal", "minimal-dark", "light-2", "dark-2", "light-3", "dark-3", "light-thick", "dark-thick", "light-thin",
|
templates/checkbox.php
CHANGED
@@ -10,10 +10,20 @@
|
|
10 |
*/
|
11 |
?>
|
12 |
<?php
|
|
|
13 |
if ( @ $terms ):
|
14 |
foreach( $terms as $term ):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
?>
|
16 |
-
<li>
|
17 |
<span>
|
18 |
<input id='checkbox_<?=$term->term_id?>' class="<?php echo @ $uo['class']['checkbox_radio'] ?> checkbox_<?php echo $term->term_id ?>" type='checkbox'
|
19 |
data-term_id='<?php echo $term->term_id ?>' data-taxonomy='<?php echo $term->taxonomy ?>' data-operator='<?php echo $operator ?>'
|
@@ -30,6 +40,6 @@ if ( @ $terms ):
|
|
30 |
</span>
|
31 |
</li>
|
32 |
<?php
|
33 |
-
endforeach;
|
34 |
-
|
35 |
-
?>
|
10 |
*/
|
11 |
?>
|
12 |
<?php
|
13 |
+
$hiden_value = false;
|
14 |
if ( @ $terms ):
|
15 |
foreach( $terms as $term ):
|
16 |
+
$selected = false;
|
17 |
+
if( @ $_POST['terms'] ){
|
18 |
+
foreach( $_POST['terms'] as $p_term ){
|
19 |
+
if( @ $p_term[0] == $term->taxonomy and $term->term_id == @ $p_term[1] ){
|
20 |
+
$selected = true;
|
21 |
+
break;
|
22 |
+
}
|
23 |
+
}
|
24 |
+
}
|
25 |
?>
|
26 |
+
<li class="<?php if( @ $hide_o_value && isset($term->count) && $term->count == 0 ) { echo 'berocket_hide_o_value '; $hiden_value = true; } if( @ $hide_sel_value && $selected ) { echo 'berocket_hide_sel_value'; $hiden_value = true; } ?>">
|
27 |
<span>
|
28 |
<input id='checkbox_<?=$term->term_id?>' class="<?php echo @ $uo['class']['checkbox_radio'] ?> checkbox_<?php echo $term->term_id ?>" type='checkbox'
|
29 |
data-term_id='<?php echo $term->term_id ?>' data-taxonomy='<?php echo $term->taxonomy ?>' data-operator='<?php echo $operator ?>'
|
40 |
</span>
|
41 |
</li>
|
42 |
<?php
|
43 |
+
endforeach; ?>
|
44 |
+
<li class="berocket_widget_show_values"<?php if( !$hiden_value ) echo 'style="display: none;"'; ?>>Show value<span class="show_button"></span></li>
|
45 |
+
<?php endif; ?>
|
templates/radio.php
CHANGED
@@ -1,8 +1,19 @@
|
|
1 |
<?php
|
2 |
$random_name = rand();
|
|
|
3 |
if ( $terms ):
|
4 |
-
foreach( $terms as $term ):
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
<span>
|
7 |
<input class="<?php echo @ $uo['class']['checkbox_radio'] ?> radio_<?php echo $term->term_id?>" type='radio' id='radio_<?php echo $term->term_id?>_<?php echo $random_name ?>'
|
8 |
name='radio_<?php echo $term->taxonomy ?>_<?php echo $x ?>_<?php echo $random_name ?>'
|
@@ -19,6 +30,6 @@ if ( $terms ):
|
|
19 |
?> /><label for='radio_<?php echo $term->term_id ?>' class="berocket_label_widgets"> <?php echo $term->name ?></label>
|
20 |
</span>
|
21 |
</li>
|
22 |
-
<?php endforeach;
|
23 |
-
|
24 |
-
?>
|
1 |
<?php
|
2 |
$random_name = rand();
|
3 |
+
$hiden_value = false;
|
4 |
if ( $terms ):
|
5 |
+
foreach( $terms as $term ):
|
6 |
+
$selected = false;
|
7 |
+
if( @ $_POST['terms'] ){
|
8 |
+
foreach( $_POST['terms'] as $p_term ){
|
9 |
+
if( @ $p_term[0] == $term->taxonomy and $term->term_id == @ $p_term[1] ){
|
10 |
+
$selected = true;
|
11 |
+
break;
|
12 |
+
}
|
13 |
+
}
|
14 |
+
}
|
15 |
+
?>
|
16 |
+
<li class="<?php if( @ $hide_o_value && isset($term->count) && $term->count == 0 ) { echo 'berocket_hide_o_value '; $hiden_value = true; } if( @ $hide_sel_value && $selected ) { echo 'berocket_hide_sel_value'; $hiden_value = true; } ?>">
|
17 |
<span>
|
18 |
<input class="<?php echo @ $uo['class']['checkbox_radio'] ?> radio_<?php echo $term->term_id?>" type='radio' id='radio_<?php echo $term->term_id?>_<?php echo $random_name ?>'
|
19 |
name='radio_<?php echo $term->taxonomy ?>_<?php echo $x ?>_<?php echo $random_name ?>'
|
30 |
?> /><label for='radio_<?php echo $term->term_id ?>' class="berocket_label_widgets"> <?php echo $term->name ?></label>
|
31 |
</span>
|
32 |
</li>
|
33 |
+
<?php endforeach; ?>
|
34 |
+
<li class="berocket_widget_show_values"<?php if( !$hiden_value ) echo 'style="display: none;"'; ?>>Show value<span class="show_button"></span></li>
|
35 |
+
<?php endif; ?>
|
woocommerce-filters.php
CHANGED
@@ -3,11 +3,14 @@
|
|
3 |
* Plugin Name: Advanced AJAX Product Filters for WooCommerce
|
4 |
* Plugin URI: http://berocket.com/wp-plugins/product-filters
|
5 |
* Description: Advanced AJAX Product Filters for WooCommerce
|
6 |
-
* Version: 1.1.0.
|
7 |
* Author: BeRocket
|
8 |
* Author URI: http://berocket.com
|
9 |
*/
|
10 |
|
|
|
|
|
|
|
11 |
define( "AAPF_TEMPLATE_PATH", plugin_dir_path( __FILE__ ) . "templates/" );
|
12 |
define( "AAPF_URL", plugin_dir_url( __FILE__ ) );
|
13 |
|
@@ -33,19 +36,53 @@ class BeRocket_AAPF {
|
|
33 |
register_activation_hook(__FILE__, array( __CLASS__, 'br_add_defaults' ) );
|
34 |
register_uninstall_hook(__FILE__, array( __CLASS__, 'br_delete_plugin_options' ) );
|
35 |
|
36 |
-
|
37 |
-
|
|
|
|
|
38 |
|
39 |
-
|
40 |
-
|
41 |
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
}
|
45 |
}
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
public static function br_add_options_page(){
|
48 |
-
add_submenu_page( 'woocommerce', 'Product Filters Settings', 'Product Filters', 'manage_options', 'br-product-filters', array( __CLASS__, 'br_render_form' ) );
|
49 |
}
|
50 |
|
51 |
public static function shortcode( $atts = array() ){
|
@@ -71,11 +108,11 @@ class BeRocket_AAPF {
|
|
71 |
}
|
72 |
|
73 |
public static function br_render_form(){
|
74 |
-
wp_enqueue_script( 'berocket_aapf_widget-colorpicker', plugins_url( 'js/colpick.js', __FILE__ ), array( 'jquery' ) );
|
75 |
-
wp_enqueue_script( 'berocket_aapf_widget-admin', plugins_url( 'js/admin.js', __FILE__ ), array( 'jquery' ) );
|
76 |
|
77 |
-
wp_register_style( 'berocket_aapf_widget-colorpicker-style', plugins_url( 'css/colpick.css', __FILE__ ) );
|
78 |
-
wp_register_style( 'berocket_aapf_widget-admin-style', plugins_url( 'css/admin.css', __FILE__ ) );
|
79 |
wp_enqueue_style( 'berocket_aapf_widget-colorpicker-style' );
|
80 |
wp_enqueue_style( 'berocket_aapf_widget-admin-style' );
|
81 |
|
@@ -84,7 +121,7 @@ class BeRocket_AAPF {
|
|
84 |
|
85 |
public static function apply_user_filters( $query ){
|
86 |
if( $query->is_main_query() and
|
87 |
-
( $query->get( 'post_type' ) == 'product' or $query->get( 'product_cat' ) )
|
88 |
or
|
89 |
$query->is_page() && 'page' == get_option( 'show_on_front' ) && $query->get('page_id') == wc_get_page_id('shop')
|
90 |
){
|
3 |
* Plugin Name: Advanced AJAX Product Filters for WooCommerce
|
4 |
* Plugin URI: http://berocket.com/wp-plugins/product-filters
|
5 |
* Description: Advanced AJAX Product Filters for WooCommerce
|
6 |
+
* Version: 1.1.0.7
|
7 |
* Author: BeRocket
|
8 |
* Author URI: http://berocket.com
|
9 |
*/
|
10 |
|
11 |
+
define( "BeRocket_AJAX_filters_version", '1.1.0.7');
|
12 |
+
define( "BeRocket_AJAX_domain", 'BRaapf');
|
13 |
+
|
14 |
define( "AAPF_TEMPLATE_PATH", plugin_dir_path( __FILE__ ) . "templates/" );
|
15 |
define( "AAPF_URL", plugin_dir_url( __FILE__ ) );
|
16 |
|
36 |
register_activation_hook(__FILE__, array( __CLASS__, 'br_add_defaults' ) );
|
37 |
register_uninstall_hook(__FILE__, array( __CLASS__, 'br_delete_plugin_options' ) );
|
38 |
|
39 |
+
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) && br_get_woocommerce_version() >= 2.1 ) {
|
40 |
+
add_action( 'admin_menu', array( __CLASS__, 'br_add_options_page' ) );
|
41 |
+
add_action( 'admin_init', array( __CLASS__, 'register_br_options' ) );
|
42 |
+
add_action( 'init', array( __CLASS__, 'init' ) );
|
43 |
|
44 |
+
add_shortcode( 'br_filters', array( __CLASS__, 'shortcode' ) );
|
45 |
+
add_filter( 'loop_shop_per_page', array( __CLASS__, 'loop_shop_per_page' ), 99 );
|
46 |
|
47 |
+
if( @ $_GET['filters'] and ! @ defined( 'DOING_AJAX' ) ) {
|
48 |
+
add_filter( 'pre_get_posts', array( __CLASS__, 'apply_user_filters' ) );
|
49 |
+
}
|
50 |
+
if($_GET['explode'] == 'explode') {
|
51 |
+
add_action( 'woocommerce_before_template_part', array( 'BeRocket_AAPF_Widget', 'pre_get_posts'), 999999 );
|
52 |
+
add_action( 'wp_footer', array( 'BeRocket_AAPF_Widget', 'end_clean'), 999999 );
|
53 |
+
add_action( 'init', array( 'BeRocket_AAPF_Widget', 'start_clean'), 1 );
|
54 |
+
}
|
55 |
+
} else {
|
56 |
+
if( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
|
57 |
+
add_action( 'admin_notices', array( __CLASS__, 'update_woocommerce ' ) );
|
58 |
+
} else {
|
59 |
+
add_action( 'admin_notices', array( __CLASS__, 'no_woocommerce' ) );
|
60 |
+
}
|
61 |
}
|
62 |
}
|
63 |
|
64 |
+
public function init() {
|
65 |
+
load_plugin_textdomain(BeRocket_AJAX_domain, false, dirname( plugin_basename( __FILE__ ) ) . '/languages/');
|
66 |
+
}
|
67 |
+
|
68 |
+
public function no_woocommerce() {
|
69 |
+
?>
|
70 |
+
<div class="error">
|
71 |
+
<p><?php _e('Activate WooCommerce plugin before', BeRocket_AJAX_domain) ?></p>
|
72 |
+
</div>
|
73 |
+
<?php
|
74 |
+
}
|
75 |
+
|
76 |
+
public function update_woocommerce() {
|
77 |
+
?>
|
78 |
+
<div class="error">
|
79 |
+
<p><?php _e('Update WooCommerce plugin', BeRocket_AJAX_domain) ?></p>
|
80 |
+
</div>
|
81 |
+
<?php
|
82 |
+
}
|
83 |
+
|
84 |
public static function br_add_options_page(){
|
85 |
+
add_submenu_page( 'woocommerce', __('Product Filters Settings', BeRocket_AJAX_domain), __('Product Filters', BeRocket_AJAX_domain), 'manage_options', 'br-product-filters', array( __CLASS__, 'br_render_form' ) );
|
86 |
}
|
87 |
|
88 |
public static function shortcode( $atts = array() ){
|
108 |
}
|
109 |
|
110 |
public static function br_render_form(){
|
111 |
+
wp_enqueue_script( 'berocket_aapf_widget-colorpicker', plugins_url( 'js/colpick.js', __FILE__ ), array( 'jquery' ), BeRocket_AJAX_filters_version );
|
112 |
+
wp_enqueue_script( 'berocket_aapf_widget-admin', plugins_url( 'js/admin.js', __FILE__ ), array( 'jquery' ), BeRocket_AJAX_filters_version );
|
113 |
|
114 |
+
wp_register_style( 'berocket_aapf_widget-colorpicker-style', plugins_url( 'css/colpick.css', __FILE__ ), array(), BeRocket_AJAX_filters_version );
|
115 |
+
wp_register_style( 'berocket_aapf_widget-admin-style', plugins_url( 'css/admin.css', __FILE__ ), array(), BeRocket_AJAX_filters_version );
|
116 |
wp_enqueue_style( 'berocket_aapf_widget-colorpicker-style' );
|
117 |
wp_enqueue_style( 'berocket_aapf_widget-admin-style' );
|
118 |
|
121 |
|
122 |
public static function apply_user_filters( $query ){
|
123 |
if( $query->is_main_query() and
|
124 |
+
( is_shop() or $query->get( 'post_type' ) == 'product' or $query->get( 'product_cat' ) )
|
125 |
or
|
126 |
$query->is_page() && 'page' == get_option( 'show_on_front' ) && $query->get('page_id') == wc_get_page_id('shop')
|
127 |
){
|