WooCommerce Product Archive Customiser - Version 0.2.0

Version Description

  • 28/11/2013 =
  • Added option for user to choose how many products to display per page. Kudos @spmlucas.
Download this release

Release Info

Developer jameskoster
Plugin Icon wp plugin WooCommerce Product Archive Customiser
Version 0.2.0
Comparing to
See all releases

Code changes from version 0.1.1 to 0.2.0

README.md CHANGED
File without changes
archive-customiser.php CHANGED
@@ -2,10 +2,10 @@
2
  /*
3
  Plugin Name: WooCommerce Product Archive Customiser
4
  Plugin URI: http://jameskoster.co.uk/tag/product-archive-customiser/
5
- Version: 0.1.1
6
  Description: Allows you to customise WooCommerce product archives. Change the number of product columns and the number of products displayed per page. Toggle the display of core elements and enable some that are not included in WooCommerce core such as stock levels and product categories.
7
  Author: jameskoster
8
- Tested up to: 3.6
9
  Author URI: http://jameskoster.co.uk
10
  Text Domain: woocommerce-product-archive-customiser
11
  Domain Path: /languages/
@@ -69,6 +69,12 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
69
  'type' => 'checkbox',
70
  'default' => 'yes'
71
  ),
 
 
 
 
 
 
72
  array(
73
  'desc' => __( 'Product Sorting', 'woocommerce-product-archive-customiser' ),
74
  'id' => 'wc_pac_product_sorting',
@@ -136,6 +142,7 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
136
  // Default options
137
  add_option( 'wc_pac_columns', '4' );
138
  add_option( 'wc_pac_products_per_page', '10' );
 
139
  add_option( 'wc_pac_product_count', 'yes' );
140
  add_option( 'wc_pac_product_sorting', 'yes' );
141
  add_option( 'wc_pac_sale_flash', 'yes' );
@@ -199,6 +206,11 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
199
  // Products per page
200
  add_filter( 'loop_shop_per_page', array( $this, 'woocommerce_pac_products_per_page' ), 20 );
201
 
 
 
 
 
 
202
  // Sale flash
203
  if ( get_option( 'wc_pac_sale_flash' ) == 'no' ) {
204
  remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash', 10 );
@@ -267,9 +279,38 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
267
  // Products per page
268
  function woocommerce_pac_products_per_page() {
269
  $per_page = get_option( 'wc_pac_products_per_page' );
 
 
 
 
 
 
 
270
  return $per_page;
271
  }
272
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
273
  // Product columns
274
  function woocommerce_pac_columns( $classes ) {
275
  $columns = get_option( 'wc_pac_columns' );
2
  /*
3
  Plugin Name: WooCommerce Product Archive Customiser
4
  Plugin URI: http://jameskoster.co.uk/tag/product-archive-customiser/
5
+ Version: 0.2.0
6
  Description: Allows you to customise WooCommerce product archives. Change the number of product columns and the number of products displayed per page. Toggle the display of core elements and enable some that are not included in WooCommerce core such as stock levels and product categories.
7
  Author: jameskoster
8
+ Tested up to: 3.8-b1
9
  Author URI: http://jameskoster.co.uk
10
  Text Domain: woocommerce-product-archive-customiser
11
  Domain Path: /languages/
69
  'type' => 'checkbox',
70
  'default' => 'yes'
71
  ),
72
+ array(
73
+ 'desc' => __( 'Per Page Dropdown', 'woocommerce-product-archive-customiser' ),
74
+ 'id' => 'wc_pac_product_perpage',
75
+ 'type' => 'checkbox',
76
+ 'default' => 'no'
77
+ ),
78
  array(
79
  'desc' => __( 'Product Sorting', 'woocommerce-product-archive-customiser' ),
80
  'id' => 'wc_pac_product_sorting',
142
  // Default options
143
  add_option( 'wc_pac_columns', '4' );
144
  add_option( 'wc_pac_products_per_page', '10' );
145
+ add_option( 'wc_pac_product_perpage', 'no' );
146
  add_option( 'wc_pac_product_count', 'yes' );
147
  add_option( 'wc_pac_product_sorting', 'yes' );
148
  add_option( 'wc_pac_sale_flash', 'yes' );
206
  // Products per page
207
  add_filter( 'loop_shop_per_page', array( $this, 'woocommerce_pac_products_per_page' ), 20 );
208
 
209
+ // Per Page Dropdown
210
+ if ( get_option( 'wc_pac_product_perpage' ) == 'yes' ) {
211
+ add_action( 'woocommerce_before_shop_loop', array( $this, 'woocommerce_pac_show_product_perpage' ), 30 );
212
+ }
213
+
214
  // Sale flash
215
  if ( get_option( 'wc_pac_sale_flash' ) == 'no' ) {
216
  remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash', 10 );
279
  // Products per page
280
  function woocommerce_pac_products_per_page() {
281
  $per_page = get_option( 'wc_pac_products_per_page' );
282
+ if ( isset( $_COOKIE['per_page'] ) ) {
283
+ $per_page = $_COOKIE['per_page'];
284
+ }
285
+ if ( isset( $_POST['per_page'] ) ) {
286
+ setcookie( 'per_page', $_POST['per_page'], time()+1209600, '/' );
287
+ $per_page = $_POST['per_page'];
288
+ }
289
  return $per_page;
290
  }
291
 
292
+ // Per Page Dropdown
293
+ function woocommerce_pac_show_product_perpage() {
294
+ $per_page = get_option( 'wc_pac_products_per_page' );
295
+ $woo_per_page = ( isset( $_REQUEST['per_page'] ) ) ? $_REQUEST['per_page'] : $_COOKIE['per_page'];
296
+ ?>
297
+ <form class="woocommerce-ordering" method="post">
298
+ <select name="per_page" class="per_page" onchange="this.form.submit()">
299
+ <?php
300
+ $x = 1;
301
+ while ( $x <= 5 ) {
302
+ $value = $per_page * $x;
303
+ $selected = selected( $woo_per_page, $value, false );
304
+ $label = __( "{$value} per page", 'woocommerce-product-archive-customiser' );
305
+ echo "<option value='{$value}' {$selected}>{$label}</option>";
306
+ $x++;
307
+ }
308
+ ?>
309
+ </select>
310
+ </form>
311
+ <?php
312
+ }
313
+
314
  // Product columns
315
  function woocommerce_pac_columns( $classes ) {
316
  $columns = get_option( 'wc_pac_columns' );
assets/css/layout.css CHANGED
File without changes
assets/css/pac.css CHANGED
File without changes
assets/css/pac.less CHANGED
File without changes
assets/js/script.js CHANGED
File without changes
assets/js/script.min.js CHANGED
File without changes
languages/woocommerce-product-archive-customiser-en_GB.po CHANGED
@@ -1,9 +1,9 @@
1
  msgid ""
2
  msgstr ""
3
- "Project-Id-Version: WooCommerce Product Archive Customiser v0.1\n"
4
  "Report-Msgid-Bugs-To: \n"
5
  "POT-Creation-Date: \n"
6
- "PO-Revision-Date: 2013-05-17 20:19:44+0000\n"
7
  "Last-Translator: admin <james@jameskoster.co.uk>\n"
8
  "Language-Team: \n"
9
  "MIME-Version: 1.0\n"
@@ -49,12 +49,6 @@ msgstr ""
49
  msgid "http://jameskoster.co.uk"
50
  msgstr ""
51
 
52
- #. translators: plugin header field 'Version'
53
- #: archive-customiser.php:0
54
- #@ woocommerce-product-archive-customiser
55
- msgid "0.1"
56
- msgstr ""
57
-
58
  #: archive-customiser.php:40
59
  #@ woocommerce-product-archive-customiser
60
  msgid "Product Archives"
@@ -115,73 +109,84 @@ msgstr ""
115
  msgid "Product Count"
116
  msgstr ""
117
 
118
- #: archive-customiser.php:73
119
  #@ woocommerce-product-archive-customiser
120
  msgid "Product Sorting"
121
  msgstr ""
122
 
123
- #: archive-customiser.php:79
124
  #@ woocommerce-product-archive-customiser
125
  msgid "Sale Flashes"
126
  msgstr ""
127
 
128
- #: archive-customiser.php:85
129
  #@ woocommerce-product-archive-customiser
130
  msgid "Add to cart buttons"
131
  msgstr ""
132
 
133
- #: archive-customiser.php:91
134
  #@ woocommerce-product-archive-customiser
135
  msgid "Thumbnails"
136
  msgstr ""
137
 
138
- #: archive-customiser.php:97
139
  #@ woocommerce-product-archive-customiser
140
  msgid "Prices"
141
  msgstr ""
142
 
143
- #: archive-customiser.php:103
144
  #@ woocommerce-product-archive-customiser
145
  msgid "Ratings"
146
  msgstr ""
147
 
148
- #: archive-customiser.php:109
149
  #@ woocommerce-product-archive-customiser
150
  msgid "Product categories"
151
  msgstr ""
152
 
153
- #: archive-customiser.php:115
154
  #@ woocommerce-product-archive-customiser
155
  msgid "Stock"
156
  msgstr ""
157
 
158
- #: archive-customiser.php:121
159
  #@ woocommerce-product-archive-customiser
160
  msgid "\"New\" badges"
161
  msgstr ""
162
 
163
- #: archive-customiser.php:127
164
  #@ woocommerce-product-archive-customiser
165
  msgid "Display the \"New\" badge for how many days?"
166
  msgstr ""
167
 
168
- #: archive-customiser.php:180
169
  #@ woocommerce
170
  msgid "WooCommerce"
171
  msgstr ""
172
 
173
- #: archive-customiser.php:292
174
  #@ woocommerce-product-archive-customiser
175
  msgid "New"
176
  msgstr ""
177
 
178
- #: archive-customiser.php:306
179
  #@ woothemes
180
  msgid "Out of stock"
181
  msgstr ""
182
 
183
- #: archive-customiser.php:308
184
  #@ woothemes
185
  msgid " In stock"
186
  msgstr ""
187
 
 
 
 
 
 
 
 
 
 
 
 
1
  msgid ""
2
  msgstr ""
3
+ "Project-Id-Version: WooCommerce Product Archive Customiser v0.2.0\n"
4
  "Report-Msgid-Bugs-To: \n"
5
  "POT-Creation-Date: \n"
6
+ "PO-Revision-Date: 2013-11-28 14:15:47+0000\n"
7
  "Last-Translator: admin <james@jameskoster.co.uk>\n"
8
  "Language-Team: \n"
9
  "MIME-Version: 1.0\n"
49
  msgid "http://jameskoster.co.uk"
50
  msgstr ""
51
 
 
 
 
 
 
 
52
  #: archive-customiser.php:40
53
  #@ woocommerce-product-archive-customiser
54
  msgid "Product Archives"
109
  msgid "Product Count"
110
  msgstr ""
111
 
112
+ #: archive-customiser.php:79
113
  #@ woocommerce-product-archive-customiser
114
  msgid "Product Sorting"
115
  msgstr ""
116
 
117
+ #: archive-customiser.php:85
118
  #@ woocommerce-product-archive-customiser
119
  msgid "Sale Flashes"
120
  msgstr ""
121
 
122
+ #: archive-customiser.php:91
123
  #@ woocommerce-product-archive-customiser
124
  msgid "Add to cart buttons"
125
  msgstr ""
126
 
127
+ #: archive-customiser.php:97
128
  #@ woocommerce-product-archive-customiser
129
  msgid "Thumbnails"
130
  msgstr ""
131
 
132
+ #: archive-customiser.php:103
133
  #@ woocommerce-product-archive-customiser
134
  msgid "Prices"
135
  msgstr ""
136
 
137
+ #: archive-customiser.php:109
138
  #@ woocommerce-product-archive-customiser
139
  msgid "Ratings"
140
  msgstr ""
141
 
142
+ #: archive-customiser.php:115
143
  #@ woocommerce-product-archive-customiser
144
  msgid "Product categories"
145
  msgstr ""
146
 
147
+ #: archive-customiser.php:121
148
  #@ woocommerce-product-archive-customiser
149
  msgid "Stock"
150
  msgstr ""
151
 
152
+ #: archive-customiser.php:127
153
  #@ woocommerce-product-archive-customiser
154
  msgid "\"New\" badges"
155
  msgstr ""
156
 
157
+ #: archive-customiser.php:133
158
  #@ woocommerce-product-archive-customiser
159
  msgid "Display the \"New\" badge for how many days?"
160
  msgstr ""
161
 
162
+ #: archive-customiser.php:187
163
  #@ woocommerce
164
  msgid "WooCommerce"
165
  msgstr ""
166
 
167
+ #: archive-customiser.php:333
168
  #@ woocommerce-product-archive-customiser
169
  msgid "New"
170
  msgstr ""
171
 
172
+ #: archive-customiser.php:347
173
  #@ woothemes
174
  msgid "Out of stock"
175
  msgstr ""
176
 
177
+ #: archive-customiser.php:349
178
  #@ woothemes
179
  msgid " In stock"
180
  msgstr ""
181
 
182
+ #. translators: plugin header field 'Version'
183
+ #: archive-customiser.php:0
184
+ #@ woocommerce-product-archive-customiser
185
+ msgid "0.2.0"
186
+ msgstr ""
187
+
188
+ #: archive-customiser.php:73
189
+ #@ woocommerce-product-archive-customiser
190
+ msgid "Per Page Dropdown"
191
+ msgstr ""
192
+
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: jameskoster
3
  Tags: woocommerce, ecommerce, products
4
  Requires at least: 3.5
5
- Tested up to: 3.6
6
- Stable tag: 0.1.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -49,6 +49,9 @@ function remove_pac_styles() {
49
 
50
  == Changelog ==
51
 
 
 
 
52
  = 0.1.1 - 10/06/2013 =
53
  * Product column settings now affect product categories & tags
54
  * Product categories display inline for better theme compatibility
2
  Contributors: jameskoster
3
  Tags: woocommerce, ecommerce, products
4
  Requires at least: 3.5
5
+ Tested up to: 3.8-b1
6
+ Stable tag: 0.2.0
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
49
 
50
  == Changelog ==
51
 
52
+ = 0.2.0 - 28/11/2013 =
53
+ * Added option for user to choose how many products to display per page. Kudos @spmlucas.
54
+
55
  = 0.1.1 - 10/06/2013 =
56
  * Product column settings now affect product categories & tags
57
  * Product categories display inline for better theme compatibility