WooCommerce Product Archive Customiser - Version 0.5.0

Version Description

  • 30/01/2015 =
  • Tweak - CSS classes for new badge / categories moved to parent element. Props emirpprime
  • Tweak - Fixed potential 'page not found' errors when using the products per page selector feature. Props billras
Download this release

Release Info

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

Code changes from version 0.4.0 to 0.5.0

Files changed (2) hide show
  1. archive-customiser.php +23 -4
  2. readme.txt +6 -2
archive-customiser.php CHANGED
@@ -2,9 +2,10 @@
2
  /*
3
  Plugin Name: WooCommerce Product Archive Customiser
4
  Plugin URI: http://jameskoster.co.uk/tag/product-archive-customiser/
5
- Version: 0.4.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
  Author URI: http://jameskoster.co.uk
9
  Text Domain: woocommerce-product-archive-customiser
10
  Domain Path: /languages/
@@ -301,8 +302,26 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
301
  $woo_per_page = $per_page;
302
  }
303
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
304
  ?>
305
- <form class="woocommerce-ordering" method="post">
306
  <select name="per_page" class="per_page" onchange="this.form.submit()">
307
  <?php
308
  $x = 1;
@@ -338,14 +357,14 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
338
  $newness = get_option( 'wc_pac_newness' ); // Newness in days as defined by option
339
 
340
  if ( ( time() - ( 60 * 60 * 24 * $newness ) ) < $postdatestamp ) { // If the product was published within the newness time frame display the new badge
341
- echo '<p><span class="wc-new-badge">' . __( 'New', 'woocommerce-product-archive-customiser' ) . '</span></p>';
342
  }
343
  }
344
 
345
  function woocommerce_pac_show_product_categories() {
346
  global $post;
347
  $terms_as_links = get_the_term_list( $post->ID, 'product_cat', '', ', ', '' );
348
- echo '<p><small class="categories">' . $terms_as_links . '</small></p>';
349
  }
350
 
351
  function woocommerce_pac_show_product_stock() {
2
  /*
3
  Plugin Name: WooCommerce Product Archive Customiser
4
  Plugin URI: http://jameskoster.co.uk/tag/product-archive-customiser/
5
+ Version: 0.5.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.9.1
9
  Author URI: http://jameskoster.co.uk
10
  Text Domain: woocommerce-product-archive-customiser
11
  Domain Path: /languages/
302
  $woo_per_page = $per_page;
303
  }
304
 
305
+ // set action URL
306
+ if ( is_shop() ) {
307
+ $url = get_permalink( wc_get_page_id( 'shop' ) );
308
+ } elseif ( is_product_category() ) {
309
+ global $wp_query;
310
+ $cat = $wp_query->get_queried_object();
311
+ $url = get_term_link( $cat );
312
+ } elseif ( is_product_tag() ) {
313
+ global $wp_query;
314
+ $tag = $wp_query->get_queried_object();
315
+ $url = get_term_link( $tag );
316
+ }
317
+
318
+ // add querystring to URL if set
319
+ if ( $_SERVER['QUERY_STRING'] != '' ) {
320
+ $url .= '?' . $_SERVER['QUERY_STRING'];
321
+ }
322
+
323
  ?>
324
+ <form class="woocommerce-ordering" method="post" action="<?php echo $url; ?>">
325
  <select name="per_page" class="per_page" onchange="this.form.submit()">
326
  <?php
327
  $x = 1;
357
  $newness = get_option( 'wc_pac_newness' ); // Newness in days as defined by option
358
 
359
  if ( ( time() - ( 60 * 60 * 24 * $newness ) ) < $postdatestamp ) { // If the product was published within the newness time frame display the new badge
360
+ echo '<p class="wc-new-badge"><span>' . __( 'New', 'woocommerce-product-archive-customiser' ) . '</span></p>';
361
  }
362
  }
363
 
364
  function woocommerce_pac_show_product_categories() {
365
  global $post;
366
  $terms_as_links = get_the_term_list( $post->ID, 'product_cat', '', ', ', '' );
367
+ echo '<p class="categories"><small>' . $terms_as_links . '</small></p>';
368
  }
369
 
370
  function woocommerce_pac_show_product_stock() {
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: 4.0
6
- Stable tag: 0.4.0
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -49,6 +49,10 @@ function remove_pac_styles() {
49
 
50
  == Changelog ==
51
 
 
 
 
 
52
  = 0.4.0 - 13/06/2014 =
53
  * Fix - Rating option
54
  * Localization - Added .pot.
2
  Contributors: jameskoster
3
  Tags: woocommerce, ecommerce, products
4
  Requires at least: 3.5
5
+ Tested up to: 4.1
6
+ Stable tag: 0.5.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.5.0 - 30/01/2015 =
53
+ * Tweak - CSS classes for new badge / categories moved to parent element. Props emirpprime
54
+ * Tweak - Fixed potential 'page not found' errors when using the products per page selector feature. Props billras
55
+
56
  = 0.4.0 - 13/06/2014 =
57
  * Fix - Rating option
58
  * Localization - Added .pot.