WooCommerce Products Per Page - Version 1.2.3

Version Description

  • 23/10/2017 =

  • [i18n] - Add Swedish translation

  • [i18n] - Add Romanian translation

  • [Fix] - Persistent cart snag where cart data gets deleted when logging out/back in

Download this release

Release Info

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

Code changes from version 1.2.2 to 1.2.3

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"
 
languages/woocommerce-products-per-page-ro_RO.po ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: WooCommerce Products Per Page 1.0.1\n"
4
+ "POT-Creation-Date: 2014-03-15 14:13+0100\n"
5
+ "PO-Revision-Date: \n"
6
+ "Language-Team: Jeroen Sormani <jeroen.sormani@gmail.com>\n"
7
+ "MIME-Version: 1.0\n"
8
+ "Content-Type: text/plain; charset=UTF-8\n"
9
+ "Content-Transfer-Encoding: 8bit\n"
10
+ "X-Generator: Poedit 1.8.6\n"
11
+ "X-Poedit-KeywordsList: __;_e\n"
12
+ "X-Poedit-Basepath: /Users/Jeroen/plugins/woocommerce-products-per-page/"
13
+ "trunk\n"
14
+ "Plural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!"
15
+ "=0)))?2:1));\n"
16
+ "X-Poedit-SourceCharset: UTF-8\n"
17
+ "Last-Translator: \n"
18
+ "Language: ro_RO\n"
19
+ "X-Poedit-SearchPath-0: /Users/Jeroen/plugins/woocommerce-products-per-page/"
20
+ "trunk\n"
21
+
22
+ #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:27
23
+ msgid "Dropdown location"
24
+ msgstr "Locația butonului dropdown"
25
+
26
+ #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:35
27
+ msgid "List of dropdown options"
28
+ msgstr "Lista de opțiuni din dropdown"
29
+
30
+ #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:43
31
+ msgid "Default products per page"
32
+ msgstr "Număr default de produse"
33
+
34
+ #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:51
35
+ msgid "Shop columns"
36
+ msgstr "Coloane de produse"
37
+
38
+ #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:59
39
+ msgid "First category page"
40
+ msgstr "Pagina primei categorii"
41
+
42
+ #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:73
43
+ msgid "WooCommerce Products Per Page"
44
+ msgstr "WooCommerce Products Per Page"
45
+
46
+ #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:92
47
+ msgid "Top"
48
+ msgstr "Sus pe pagină"
49
+
50
+ #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:93
51
+ msgid "Bottom"
52
+ msgstr "Jos pe pagină"
53
+
54
+ #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:94
55
+ msgid "Top/Bottom"
56
+ msgstr "Sus pe pagină/Jos pe pagină"
57
+
58
+ #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:95
59
+ msgid "None"
60
+ msgstr "Nicăieri"
61
+
62
+ #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:107
63
+ msgid "Seperated by spaces <em>(-1 for all products)</em>"
64
+ msgstr "Separate de spații <em>(-1 pentru toate produsele)</em>"
65
+
66
+ #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:118
67
+ msgid "-1 for all products"
68
+ msgstr "-1 pentru toate produsele"
69
+
70
+ #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:140
71
+ msgid ""
72
+ "When checked and a new number of PPP is selected, the visitor will be send "
73
+ "to the first page of the product category"
74
+ msgstr ""
75
+ "Dacă este selectat și vizitatorul selectează o opțiune, va fi trimis pe "
76
+ "prima pagină a categoriei."
77
+
78
+ #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:187
79
+ msgid "Configure the WooCommerce Product Per Page settings here."
80
+ msgstr "Configurează WooCommerce Product Per Page"
81
+
82
+ #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/objects/wppp-dropdown.php:49
83
+ #, php-format
84
+ msgid "%s products per page"
85
+ msgstr "%s produse pe pagină"
86
+
87
+ #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/objects/wppp-dropdown.php:50
88
+ msgid "All"
89
+ msgstr "Toate"
languages/woocommerce-products-per-page-sv_SE.MO ADDED
Binary file
languages/woocommerce-products-per-page-sv_SE.PO ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Woocommerce Products Per Page v1.1.6\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2016-01-12 17:23+0100\n"
6
+ "PO-Revision-Date: 2016-01-12 17:25+0100\n"
7
+ "Last-Translator: kelderkold <keld@slotworld.dk>\n"
8
+ "Language-Team: \n"
9
+ "Language: da_DK\n"
10
+ "MIME-Version: 1.0\n"
11
+ "Content-Type: text/plain; charset=UTF-8\n"
12
+ "Content-Transfer-Encoding: 8bit\n"
13
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
14
+ "X-Generator: Poedit 1.5.7\n"
15
+ "X-Poedit-SourceCharset: utf-8\n"
16
+ "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
17
+ "_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
18
+ "X-Poedit-Basepath: ../\n"
19
+ "X-Textdomain-Support: yes\n"
20
+ "X-Poedit-SearchPath-0: .\n"
21
+
22
+ #: woocommerce-products-per-page.php:214
23
+ msgid "Settings"
24
+ msgstr ""
25
+
26
+ # @ woocommerce-products-per-page
27
+ #: includes/class-wppp-front-end.php:98
28
+ #, php-format
29
+ msgid "%s products per page"
30
+ msgstr "%s produkter per sida"
31
+
32
+ # @ woocommerce-products-per-page
33
+ #: includes/class-wppp-front-end.php:99
34
+ msgid "All"
35
+ msgstr "Alla"
36
+
37
+ # @ woocommerce-products-per-page
38
+ #: includes/admin/class-wppp-admin-settings.php:64
39
+ msgid "Drop-down location"
40
+ msgstr "Placering av rullgardinsmenyn"
41
+
42
+ # @ woocommerce-products-per-page
43
+ #: includes/admin/class-wppp-admin-settings.php:72
44
+ msgid "Top"
45
+ msgstr "Topp"
46
+
47
+ # @ woocommerce-products-per-page
48
+ #: includes/admin/class-wppp-admin-settings.php:73
49
+ msgid "Bottom"
50
+ msgstr "Botten"
51
+
52
+ # @ woocommerce-products-per-page
53
+ #: includes/admin/class-wppp-admin-settings.php:74
54
+ msgid "Top/Bottom"
55
+ msgstr "Topp/Botten"
56
+
57
+ # @ woocommerce-products-per-page
58
+ #: includes/admin/class-wppp-admin-settings.php:75
59
+ msgid "None"
60
+ msgstr "Ingen"
61
+
62
+ # @ woocommerce-products-per-page
63
+ #: includes/admin/class-wppp-admin-settings.php:81
64
+ msgid "List of dropdown options"
65
+ msgstr "Lista över rullgardinsmeny alternativ"
66
+
67
+ # @ woocommerce-products-per-page
68
+ #: includes/admin/class-wppp-admin-settings.php:82
69
+ msgid "Seperated by spaces <em>(-1 for all products)</em>"
70
+ msgstr "Separerade med mellanrum <em>(-1 för alla produkter)</em>"
71
+
72
+ # @ woocommerce-products-per-page
73
+ #: includes/admin/class-wppp-admin-settings.php:89
74
+ msgid "Default products per page"
75
+ msgstr "Standard antal produkter per sida"
76
+
77
+ # @ woocommerce-products-per-page
78
+ #: includes/admin/class-wppp-admin-settings.php:90
79
+ msgid "-1 for all products"
80
+ msgstr "-1 för alla produkter"
81
+
82
+ # @ woocommerce-products-per-page
83
+ #: includes/admin/class-wppp-admin-settings.php:98
84
+ msgid "Shop columns"
85
+ msgstr "Kolumner i butiken"
86
+
87
+ # @ woocommerce-products-per-page
88
+ #: includes/admin/class-wppp-admin-settings.php:111
89
+ msgid "First category page"
90
+ msgstr "Första kategorisidan"
91
+
92
+ # @ woocommerce-products-per-page
93
+ #: includes/admin/class-wppp-admin-settings.php:112
94
+ msgid ""
95
+ "When checked and a new number of PPP is selected, the visitor will be send "
96
+ "to the first page of the product category"
97
+ msgstr ""
98
+ "Om du aktiverar detta val och ett nytt alternativ av produkter per sida "
99
+ "väljs i rullgardinsmeny kommer besökaren att skickas till den första sidan i "
100
+ "den valda produktkategori."
101
+
102
+ # @ woocommerce-products-per-page
103
+ #: includes/admin/class-wppp-admin-settings.php:119
104
+ msgid "HTTP method"
105
+ msgstr "HTTP-metod"
106
+
107
+ # @ woocommerce-products-per-page
108
+ #: includes/admin/class-wppp-admin-settings.php:120
109
+ msgid ""
110
+ "GET sends the products per page via the url, POST does this on the background"
111
+ msgstr "GET skickar produkter per sida via url, POST gör detta i bakgrunden"
112
+
113
+ # @ woocommerce-products-per-page
114
+ #: includes/admin/class-wppp-admin-settings.php:126
115
+ msgid "POST"
116
+ msgstr "POST"
117
+
118
+ # @ woocommerce-products-per-page
119
+ #: includes/admin/class-wppp-admin-settings.php:127
120
+ msgid "GET"
121
+ msgstr "GET"
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  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.7.3
6
- Stable tag: 1.2.2
7
  License: GPLv3 or later
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -37,6 +37,8 @@ Options like:
37
  - Brazilian
