WooCommerce Product Archive Customiser - Version 0.3.0

Version Description

  • 04/02/2014 =
  • WooCommerce 2.1 compatibility.
  • Fixed a notice when using the products per page selector feature.
Download this release

Release Info

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

Code changes from version 0.2.0 to 0.3.0

Files changed (2) hide show
  1. archive-customiser.php +16 -7
  2. readme.txt +7 -3
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.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/
@@ -157,8 +157,9 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
157
 
158
 
159
  // Admin
160
- add_action( 'woocommerce_settings_catalog_options_after', array( $this, 'admin_settings' ), 20);
161
- add_action( 'woocommerce_update_options_catalog', array( $this, 'save_admin_settings' ) );
 
162
  add_action( 'admin_enqueue_scripts', array( $this, 'wc_pac_admin_scripts' ) );
163
  add_action( 'init', array( $this, 'wc_pac_fire_customisations' ) );
164
  add_action( 'wp', array( $this, 'wc_pac_columns' ) ); // This doesn't work when hooked into init :(
@@ -197,7 +198,7 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
197
  // Setup styles
198
  function wc_pac_styles() {
199
  wp_enqueue_style( 'pac-styles', plugins_url( '/assets/css/pac.css', __FILE__ ) );
200
- wp_enqueue_style( 'pac-layout-styles', plugins_url( '/assets/css/layout.css', __FILE__ ) );
201
  }
202
 
203
  // Fire customisations!
@@ -291,8 +292,16 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
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()">
2
  /*
3
  Plugin Name: WooCommerce Product Archive Customiser
4
  Plugin URI: http://jameskoster.co.uk/tag/product-archive-customiser/
5
+ Version: 0.3.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.1
9
  Author URI: http://jameskoster.co.uk
10
  Text Domain: woocommerce-product-archive-customiser
11
  Domain Path: /languages/
157
 
158
 
159
  // Admin
160
+ add_action( 'woocommerce_settings_catalog_options_after', array( $this, 'admin_settings' ), 20 );
161
+ add_action( 'woocommerce_update_options_catalog', array( $this, 'save_admin_settings' ) ); // < 2.1
162
+ add_action( 'woocommerce_update_options_products', array( $this, 'save_admin_settings' ) ); // 2.1 +
163
  add_action( 'admin_enqueue_scripts', array( $this, 'wc_pac_admin_scripts' ) );
164
  add_action( 'init', array( $this, 'wc_pac_fire_customisations' ) );
165
  add_action( 'wp', array( $this, 'wc_pac_columns' ) ); // This doesn't work when hooked into init :(
198
  // Setup styles
199
  function wc_pac_styles() {
200
  wp_enqueue_style( 'pac-styles', plugins_url( '/assets/css/pac.css', __FILE__ ) );
201
+ wp_enqueue_style( 'pac-layout-styles', plugins_url( '/assets/css/layout.css', __FILE__ ), '', '', 'only screen and (min-width: ' . apply_filters( 'woocommerce_style_smallscreen_breakpoint', $breakpoint = '768px' ) . ')' );
202
  }
203
 
204
  // Fire customisations!
292
 
293
  // Per Page Dropdown
294
  function woocommerce_pac_show_product_perpage() {
295
+ $per_page = get_option( 'wc_pac_products_per_page' );
296
+
297
+ if ( isset( $_REQUEST['per_page'] ) ) {
298
+ $woo_per_page = $_REQUEST['per_page'];
299
+ } elseif ( ! isset( $_REQUEST['per_page'] ) && isset( $_COOKIE['per_page'] ) ) {
300
+ $woo_per_page = $_COOKIE['per_page'];
301
+ } else {
302
+ $woo_per_page = $per_page;
303
+ }
304
+
305
  ?>
306
  <form class="woocommerce-ordering" method="post">
307
  <select name="per_page" class="per_page" onchange="this.form.submit()">
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.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
 
@@ -19,7 +19,7 @@ Please feel free to contribute on <a href="https://github.com/jameskoster/woocom
19
 
20
  1. Upload `woocommerce-product-archive-customiser` to the `/wp-content/plugins/` directory
21
  2. Activate the plugin through the 'Plugins' menu in WordPress
22
- 3. Configure the options on the Catalog tab of the WooCommerce settings screen.
23
  3. Done!
24
 
25
  == Frequently Asked Questions ==
@@ -49,6 +49,10 @@ function remove_pac_styles() {
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
 
2
  Contributors: jameskoster
3
  Tags: woocommerce, ecommerce, products
4
  Requires at least: 3.5
5
+ Tested up to: 3.8.1
6
+ Stable tag: 0.3.0
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
19
 
20
  1. Upload `woocommerce-product-archive-customiser` to the `/wp-content/plugins/` directory
21
  2. Activate the plugin through the 'Plugins' menu in WordPress
22
+ 3. Configure the options on the Products tab of the WooCommerce settings screen.
23
  3. Done!
24
 
25
  == Frequently Asked Questions ==
49
 
50
  == Changelog ==
51
 
52
+ = 0.3.0 - 04/02/2014 =
53
+ * WooCommerce 2.1 compatibility.
54
+ * Fixed a notice when using the products per page selector feature.
55
+
56
  = 0.2.0 - 28/11/2013 =
57
  * Added option for user to choose how many products to display per page. Kudos @spmlucas.
58