Version Description
- Improvement - For dropdown on product showing pages only
- Improvement - Compatibility for WC 2.1.X
- Fix - WC 2.1.X now saves PPP with empty cart
Download this release
Release Info
Developer | sormano |
Plugin | WooCommerce Products Per Page |
Version | 1.0.9 |
Comparing to | |
See all releases |
Code changes from version 1.0.8 to 1.0.9
- objects/wppp-dropdown.php +16 -6
- readme.txt +7 -1
- woocommerce-products-per-page.php +16 -1
objects/wppp-dropdown.php
CHANGED
@@ -26,14 +26,15 @@ class wppp_dropdown extends woocommerce_products_per_page {
|
|
26 |
|
27 |
// Set action url if option behaviour is true
|
28 |
// Paste QUERY string after for filter and orderby support
|
|
|
29 |
if ( true == $cat->term_id && true == $this->options['behaviour'] && 'product_cat' == $cat->taxonomy ) :
|
30 |
-
$action = ' action="' . get_term_link( $cat->term_id, 'product_cat' ) .
|
31 |
elseif ( true == $this->options['behaviour'] ) :
|
32 |
-
$action = 'action="' . get_permalink( woocommerce_get_page_id( 'shop' ) ) .
|
33 |
endif;
|
34 |
|
35 |
// Only show on product categories
|
36 |
-
if (
|
37 |
?>
|
38 |
|
39 |
<form method="post" <?php echo $action; ?> class="form-wppp-select products-per-page">
|
@@ -45,10 +46,19 @@ class wppp_dropdown extends woocommerce_products_per_page {
|
|
45 |
<?php
|
46 |
global $woocommerce;
|
47 |
foreach( $this->productsPerPage as $key => $value ) :
|
48 |
-
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
?>
|
51 |
-
<option value="<?php echo $value; ?>" <?php selected( $value, $
|
52 |
<?php
|
53 |
$ppp_text = apply_filters( 'wppp_ppp_text', __( '%s products per page', 'wppp' ) );
|
54 |
printf( $ppp_text, $value == -1 ? __( 'All', 'wppp' ) : $value ); // Set to 'All' when value is -1
|
26 |
|
27 |
// Set action url if option behaviour is true
|
28 |
// Paste QUERY string after for filter and orderby support
|
29 |
+
$query_string = !empty( $_SERVER['QUERY_STRING'] ) ? '?' . $_SERVER['QUERY_STRING'] : null;
|
30 |
if ( true == $cat->term_id && true == $this->options['behaviour'] && 'product_cat' == $cat->taxonomy ) :
|
31 |
+
$action = ' action="' . get_term_link( $cat->term_id, 'product_cat' ) . $query_string . '"';
|
32 |
elseif ( true == $this->options['behaviour'] ) :
|
33 |
+
$action = 'action="' . get_permalink( woocommerce_get_page_id( 'shop' ) ) . $query_string . '"';
|
34 |
endif;
|
35 |
|
36 |
// Only show on product categories
|
37 |
+
if ( woocommerce_products_will_display() ) :
|
38 |
?>
|
39 |
|
40 |
<form method="post" <?php echo $action; ?> class="form-wppp-select products-per-page">
|
46 |
<?php
|
47 |
global $woocommerce;
|
48 |
foreach( $this->productsPerPage as $key => $value ) :
|
49 |
+
|
50 |
+
// Get the right match for the selected option
|
51 |
+
$ppp_session = $woocommerce->session->get( 'products_per_page' );
|
52 |
+
if( isset( $_POST['wppp_ppp'] ) ) :
|
53 |
+
$selected_match = $_POST['wppp_ppp'];
|
54 |
+
elseif ( !empty( $ppp_session ) ) :
|
55 |
+
$selected_match = $woocommerce->session->get( 'products_per_page' );
|
56 |
+
else :
|
57 |
+
$selected_match = $this->options['default_ppp'];
|
58 |
+
endif;
|
59 |
+
|
60 |
?>
|
61 |
+
<option value="<?php echo $value; ?>" <?php selected( $value, $selected_match ); ?>>
|
62 |
<?php
|
63 |
$ppp_text = apply_filters( 'wppp_ppp_text', __( '%s products per page', 'wppp' ) );
|
64 |
printf( $ppp_text, $value == -1 ? __( 'All', 'wppp' ) : $value ); // Set to 'All' when value is -1
|
readme.txt
CHANGED
@@ -1,9 +1,10 @@
|
|
1 |
=== WooCommerce Products Per Page ===
|
2 |
Contributors: sormano
|
|
|
3 |
Tags: Products per page, woocommerce, woocommerce products, woocommerce products per page, woocommerce displayed products, woocommerce quantity products, woocommerce amount of products, woocommerce number of products, woocommerce shown products
|
4 |
Requires at least: 3.0.1
|
5 |
Tested up to: 3.8.1
|
6 |
-
Stable tag: 1.0.
|
7 |
License: GPLv3 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
@@ -41,6 +42,11 @@ Options like:
|
|
41 |
|
42 |
== Changelog ==
|
43 |
|
|
|
|
|
|
|
|
|
|
|
44 |
= 1.0.8 =
|
45 |
* Fix - Bug on tag archive pages
|
46 |
* Tweak - Dropdown only shows on pages which show products
|
1 |
=== WooCommerce Products Per Page ===
|
2 |
Contributors: sormano
|
3 |
+
Donate link: http://www.jeroensormani.nl/donate/
|
4 |
Tags: Products per page, woocommerce, woocommerce products, woocommerce products per page, woocommerce displayed products, woocommerce quantity products, woocommerce amount of products, woocommerce number of products, woocommerce shown products
|
5 |
Requires at least: 3.0.1
|
6 |
Tested up to: 3.8.1
|
7 |
+
Stable tag: 1.0.9
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
42 |
|
43 |
== Changelog ==
|
44 |
|
45 |
+
= 1.0.9 =
|
46 |
+
* Improvement - For dropdown on product showing pages only
|
47 |
+
* Improvement - Compatibility for WC 2.1.X
|
48 |
+
* Fix - WC 2.1.X now saves PPP with empty cart
|
49 |
+
|
50 |
= 1.0.8 =
|
51 |
* Fix - Bug on tag archive pages
|
52 |
* Tweak - Dropdown only shows on pages which show products
|
woocommerce-products-per-page.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Woocommerce Products Per Page
|
4 |
Plugin URI: http://www.jeroensormani.nl/
|
5 |
Description: Integrate a 'products per page' dropdown on your WooCommerce website! Set-up in <strong>seconds</strong>!
|
6 |
-
Version: 1.0.
|
7 |
Author: Jeroen Sormani
|
8 |
Author URI: http://www.jeroensormani.nl
|
9 |
|
@@ -36,6 +36,10 @@ class woocommerce_products_per_page {
|
|
36 |
*
|
37 |
*/
|
38 |
public function __construct() {
|
|
|
|
|
|
|
|
|
39 |
|
40 |
$this->wppp_load_options();
|
41 |
|
@@ -59,6 +63,9 @@ class woocommerce_products_per_page {
|
|
59 |
|
60 |
// Load textdomain
|
61 |
load_plugin_textdomain( 'wppp', false, basename( dirname( __FILE__ ) ) . '/languages' );
|
|
|
|
|
|
|
62 |
|
63 |
}
|
64 |
|
@@ -79,6 +86,14 @@ class woocommerce_products_per_page {
|
|
79 |
|
80 |
}
|
81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
/* wppp_submit_intercept()
|
84 |
*
|
3 |
Plugin Name: Woocommerce Products Per Page
|
4 |
Plugin URI: http://www.jeroensormani.nl/
|
5 |
Description: Integrate a 'products per page' dropdown on your WooCommerce website! Set-up in <strong>seconds</strong>!
|
6 |
+
Version: 1.0.9
|
7 |
Author: Jeroen Sormani
|
8 |
Author URI: http://www.jeroensormani.nl
|
9 |
|
36 |
*
|
37 |
*/
|
38 |
public function __construct() {
|
39 |
+
|
40 |
+
if ( ! in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
|
41 |
+
return;
|
42 |
+
}
|
43 |
|
44 |
$this->wppp_load_options();
|
45 |
|
63 |
|
64 |
// Load textdomain
|
65 |
load_plugin_textdomain( 'wppp', false, basename( dirname( __FILE__ ) ) . '/languages' );
|
66 |
+
|
67 |
+
// Set cookie so PPP will be saved
|
68 |
+
add_action( 'init', array( $this, 'wppp_set_customer_cookie' ), 10 );
|
69 |
|
70 |
}
|
71 |
|
86 |
|
87 |
}
|
88 |
|
89 |
+
public function wppp_set_customer_cookie() {
|
90 |
+
|
91 |
+
global $woocommerce;
|
92 |
+
|
93 |
+
if ( $woocommerce->version > '2.1' )
|
94 |
+
$woocommerce->session->set_customer_session_cookie( true );
|
95 |
+
|
96 |
+
}
|
97 |
|
98 |
/* wppp_submit_intercept()
|
99 |
*
|