38
  - Russian
39
  - Hebrew
 
 
40
 
41
  == Installation ==
42
 
@@ -67,6 +69,12 @@ Feel free to open a support thread if you need any further help. Please do note
67
 
68
  == Changelog ==
69
 
 
 
 
 
 
 
70
  = 1.2.2 - 23/12/2015 =
71
 
72
  * [i18n] - Add Russian translation
2
  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.8.2
6
+ Stable tag: 1.2.3
7
  License: GPLv3 or later
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
37
  - Brazilian
38
  - Russian
39
  - Hebrew
40
+ - Swedish
41
+ - Romanian
42
 
43
  == Installation ==
44
 
69
 
70
  == Changelog ==
71
 
72
+ = 1.2.3 - 23/10/2017 =
73
+
74
+ * [i18n] - Add Swedish translation
75
+ * [i18n] - Add Romanian translation
76
+ * [Fix] - Persistent cart snag where cart data gets deleted when logging out/back in
77
+
78
  = 1.2.2 - 23/12/2015 =
79
 
80
  * [i18n] - Add Russian translation
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.2
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.2';
51
 
52
 
53
  /**
@@ -119,7 +119,9 @@ class Woocommerce_Products_Per_Page {
119
  require_once plugin_dir_path( __FILE__ ) . 'includes/admin/class-wppp-admin-settings.php';
120
  $this->admin_settings = new WPPP_Admin_Settings();
121
 
122
- else :
 
 
123
 
124
  /**
125
  * Front end
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.3
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.3';
51
 
52
 
53
  /**
119
  require_once plugin_dir_path( __FILE__ ) . 'includes/admin/class-wppp-admin-settings.php';
120
  $this->admin_settings = new WPPP_Admin_Settings();
121
 
122
+ endif;
123
+
124
+ if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) :
125
 
126
  /**
127
  * Front end