WooCommerce Products Per Page - Version 1.0.3

Version Description

Download this release

Release Info

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

Code changes from version 1.0.1 to 1.0.3

languages/wppp-nl_NL.mo ADDED
Binary file
languages/wppp-nl_NL.po ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: WooCommerce Products Per Page 1.0.1\n"
4
+ "POT-Creation-Date: 2014-03-08 10:16+0100\n"
5
+ "PO-Revision-Date: \n"
6
+ "Last-Translator: \n"
7
+ "Language-Team: Jeroen Sormani <jeroen.sormani@gmail.com>\n"
8
+ "Language: Nederlands\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/"
15
+ "trunk/\n"
16
+ "X-Poedit-SearchPath-0: /Users/Jeroen/plugins/woocommerce-products-per-page/"
17
+ "trunk\n"
18
+
19
+ #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/objects/wppp-dropdown.php:36
20
+ #, php-format
21
+ msgid "%s products per page"
22
+ msgstr "%s producten per pagina"
23
+
24
+ #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/objects/wppp-dropdown.php:36
25
+ msgid "All"
26
+ msgstr "Alle"
27
+
28
+ #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/views/options-page.php:43
29
+ msgid "Dropdown location"
30
+ msgstr "Dropdown locatie"
31
+
32
+ #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/views/options-page.php:51
33
+ msgid "List of dropdown options"
34
+ msgstr "Lijst van dropdown opties"
35
+
36
+ #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/views/options-page.php:59
37
+ msgid "Default products per page"
38
+ msgstr "Standaard aantal producten per pagina"
39
+
40
+ #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/views/options-page.php:67
41
+ msgid "Shop columns"
42
+ msgstr "Webshop kolommen"
43
+
44
+ #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/views/options-page.php:84
45
+ msgid "WooCommerce Products Per Page"
46
+ msgstr "WooCommerce Products Per Page"
47
+
48
+ #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/views/options-page.php:103
49
+ msgid "Top"
50
+ msgstr "Boven"
51
+
52
+ #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/views/options-page.php:104
53
+ msgid "Bottom"
54
+ msgstr "Onder"
55
+
56
+ #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/views/options-page.php:105
57
+ msgid "Top/Bottom"
58
+ msgstr "Boven/Onder"
59
+
60
+ #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/views/options-page.php:106
61
+ msgid "None"
62
+ msgstr "Geen"
63
+
64
+ #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/views/options-page.php:118
65
+ msgid "Seperated by spaces <em>(-1 for all products)</em>"
66
+ msgstr "Gescheiden door spaties <em>(-1 voor alle producten)</em>"
67
+
68
+ #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/views/options-page.php:129
69
+ msgid "-1 for all products"
70
+ msgstr "-1 voor alle producten"
71
+
72
+ #: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/views/options-page.php:148
73
+ msgid "Configure the WooCommerce Product Per Page settings here."
74
+ msgstr "Configureer WooCommerce Products Per Page instellingen hier."
objects/wppp-dropdown.php CHANGED
@@ -28,11 +28,12 @@ class wppp_dropdown extends woocommerce_products_per_page {
28
  <select name="wppp_ppp" onchange="this.form.submit()" class="select wppp-select">
29
 
30
  <?php
 
31
  foreach( $this->productsPerPage as $key => $value ) :
32
- $selectedMatch = isset( $_POST["wppp_ppp"] ) ? $_POST["wppp_ppp"] : $_COOKIE["products_per_page"];
33
  ?>
34
  <option value="<?php echo $value; ?>" <?php selected( $value, $selectedMatch ); ?>>
35
- <?php printf( __( "%s products per page", "wppp" ), $value==-1?"All" : $value ) ?>
36
  </option>
37
  <?php
38
  endforeach;
28
  <select name="wppp_ppp" onchange="this.form.submit()" class="select wppp-select">
29
 
30
  <?php
31
+ global $woocommerce;
32
  foreach( $this->productsPerPage as $key => $value ) :
33
+ $selectedMatch = isset( $_POST["wppp_ppp"] ) ? $_POST["wppp_ppp"] : $woocommerce->session->get( "products_per_page" );
34
  ?>
35
  <option value="<?php echo $value; ?>" <?php selected( $value, $selectedMatch ); ?>>
36
+ <?php printf( __( "%s products per page", "wppp" ), $value==-1?__( "All", "wppp" ) : $value ) ?>
37
  </option>
38
  <?php
39
  endforeach;
readme.txt CHANGED
@@ -1,9 +1,9 @@
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, woocommerce columns
4
  Requires at least: 3.0.1
5
  Tested up to: 3.8.1
6
- Stable tag: 1.0.1
7
  License: GPLv3 or later
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -13,11 +13,10 @@ WooCommerce Products Per Page is a easy-to-setup plugin that integrates a 'produ
13
  WooCommerce Products Per Page dropdown is easy to install and has several other product page configurations. When activated the plugin already works and has multiple settings you can set to your desire.
14
 
15
  Options like:
16
-
17
- * Dropdown position (top or bottom, top and bottom)
18
- * List op options products per page to show to your visitors
19
- * Default number of products per page
20
- * Columns per page
21
 
22
  **Look at the screenshots!**
23
 
@@ -37,6 +36,12 @@ Options like:
37
 
38
  == Changelog ==
39
 
 
 
 
 
 
 
40
  = 1.0.1 =
41
  * Small update for cookies
42
 
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.3
7
  License: GPLv3 or later
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
13
  WooCommerce Products Per Page dropdown is easy to install and has several other product page configurations. When activated the plugin already works and has multiple settings you can set to your desire.
14
 
15
  Options like:
16
+ - Dropdown position (top or bottom, top and bottom)
17
+ - List op options products per page to show to your visitors
18
+ - Default number of products per page
19
+ - Columns per page
 
20
 
21
  **Look at the screenshots!**
22
 
36
 
37
  == Changelog ==
38
 
39
+ = 1.0.2 =
40
+ * - Added Dutch translation*
41
+ * - Added 'None' to the dropdown locations*
42
+ * - Now uses WC sessions instead of cookies*
43
+ * - Gave higher priority to hook "loop_shop_per_page"*
44
+
45
  = 1.0.1 =
46
  * Small update for cookies
47
 
views/options-page.php CHANGED
@@ -32,7 +32,7 @@ class wppp_options extends woocommerce_products_per_page {
32
  // 3. Add settings section
33
  add_settings_section(
34
  "wppp_settings", // ID of section
35
- __( "WooCommerce Products Per Page", "wppp" ), // Page title
36
  array( $this, "wppp_section_callback" ), // Callback for page description
37
  "wppp_settings" // Page to display settings
38
  );
@@ -103,6 +103,7 @@ class wppp_options extends woocommerce_products_per_page {
103
  <option value="top" <?php selected( $this->options["location"], "top" ); ?>><?php _e( "Top", "wppp" ); ?></option>
104
  <option value="bottom" <?php selected( $this->options["location"], "bottom" ); ?>><?php _e( "Bottom", "wppp" ); ?></option>
105
  <option value="topbottom" <?php selected( $this->options["location"], "topbottom" ); ?>><?php _e( "Top/Bottom", "wppp" ); ?></option>
 
106
  </select>
107
  <?php
108
 
@@ -114,7 +115,7 @@ class wppp_options extends woocommerce_products_per_page {
114
  ?>
115
  <label for="productsPerPage">
116
  <input type="text" id="productsPerPage" name="wppp_settings[productsPerPage]" value="<?php echo $this->options["productsPerPage"]; ?>">
117
- <?php _e( "Seperated by spaces <em>(-1 for all products</em>)", "wppp" ); ?></label>
118
  <?php
119
 
120
  }
@@ -144,7 +145,7 @@ class wppp_options extends woocommerce_products_per_page {
144
 
145
  public function wppp_section_callback() {
146
 
147
- echo __( "Configure the Wordpress Product Per Page settings here.", "wppp" );
148
 
149
  }
150
 
32
  // 3. Add settings section
33
  add_settings_section(
34
  "wppp_settings", // ID of section
35
+ "WooCommerce Products Per Page", // Page title
36
  array( $this, "wppp_section_callback" ), // Callback for page description
37
  "wppp_settings" // Page to display settings
38
  );
103
  <option value="top" <?php selected( $this->options["location"], "top" ); ?>><?php _e( "Top", "wppp" ); ?></option>
104
  <option value="bottom" <?php selected( $this->options["location"], "bottom" ); ?>><?php _e( "Bottom", "wppp" ); ?></option>
105
  <option value="topbottom" <?php selected( $this->options["location"], "topbottom" ); ?>><?php _e( "Top/Bottom", "wppp" ); ?></option>
106
+ <option value="none" <?php selected( $this->options["location"], "none" ); ?>><?php _e( "None", "wppp" ); ?></option>
107
  </select>
108
  <?php
109
 
115
  ?>
116
  <label for="productsPerPage">
117
  <input type="text" id="productsPerPage" name="wppp_settings[productsPerPage]" value="<?php echo $this->options["productsPerPage"]; ?>">
118
+ <?php _e( "Seperated by spaces <em>(-1 for all products)</em>", "wppp" ); ?></label>
119
  <?php
120
 
121
  }
145
 
146
  public function wppp_section_callback() {
147
 
148
+ echo __( "Configure the WooCommerce Product Per Page settings here.", "wppp" );
149
 
150
  }
151
 
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.1
7
  Author: Jeroen Sormani
8
  Author URI: http://www.jeroensormani.nl
9
 
@@ -46,11 +46,13 @@ class woocommerce_products_per_page {
46
  add_action( "init", array( $this, "wppp_submit_intercept" ) );
47
 
48
  // Add filter to products per page displayed
49
- add_filter( "loop_shop_per_page", array( $this, "wppp_products_per_page_hook" ) );
50
  // Add filter for product columns
51
  add_filter( "loop_shop_columns", array( $this, "wppp_shop_columns_hook" ) );
52
  // Enqueue some scripts
53
  add_action( "wp_enqueue_scripts", array( $this, "wppp_enqueue_scripts" ) );
 
 
54
 
55
  }
56
 
@@ -64,7 +66,7 @@ class woocommerce_products_per_page {
64
  add_action( "woocommerce_before_shop_loop", array( $this, "wppp_dropdown_object" ) );
65
  elseif( $this->options["location"] == "bottom" ) :
66
  add_action( "woocommerce_after_shop_loop", array( $this, "wppp_dropdown_object" ) );
67
- else :
68
  add_action( "woocommerce_before_shop_loop", array( $this, "wppp_dropdown_object" ) );
69
  add_action( "woocommerce_after_shop_loop", array( $this, "wppp_dropdown_object" ) );
70
  endif;
@@ -78,18 +80,24 @@ class woocommerce_products_per_page {
78
  */
79
  public function wppp_submit_intercept() {
80
 
81
- if ( isset( $_POST["wppp_ppp"] ) )
82
- setcookie( "products_per_page", $_POST["wppp_ppp"], time()+(3600*24*3), "/" );
 
 
 
 
83
 
84
  }
85
 
86
 
87
  public function wppp_products_per_page_hook() {
 
 
88
 
89
  if( isset( $_POST["wppp_ppp"] ) )
90
  return $_POST["wppp_ppp"];
91
- elseif( isset( $_COOKIE["products_per_page"] ) )
92
- return $_COOKIE["products_per_page"];
93
  else
94
  return $this->options["default_ppp"];
95
 
@@ -131,7 +139,7 @@ class woocommerce_products_per_page {
131
  */
132
  public function wppp_options_page() {
133
 
134
- require_once "views/options-page.php";
135
  new wppp_options();
136
 
137
  }
@@ -143,7 +151,7 @@ class woocommerce_products_per_page {
143
  */
144
  public function wppp_dropdown_object() {
145
 
146
- require_once "objects/wppp-dropdown.php";
147
  new wppp_dropdown();
148
 
149
  }
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.3
7
  Author: Jeroen Sormani
8
  Author URI: http://www.jeroensormani.nl
9
 
46
  add_action( "init", array( $this, "wppp_submit_intercept" ) );
47
 
48
  // Add filter to products per page displayed
49
+ add_filter( "loop_shop_per_page", array( $this, "wppp_products_per_page_hook" ), 90 );
50
  // Add filter for product columns
51
  add_filter( "loop_shop_columns", array( $this, "wppp_shop_columns_hook" ) );
52
  // Enqueue some scripts
53
  add_action( "wp_enqueue_scripts", array( $this, "wppp_enqueue_scripts" ) );
54
+ // Load textdomain
55
+ load_plugin_textdomain( "wppp", false, basename( dirname( __FILE__ ) ) . '/languages' );
56
 
57
  }
58
 
66
  add_action( "woocommerce_before_shop_loop", array( $this, "wppp_dropdown_object" ) );
67
  elseif( $this->options["location"] == "bottom" ) :
68
  add_action( "woocommerce_after_shop_loop", array( $this, "wppp_dropdown_object" ) );
69
+ elseif( $this->options["location"] == "topbottom" ):
70
  add_action( "woocommerce_before_shop_loop", array( $this, "wppp_dropdown_object" ) );
71
  add_action( "woocommerce_after_shop_loop", array( $this, "wppp_dropdown_object" ) );
72
  endif;
80
  */
81
  public function wppp_submit_intercept() {
82
 
83
+ global $woocommerce;
84
+
85
+ if ( isset( $_POST["wppp_ppp"] ) ) {
86
+ $woocommerce->session->set( "products_per_page", $_POST["wppp_ppp"] );
87
+ $woocommerce->session->set_customer_session_cookie( true );
88
+ }
89
 
90
  }
91
 
92
 
93
  public function wppp_products_per_page_hook() {
94
+
95
+ global $woocommerce;
96
 
97
  if( isset( $_POST["wppp_ppp"] ) )
98
  return $_POST["wppp_ppp"];
99
+ elseif( $woocommerce->session->__isset( "products_per_page" ) )
100
+ return $woocommerce->session->__get( "products_per_page" );
101
  else
102
  return $this->options["default_ppp"];
103
 
139
  */
140
  public function wppp_options_page() {
141
 
142
+ require_once plugin_dir_path( __FILE__ ) . "views/options-page.php";
143
  new wppp_options();
144
 
145
  }
151
  */
152
  public function wppp_dropdown_object() {
153
 
154
+ require_once plugin_dir_path( __FILE__ ) . "objects/wppp-dropdown.php";
155
  new wppp_dropdown();
156
 
157
  }