WooCommerce Products Per Page - Version 1.2.5

Version Description

  • 20/11/2017 =

  • [Fix] - Accidentally overwrote the changes of 1.2.3 in version 1.2.4, this re-applies those changes. Sorry for the inconvenience.

Download this release

Release Info

Developer sormano
Plugin Icon 128x128 WooCommerce Products Per Page
Version 1.2.5
Comparing to
See all releases

Code changes from version 1.2.4 to 1.2.5

includes/class-wppp-front-end.php CHANGED
@@ -32,17 +32,14 @@ class WPPP_Front_End {
32
  endif;
33
 
34
  // Add filter for product columns
35
- add_filter( 'loop_shop_columns', array( $this, 'loop_shop_columns' ) );
36
 
37
  // Custom number of products per page
38
- add_filter( 'loop_shop_per_page', array( $this, 'loop_shop_per_page' ) );
39
 
40
  // Get the right amount of products from the DB
41
  add_action( 'woocommerce_product_query', array( $this, 'woocommerce_product_query' ), 2, 50 );
42
 
43
- // Set cookie so PPP will be saved
44
- add_action( 'init', array( $this, 'set_customer_session' ), 10 );
45
-
46
  // Check if ppp form is fired
47
  add_action( 'init', array( $this, 'products_per_page_action' ) );
48
 
@@ -163,8 +160,8 @@ class WPPP_Front_End {
163
  return intval( $_REQUEST['wppp_ppp'] );
164
  elseif ( isset( $_REQUEST['ppp'] ) ) :
165
  return intval( $_REQUEST['ppp'] );
166
- elseif ( WC()->session->__isset( 'products_per_page' ) ) :
167
- return intval( WC()->session->__get( 'products_per_page' ) );
168
  else :
169
  return intval( get_option( 'wppp_default_ppp', '12' ) );
170
  endif;
@@ -192,22 +189,6 @@ class WPPP_Front_End {
192
  }
193
 
194
 
195
- /**
196
- * Initialize session.
197
- *
198
- * Set an initial session for WC 2.1.X users. Cookies are set automatically prior 2.1.X.
199
- *
200
- * @since 1.2.0
201
- */
202
- public function set_customer_session() {
203
-
204
- if ( WC()->version > '2.1' && ( ! is_admin() || defined( 'DOING_AJAX' ) ) && ! defined( 'DOING_CRON' ) ) :
205
- WC()->session->set_customer_session_cookie( true );
206
- endif;
207
-
208
- }
209
-
210
-
211
  /**
212
  * PPP action.
213
  *
@@ -219,9 +200,9 @@ class WPPP_Front_End {
219
  public function products_per_page_action() {
220
 
221
  if ( isset( $_REQUEST['wppp_ppp'] ) ) :
222
- WC()->session->set( 'products_per_page', intval( $_REQUEST['wppp_ppp'] ) );
223
  elseif ( isset( $_REQUEST['ppp'] ) ) :
224
- WC()->session->set( 'products_per_page', intval( $_REQUEST['ppp'] ) );
225
  endif;
226
 
227
  }
32
  endif;
33
 
34
  // Add filter for product columns
35
+ add_filter( 'loop_shop_columns', array( $this, 'loop_shop_columns' ), 100 );
36
 
37
  // Custom number of products per page
38
+ add_filter( 'loop_shop_per_page', array( $this, 'loop_shop_per_page' ), 100 );
39
 
40
  // Get the right amount of products from the DB
41
  add_action( 'woocommerce_product_query', array( $this, 'woocommerce_product_query' ), 2, 50 );
42
 
 
 
 
43
  // Check if ppp form is fired
44
  add_action( 'init', array( $this, 'products_per_page_action' ) );
45
 
160
  return intval( $_REQUEST['wppp_ppp'] );
161
  elseif ( isset( $_REQUEST['ppp'] ) ) :
162
  return intval( $_REQUEST['ppp'] );
163
+ elseif ( isset( $_COOKIE['woocommerce_products_per_page'] ) ) :
164
+ return $_COOKIE['woocommerce_products_per_page'];
165
  else :
166
  return intval( get_option( 'wppp_default_ppp', '12' ) );
167
  endif;
189
  }
190
 
191
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192
  /**
193
  * PPP action.
194
  *
200
  public function products_per_page_action() {
201
 
202
  if ( isset( $_REQUEST['wppp_ppp'] ) ) :
203
+ wc_setcookie( 'woocommerce_products_per_page', intval( $_REQUEST['wppp_ppp'] ), time() + DAY_IN_SECONDS * 2, apply_filters( 'wc_session_use_secure_cookie', false ) );
204
  elseif ( isset( $_REQUEST['ppp'] ) ) :
205
+ wc_setcookie( 'woocommerce_products_per_page', intval( $_REQUEST['ppp'] ), time() + DAY_IN_SECONDS * 2, apply_filters( 'wc_session_use_secure_cookie', false ) );
206
  endif;
207
 
208
  }
languages/woocommerce-products-per-page-de_DE.mo CHANGED
Binary file
languages/woocommerce-products-per-page-de_DE.po CHANGED
@@ -5,11 +5,11 @@ msgstr ""
5
  "PO-Revision-Date: \n"
6
  "Last-Translator: Michael Firnkes <info@blogprofis.de>\n"
7
  "Language-Team: Jeroen Sormani <jeroen.sormani@gmail.com>\n"
8
- "Language: French\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 1.5.5\n"
13
  "X-Poedit-KeywordsList: __;_e\n"
14
  "X-Poedit-Basepath: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/\n"
15
  "Plural-Forms: nplurals=2; plural=n == 1 ? 0 : 1;\n"
@@ -58,7 +58,7 @@ msgstr "Keine"
58
 
59
  #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:107
60
  msgid "Seperated by spaces <em>(-1 for all products)</em>"
61
- msgstr "Kommagetrennte Eingabe <em>(-1 für 'Alle Produkte anzeigen')</em>"
62
 
63
  #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:118
64
  msgid "-1 for all products"
@@ -80,4 +80,3 @@ msgstr "%s Produkte pro Seite"
80
  #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/objects/wppp-dropdown.php:50
81
  msgid "All"
82
  msgstr "Alle"
83
-
5
  "PO-Revision-Date: \n"
6
  "Last-Translator: Michael Firnkes <info@blogprofis.de>\n"
7
  "Language-Team: Jeroen Sormani <jeroen.sormani@gmail.com>\n"
8
+ "Language: fr\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 1.7.1\n"
13
  "X-Poedit-KeywordsList: __;_e\n"
14
  "X-Poedit-Basepath: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/\n"
15
  "Plural-Forms: nplurals=2; plural=n == 1 ? 0 : 1;\n"
58
 
59
  #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:107
60
  msgid "Seperated by spaces <em>(-1 for all products)</em>"
61
+ msgstr "Mit Leerzeichen trennen <em>(-1 für alle Produkte)</em>"
62
 
63
  #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:118
64
  msgid "-1 for all products"
80
  #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/objects/wppp-dropdown.php:50
81
  msgid "All"
82
  msgstr "Alle"
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: sormano
3
  Tags: woocommerce, products per page, woocommerce products, woocommerce products per page, products, per page
4
  Requires at least: 4.0.0
5
  Tested up to: 4.9
6
- Stable tag: 1.2.4
7
  License: GPLv3 or later
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -69,6 +69,10 @@ Feel free to open a support thread if you need any further help. Please do note
69
 
70
  == Changelog ==
71
 
 
 
 
 
72
  = 1.2.4 - 07/11/2017 =
73
 
74
  * [Fix] - Default 'list of dropdown options' setting is not properly set on the settings page.
3
  Tags: woocommerce, products per page, woocommerce products, woocommerce products per page, products, per page
4
  Requires at least: 4.0.0
5
  Tested up to: 4.9
6
+ Stable tag: 1.2.5
7
  License: GPLv3 or later
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
69
 
70
  == Changelog ==
71
 
72
+ = 1.2.5 - 20/11/2017 =
73
+
74
+ * [Fix] - Accidentally overwrote the changes of 1.2.3 in version 1.2.4, this re-applies those changes. Sorry for the inconvenience.
75
+
76
  = 1.2.4 - 07/11/2017 =
77
 
78
  * [Fix] - Default 'list of dropdown options' setting is not properly set on the settings page.
woocommerce-products-per-page.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Woocommerce Products Per Page
4
  * Plugin URI: https://wordpress.org/plugins/woocommerce-products-per-page/
5
  * Description: Integrate a 'products per page' dropdown on your WooCommerce website! Set-up in <strong>seconds</strong>!
6
- * Version: 1.2.4
7
  * Author: Jeroen Sormani
8
  * Author URI: http://jeroensormani.com
9
 
@@ -47,7 +47,7 @@ class Woocommerce_Products_Per_Page {
47
  * @since 1.2.0
48
  * @var string $version Plugin version number.
49
  */
50
- public $version = '1.2.4';
51
 
52
 
53
  /**
3
  * Plugin Name: Woocommerce Products Per Page
4
  * Plugin URI: https://wordpress.org/plugins/woocommerce-products-per-page/
5
  * Description: Integrate a 'products per page' dropdown on your WooCommerce website! Set-up in <strong>seconds</strong>!
6
+ * Version: 1.2.5
7
  * Author: Jeroen Sormani
8
  * Author URI: http://jeroensormani.com
9
 
47
  * @since 1.2.0
48
  * @var string $version Plugin version number.
49
  */
50
+ public $version = '1.2.5';
51
 
52
 
53
  /**