WooCommerce Product Archive Customiser - Version 1.0.3

Version Description

  • 13/10/2016 =
  • Fix - Column layout
  • Fix - Stock quantities of 1 are now displayed.
Download this release

Release Info

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

Code changes from version 1.0.2 to 1.0.3

assets/css/layout.css CHANGED
@@ -3,18 +3,34 @@
3
  width: 48%;
4
  margin-right: 3.8%;
5
  }
 
 
 
 
6
  .woocommerce.product-columns-3 ul.products li.product,
7
  .woocommerce-page.product-columns-3 ul.products li.product {
8
  width: 30.75%;
9
  margin-right: 3.8%;
10
  }
 
 
 
 
11
  .woocommerce.product-columns-4 ul.products li.product,
12
  .woocommerce-page.product-columns-4 ul.products li.product {
13
  width: 22.05%;
14
  margin-right: 3.8%;
15
  }
 
 
 
 
16
  .woocommerce.product-columns-5 ul.products li.product,
17
  .woocommerce-page.product-columns-5 ul.products li.product {
18
  width: 16.9%;
19
  margin-right: 3.8%;
20
  }
 
 
 
 
3
  width: 48%;
4
  margin-right: 3.8%;
5
  }
6
+ .woocommerce.product-columns-2 ul.products li.product.last,
7
+ .woocommerce-page.product-columns-2 ul.products li.product.last {
8
+ margin-right: 0;
9
+ }
10
  .woocommerce.product-columns-3 ul.products li.product,
11
  .woocommerce-page.product-columns-3 ul.products li.product {
12
  width: 30.75%;
13
  margin-right: 3.8%;
14
  }
15
+ .woocommerce.product-columns-3 ul.products li.product.last,
16
+ .woocommerce-page.product-columns-3 ul.products li.product.last {
17
+ margin-right: 0;
18
+ }
19
  .woocommerce.product-columns-4 ul.products li.product,
20
  .woocommerce-page.product-columns-4 ul.products li.product {
21
  width: 22.05%;
22
  margin-right: 3.8%;
23
  }
24
+ .woocommerce.product-columns-4 ul.products li.product.last,
25
+ .woocommerce-page.product-columns-4 ul.products li.product.last {
26
+ margin-right: 0;
27
+ }
28
  .woocommerce.product-columns-5 ul.products li.product,
29
  .woocommerce-page.product-columns-5 ul.products li.product {
30
  width: 16.9%;
31
  margin-right: 3.8%;
32
  }
33
+ .woocommerce.product-columns-5 ul.products li.product.last,
34
+ .woocommerce-page.product-columns-5 ul.products li.product.last {
35
+ margin-right: 0;
36
+ }
assets/css/layout.less CHANGED
@@ -4,6 +4,10 @@
4
  li.product {
5
  width:48%;
6
  margin-right: 3.8%;
 
 
 
 
7
  }
8
  }
9
  }
@@ -12,6 +16,10 @@
12
  li.product {
13
  width:30.75%;
14
  margin-right: 3.8%;
 
 
 
 
15
  }
16
  }
17
  }
@@ -20,6 +28,10 @@
20
  li.product {
21
  width:22.05%;
22
  margin-right: 3.8%;
 
 
 
 
23
  }
24
  }
25
  }
@@ -28,6 +40,10 @@
28
  li.product {
29
  width:16.9%;
30
  margin-right: 3.8%;
 
 
 
 
31
  }
32
  }
33
  }
4
  li.product {
5
  width:48%;
6
  margin-right: 3.8%;
7
+
8
+ &.last {
9
+ margin-right: 0;
10
+ }
11
  }
12
  }
13
  }
16
  li.product {
17
  width:30.75%;
18
  margin-right: 3.8%;
19
+
20
+ &.last {
21
+ margin-right: 0;
22
+ }
23
  }
24
  }
25
  }
28
  li.product {
29
  width:22.05%;
30
  margin-right: 3.8%;
31
+
32
+ &.last {
33
+ margin-right: 0;
34
+ }
35
  }
36
  }
37
  }
40
  li.product {
41
  width:16.9%;
42
  margin-right: 3.8%;
43
+
44
+ &.last {
45
+ margin-right: 0;
46
+ }
47
  }
48
  }
49
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: jameskoster
3
  Tags: woocommerce, ecommerce, products
4
  Requires at least: 4.4
5
  Tested up to: 4.6.1
6
- Stable tag: 1.0.2
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
  = 1.0.2 - 06/10/2016 =
53
  * Fix - Specify a default for Customizer settings.
54
  * Fix - More explicit css for column layout.
3
  Tags: woocommerce, ecommerce, products
4
  Requires at least: 4.4
5
  Tested up to: 4.6.1
6
+ Stable tag: 1.0.3
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
49
 
50
  == Changelog ==
51
 
52
+ = 1.0.3 - 13/10/2016 =
53
+ * Fix - Column layout
54
+ * Fix - Stock quantities of 1 are now displayed.
55
+
56
  = 1.0.2 - 06/10/2016 =
57
  * Fix - Specify a default for Customizer settings.
58
  * Fix - More explicit css for column layout.
woocommerce-product-archive-customiser.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: WooCommerce Product Archive Customiser
4
  * Plugin URI: https://wordpress.org/plugins/woocommerce-product-archive-customiser/
5
- * Version: 1.0.2
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: 4.6.1
@@ -48,7 +48,7 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
48
  * The constructor!
49
  */
50
  public function __construct() {
51
- $this->version = '1.0.1';
52
 
53
  add_action( 'wp_enqueue_scripts', array( $this, 'wc_pac_styles' ) );
54
  add_action( 'init', array( $this, 'wc_pac_setup' ) );
@@ -649,11 +649,14 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
649
  */
650
  function woocommerce_pac_show_product_stock() {
651
  global $product;
652
- $stock = $product->get_total_stock();
653
- if ( ! $product->is_in_stock() ) {
654
- echo '<p class="stock out-of-stock"><small>' . esc_attr__( 'Out of stock', 'woocommerce-product-archive-customiser' ) . '</small></p>';
655
- } elseif ( $stock > 1 ) {
656
- echo '<p class="stock in-stock"><small>' . sprintf( esc_attr__( '%s in stock', 'woocommerce-product-archive-customiser' ), esc_attr( $stock ) ) . '</small></p>';
 
 
 
657
  }
658
  }
659
  }
2
  /**
3
  * Plugin Name: WooCommerce Product Archive Customiser
4
  * Plugin URI: https://wordpress.org/plugins/woocommerce-product-archive-customiser/
5
+ * Version: 1.0.3
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: 4.6.1
48
  * The constructor!
49
  */
50
  public function __construct() {
51
+ $this->version = '1.0.3';
52
 
53
  add_action( 'wp_enqueue_scripts', array( $this, 'wc_pac_styles' ) );
54
  add_action( 'init', array( $this, 'wc_pac_setup' ) );
649
  */
650
  function woocommerce_pac_show_product_stock() {
651
  global $product;
652
+ $stock = $product->get_total_stock();
653
+ $product_availability = $product->get_availability();
654
+ $availability_text = $product_availability['availability'];
655
+
656
+ if ( $product->is_in_stock() ) {
657
+ echo '<p class="stock in-stock"><small>' . esc_attr( $availability_text ) . '</small></p>';
658
+ } else {
659
+ echo '<p class="stock out-of-stock"><small>' . esc_attr( $availability_text ) . '</small></p>';
660
  }
661
  }
662
  }