Booster for WooCommerce - Version 1.1.2

Version Description

  • 08/08/2014 =
  • Dev - PDF Invoices - Icons at orders list changed.
  • Feature Upgraded - Payment Gateways - Icons for default WooCommerce gateways (COD - Cash on Delivery, Cheque, BACS, Mijireh Checkout, PayPal). Accessible also via WooCommerce > Settings > Checkout Options.
  • Feature Upgraded - Payment Gateways - Custom Payment Gateway upgraded: Shipping methods, Virtual product, Min cart total option, Icon option.
  • Dev - Feature "Custom Payment Gateway" renamed to "Payment Gateways"
  • Dev - Move needed functions from Plus to standard version.
Download this release

Release Info

Developer algoritmika
Plugin Icon 128x128 Booster for WooCommerce
Version 1.1.2
Comparing to
See all releases

Code changes from version 1.1.1 to 1.1.2

includes/admin/settings/class-wc-settings-jetpack.php CHANGED
@@ -116,6 +116,7 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
116
  $single_item['desc'] = str_replace( ' feature', '</strong> feature', $single_item['desc'] );
117
 
118
  $single_item['desc'] .= ': <em>' . $single_item['desc_tip'] . '</em>';
 
119
  $single_item['desc_tip'] = '';
120
  }
121
 
116
  $single_item['desc'] = str_replace( ' feature', '</strong> feature', $single_item['desc'] );
117
 
118
  $single_item['desc'] .= ': <em>' . $single_item['desc_tip'] . '</em>';
119
+ //$single_item['desc'] .= ': <em>' . $single_item['desc_tip'] . __( ' Default: ', 'woocommerce-jetpack' ) . $single_item['default'] . '</em>';
120
  $single_item['desc_tip'] = '';
121
  }
122
 
includes/class-wc-gateway-wcj-custom.php CHANGED
@@ -2,9 +2,9 @@
2
  /**
3
  * class WC_Gateway_WCJ_Custom
4
  */
5
- add_action( 'plugins_loaded', 'init_wcj_custom_gateway_class' );
6
 
7
- function init_wcj_custom_gateway_class() {
8
 
9
  class WC_Gateway_WCJ_Custom extends WC_Payment_Gateway {
10
 
@@ -13,10 +13,10 @@ function init_wcj_custom_gateway_class() {
13
  */
14
  public function __construct() {
15
 
16
- $this->id = 'jetpack_custom';
17
  //$this->icon = ''; //If you want to show an image next to the gateway�s name on the frontend, enter a URL to an image.
18
  $this->has_fields = false;
19
- $this->method_title = __( 'Custom', 'woocommerce-jetpack' );
20
  $this->method_description = __( 'WooCommerce Jetpack: Custom Payment Gateway', 'woocommerce-jetpack' );
21
 
22
  // Load the settings.
@@ -24,9 +24,13 @@ function init_wcj_custom_gateway_class() {
24
  $this->init_settings();
25
 
26
  // Define user set variables
27
- $this->title = $this->get_option( 'title' );
28
- $this->description = $this->get_option( 'description' );
29
- $this->instructions = $this->get_option( 'instructions', $this->description );
 
 
 
 
30
 
31
  // Actions
32
  add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
@@ -34,12 +38,38 @@ function init_wcj_custom_gateway_class() {
34
 
35
  // Customer Emails
36
  add_action( 'woocommerce_email_before_order_table', array( $this, 'email_instructions' ), 10, 3 );
 
 
 
37
  }
38
 
 
 
 
 
 
 
 
 
 
 
39
  /**
40
  * Initialise Gateway Settings Form Fields
41
  */
42
- public function init_form_fields() {
 
 
 
 
 
 
 
 
 
 
 
 
 
43
 
44
  $this->form_fields = array(
45
  'enabled' => array(
@@ -69,9 +99,137 @@ function init_wcj_custom_gateway_class() {
69
  'default' => '',
70
  'desc_tip' => true,
71
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  );
73
  }
74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
 
76
  /**
77
  * Output for the order received page.
@@ -124,10 +282,10 @@ function init_wcj_custom_gateway_class() {
124
 
125
 
126
 
127
- function add_wcj_custom_gateway_class( $methods ) {
128
 
129
  $methods[] = 'WC_Gateway_WCJ_Custom';
130
  return $methods;
131
  }
132
- add_filter( 'woocommerce_payment_gateways', 'add_wcj_custom_gateway_class' );
133
  }
2
  /**
3
  * class WC_Gateway_WCJ_Custom
4
  */
5
+ add_action( 'plugins_loaded', 'init_wc_gateway_wcj_custom_class' );
6
 
7
+ function init_wc_gateway_wcj_custom_class() {
8
 
9
  class WC_Gateway_WCJ_Custom extends WC_Payment_Gateway {
10
 
13
  */
14
  public function __construct() {
15
 
16
+ $this->id = 'jetpack_custom_gateway';
17
  //$this->icon = ''; //If you want to show an image next to the gateway�s name on the frontend, enter a URL to an image.
18
  $this->has_fields = false;
19
+ $this->method_title = __( 'Custom Gateway', 'woocommerce-jetpack' );
20
  $this->method_description = __( 'WooCommerce Jetpack: Custom Payment Gateway', 'woocommerce-jetpack' );
21
 
22
  // Load the settings.
24
  $this->init_settings();
25
 
26
  // Define user set variables
27
+ $this->title = $this->get_option( 'title' );
28
+ $this->description = $this->get_option( 'description' );
29
+ $this->instructions = $this->get_option( 'instructions', $this->description );
30
+ $this->icon = $this->get_option( 'icon', '' );//apply_filters( 'woocommerce_wcj_custom_icon', $this->get_option( 'icon', '' ) );
31
+ $this->min_amount = $this->get_option( 'min_amount', 0 );
32
+ $this->enable_for_methods = $this->get_option( 'enable_for_methods', array() );
33
+ $this->enable_for_virtual = $this->get_option( 'enable_for_virtual', 'yes' ) === 'yes' ? true : false;
34
 
35
  // Actions
36
  add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
38
 
39
  // Customer Emails
40
  add_action( 'woocommerce_email_before_order_table', array( $this, 'email_instructions' ), 10, 3 );
41
+
42
+
43
+ //add_filter( 'woocommerce_wcj_custom_icon', array( $this, 'set_icon' ) );
44
  }
45
 
46
+ /**
47
+ * set_icon
48
+ *
49
+ public function set_icon() {
50
+ $icon_url = get_option( 'wcj_payment_gateways_icons_woocommerce_wcj_custom_icon', '' );
51
+ if ( $icon_url === '' )
52
+ return $this->get_option( 'icon', '' );
53
+ return $icon_url;
54
+ }
55
+
56
  /**
57
  * Initialise Gateway Settings Form Fields
58
  */
59
+ public function init_form_fields() {
60
+ global $woocommerce;
61
+
62
+ $shipping_methods = array();
63
+
64
+ if ( is_admin() )
65
+ foreach ( WC()->shipping->load_shipping_methods() as $method ) {
66
+ $shipping_methods[ $method->id ] = $method->get_title();
67
+ }
68
+
69
+ $desc = '';
70
+ $icon_url = $this->get_option( 'icon', '' );//apply_filters( 'woocommerce_wcj_custom_icon', $this->get_option( 'icon', '' ) );
71
+ if ( $icon_url !== '' )
72
+ $desc = '<img src="' . $icon_url . '" alt="WooJetpack Custom" title="WooJetpack Custom" />';
73
 
74
  $this->form_fields = array(
75
  'enabled' => array(
99
  'default' => '',
100
  'desc_tip' => true,
101
  ),
102
+ 'icon' => array(
103
+ 'title' => __( 'Icon', 'woocommerce-jetpack' ),
104
+ 'type' => 'text',
105
+ 'desc_tip' => __( 'If you want to show an image next to the gateway\'s name on the frontend, enter a URL to an image.', 'woocommerce-jetpack' ),
106
+ 'default' => '',
107
+ 'description' => $desc,
108
+ 'css' => 'min-width:300px;width:50%;',
109
+ ),
110
+ 'min_amount' => array(
111
+ 'title' => __( 'Minimum order amount', 'woocommerce-jetpack' ),
112
+ 'type' => 'number',
113
+ 'desc_tip' => __( 'If you want to set minimum order amount to show this gateway on frontend, enter a number here. Set to 0 to disable.', 'woocommerce-jetpack' ),
114
+ 'default' => 0,
115
+ 'description' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
116
+ 'custom_attributes'
117
+ => apply_filters( 'get_wc_jetpack_plus_message', '', 'disabled' ),
118
+ ),
119
+ 'enable_for_methods' => array(
120
+ 'title' => __( 'Enable for shipping methods', 'woocommerce' ),
121
+ 'type' => 'multiselect',
122
+ 'class' => 'chosen_select',
123
+ 'css' => 'width: 450px;',
124
+ 'default' => '',
125
+ 'description' => __( 'If gateway is only available for certain shipping methods, set it up here. Leave blank to enable for all methods.', 'woocommerce-jetpack' ),
126
+ 'options' => $shipping_methods,
127
+ 'desc_tip' => true,
128
+ 'custom_attributes' => array(
129
+ 'data-placeholder' => __( 'Select shipping methods', 'woocommerce' )
130
+ )
131
+ ),
132
+ 'enable_for_virtual' => array(
133
+ 'title' => __( 'Enable for virtual orders', 'woocommerce' ),
134
+ 'label' => __( 'Enable gateway if the order is virtual', 'woocommerce-jetpack' ),
135
+ 'type' => 'checkbox',
136
+ 'default' => 'yes'
137
+ ),
138
  );
139
  }
140
 
141
+ /**
142
+ * Check If The Gateway Is Available For Use
143
+ *
144
+ * @return bool
145
+ */
146
+ public function is_available() {
147
+ // Check min amount
148
+ $min_amount = apply_filters( 'wcj_get_option_filter', 0, $this->min_amount );
149
+ if ( $min_amount > 0 ) {
150
+ if ( WC()->cart->total < $min_amount )
151
+ return false;
152
+ }
153
+
154
+ // Check shipping methods and is virtual
155
+ $order = null;
156
+
157
+ if ( ! $this->enable_for_virtual ) {
158
+ if ( WC()->cart && ! WC()->cart->needs_shipping() ) {
159
+ return false;
160
+ }
161
+
162
+ if ( is_page( wc_get_page_id( 'checkout' ) ) && 0 < get_query_var( 'order-pay' ) ) {
163
+ $order_id = absint( get_query_var( 'order-pay' ) );
164
+ $order = new WC_Order( $order_id );
165
+
166
+ // Test if order needs shipping.
167
+ $needs_shipping = false;
168
+
169
+ if ( 0 < sizeof( $order->get_items() ) ) {
170
+ foreach ( $order->get_items() as $item ) {
171
+ $_product = $order->get_product_from_item( $item );
172
+
173
+ if ( $_product->needs_shipping() ) {
174
+ $needs_shipping = true;
175
+ break;
176
+ }
177
+ }
178
+ }
179
+
180
+ $needs_shipping = apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping );
181
+
182
+ if ( $needs_shipping ) {
183
+ return false;
184
+ }
185
+ }
186
+ }
187
+
188
+ if ( ! empty( $this->enable_for_methods ) ) {
189
+
190
+ // Only apply if all packages are being shipped via ...
191
+ $chosen_shipping_methods_session = WC()->session->get( 'chosen_shipping_methods' );
192
+
193
+ if ( isset( $chosen_shipping_methods_session ) ) {
194
+ $chosen_shipping_methods = array_unique( $chosen_shipping_methods_session );
195
+ } else {
196
+ $chosen_shipping_methods = array();
197
+ }
198
+
199
+ $check_method = false;
200
+
201
+ if ( is_object( $order ) ) {
202
+ if ( $order->shipping_method ) {
203
+ $check_method = $order->shipping_method;
204
+ }
205
+
206
+ } elseif ( empty( $chosen_shipping_methods ) || sizeof( $chosen_shipping_methods ) > 1 ) {
207
+ $check_method = false;
208
+ } elseif ( sizeof( $chosen_shipping_methods ) == 1 ) {
209
+ $check_method = $chosen_shipping_methods[0];
210
+ }
211
+
212
+ if ( ! $check_method ) {
213
+ return false;
214
+ }
215
+
216
+ $found = false;
217
+
218
+ foreach ( $this->enable_for_methods as $method_id ) {
219
+ if ( strpos( $check_method, $method_id ) === 0 ) {
220
+ $found = true;
221
+ break;
222
+ }
223
+ }
224
+
225
+ if ( ! $found ) {
226
+ return false;
227
+ }
228
+ }
229
+
230
+ return parent::is_available();
231
+ }
232
+
233
 
234
  /**
235
  * Output for the order received page.
282
 
283
 
284
 
285
+ function add_wc_gateway_wcj_custom_class( $methods ) {
286
 
287
  $methods[] = 'WC_Gateway_WCJ_Custom';
288
  return $methods;
289
  }
290
+ add_filter( 'woocommerce_payment_gateways', 'add_wc_gateway_wcj_custom_class' );
291
  }
includes/class-wc-shipping-wcj-custom.php ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * class WC_Shipping_WCJ_Custom
4
+ */
5
+ add_action( 'woocommerce_shipping_init', 'init_wc_shipping_wcj_custom_class' );
6
+
7
+ function init_wc_shipping_wcj_custom_class() {
8
+ if ( ! class_exists( 'WC_Shipping_WCJ_Custom' ) ) {
9
+ class WC_Shipping_WCJ_Custom extends WC_Shipping_Method {
10
+ /**
11
+ * Constructor for your shipping class
12
+ *
13
+ * @access public
14
+ * @return void
15
+ */
16
+ public function __construct() {
17
+ $this->id = 'jetpack_custom_shipping';
18
+ //$this->title = __( 'Custom', 'woocommerce-jetpack' );
19
+ $this->method_title = __( 'Custom Shipping', 'woocommerce-jetpack' );
20
+ $this->method_description = __( 'WooCommerce Jetpack: Custom Shipping Method', 'woocommerce-jetpack' );
21
+ //$this->enabled = "yes"; // This can be added as an setting but for this example its forced enabled
22
+ $this->init();
23
+
24
+ $this->enabled = $this->settings['enabled'];//$this->get_option( 'enabled' );
25
+ $this->title = $this->settings['title'];//$this->get_option( 'title' );
26
+
27
+ // Define user set variables
28
+ //$this->title = $this->get_option( 'title' );
29
+ ////$this->description = $this->get_option( 'description' );
30
+ ////$this->instructions = $this->get_option( 'instructions', $this->description );
31
+ ////$this->icon = $this->get_option( 'icon', '' );//apply_filters( 'woocommerce_wcj_custom_icon', $this->get_option( 'icon', '' ) );
32
+ }
33
+
34
+ /**
35
+ * Init your settings
36
+ *
37
+ * @access public
38
+ * @return void
39
+ */
40
+ function init() {
41
+ // Load the settings API
42
+ $this->init_form_fields(); // This is part of the settings API. Override the method to add your own settings
43
+ $this->init_settings(); // This is part of the settings API. Loads settings you previously init.
44
+
45
+ // Save settings in admin if you have any defined
46
+ add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) );
47
+ }
48
+
49
+ /**
50
+ * Initialise Settings Form Fields
51
+ */
52
+ public function init_form_fields() {
53
+
54
+ $this->form_fields = array(
55
+ 'enabled' => array(
56
+ 'title' => __( 'Enable/Disable', 'woocommerce' ),
57
+ 'type' => 'checkbox',
58
+ 'label' => __( 'Enable Custom Shipping', 'woocommerce-jetpack' ),
59
+ 'default' => 'no'
60
+ ),
61
+ 'title' => array(
62
+ 'title' => __( 'Title', 'woocommerce' ),
63
+ 'type' => 'text',
64
+ 'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce' ),
65
+ 'default' => __( 'Custom Shipping', 'woocommerce-jetpack' ),
66
+ 'desc_tip' => true,
67
+ ),
68
+ );
69
+ }
70
+
71
+ /**
72
+ * calculate_shipping function.
73
+ *
74
+ * @access public
75
+ * @param mixed $package
76
+ * @return void
77
+ */
78
+ public function calculate_shipping( $package ) {
79
+ $rate = array(
80
+ 'id' => $this->id,
81
+ 'label' => $this->title,
82
+ 'cost' => '4.99',
83
+ 'calc_tax' => 'per_order'
84
+ );
85
+
86
+ // Register the rate
87
+ $this->add_rate( $rate );
88
+ }
89
+ }
90
+ }
91
+ }
92
+
93
+ function add_wc_shipping_wcj_custom_class( $methods ) {
94
+ $methods[] = 'WC_Shipping_WCJ_Custom';
95
+ return $methods;
96
+ }
97
+
98
+ add_filter( 'woocommerce_shipping_methods', 'add_wc_shipping_wcj_custom_class' );
includes/class-wcj-payment-gateways.php ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WooCommerce Jetpack Payment Gateways
4
+ *
5
+ * The WooCommerce Jetpack Payment Gateways class.
6
+ *
7
+ * @class WCJ_Payment_Gateways
8
+ */
9
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
10
+
11
+ if ( ! class_exists( 'WCJ_Payment_Gateways' ) ) :
12
+
13
+ class WCJ_Payment_Gateways {
14
+
15
+ public $woocommerce_icon_filters;
16
+
17
+ /**
18
+ * Constructor.
19
+ */
20
+ public function __construct() {
21
+ if ( get_option( 'wcj_payment_gateways_enabled' ) == 'yes' ) {
22
+ // Include custom payment gateway
23
+ include_once( 'class-wc-gateway-wcj-custom.php' );
24
+
25
+ // Main hooks
26
+ // Icons for default WooCommerce methods hooks
27
+ $this->woocommerce_icon_filters = array (
28
+ 'woocommerce_cod_icon' => __( 'COD', 'woocommerce-jetpack' ),
29
+ 'woocommerce_cheque_icon' => __( 'Cheque', 'woocommerce-jetpack' ),
30
+ 'woocommerce_bacs_icon' => __( 'BACS', 'woocommerce-jetpack' ),
31
+ 'woocommerce_mijireh_checkout_icon' => __( 'Mijireh Checkout', 'woocommerce-jetpack' ),
32
+ 'woocommerce_paypal_icon' => __( 'PayPal', 'woocommerce-jetpack' ),
33
+ //'woocommerce_wcj_custom_icon' => __( 'WooJetpack Custom', 'woocommerce-jetpack' ),
34
+ );
35
+ foreach ( $this->woocommerce_icon_filters as $filter_name => $filter_title )
36
+ add_filter( $filter_name, array( $this, 'set_icon' ) );
37
+
38
+ // Settings
39
+ add_filter( 'woocommerce_payment_gateways_settings', array( $this, 'add_woocommerce_icons_options' ), 100 );
40
+ }
41
+
42
+ // Settings hooks
43
+ add_filter( 'wcj_settings_sections', array( $this, 'settings_section' ) );
44
+ add_filter( 'wcj_settings_payment_gateways', array( $this, 'get_settings' ), 100 );
45
+ add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
46
+ }
47
+
48
+ /**
49
+ * add_enabled_option.
50
+ */
51
+ function add_woocommerce_icons_options( $settings ) {
52
+
53
+ $settings[] = array( 'title' => __( 'WooCommerce Jetpack: Default WooCommerce Payment Gateways Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( 'If you want to show an image next to the gateway\'s name on the frontend, enter a URL to an image.', 'woocommerce-jetpack' ), 'id' => 'wcj_payment_gateways_icons_options' );
54
+
55
+ foreach ( $this->woocommerce_icon_filters as $filter_name => $filter_title ) {
56
+ // Prepare current value
57
+ $desc = '';
58
+ $icon_url = apply_filters( $filter_name, '' );
59
+ if ( $icon_url !== '' )
60
+ $desc = '<img src="' . $icon_url . '" alt="' . $filter_title . '" title="' . $filter_title . '" />';
61
+ //$desc = __( 'Current Icon: ', 'woocommerce-jetpack' ) . '<img src="' . $icon_url . '" alt="' . $filter_title . '" title="' . $filter_title . '" />';
62
+
63
+ $settings[] = array(
64
+ 'title' => $filter_title,
65
+ //'title' => sprintf( __( 'Icon for %s payment gateway', 'woocommerce-jetpack' ), $filter_title ),
66
+ 'desc' => $desc,
67
+ //'desc_tip' => $filter_name,
68
+ 'id' => 'wcj_payment_gateways_icons_' . $filter_name,
69
+ 'default' => '',
70
+ 'type' => 'text',
71
+ 'css' => 'min-width:300px;width:50%;',
72
+ );
73
+ }
74
+
75
+ $settings[] = array( 'type' => 'sectionend', 'id' => 'wcj_payment_gateways_icons_options' );
76
+
77
+ return $settings;
78
+ }
79
+
80
+ /**
81
+ * add_enabled_option.
82
+ */
83
+ public function add_enabled_option( $settings ) {
84
+
85
+ $all_settings = $this->get_settings();
86
+ $settings[] = $all_settings[1];
87
+
88
+ return $settings;
89
+ }
90
+
91
+ /**
92
+ * set_icon
93
+ */
94
+ public function set_icon( $value ) {
95
+ $icon_url = get_option( 'wcj_payment_gateways_icons_' . current_filter(), '' );
96
+ if ( $icon_url === '' )
97
+ return $value;
98
+ return $icon_url;
99
+ }
100
+
101
+ /**
102
+ * get_settings.
103
+ */
104
+ function get_settings() {
105
+
106
+ $settings = array(
107
+
108
+ array( 'title' => __( 'Payment Gateways Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( '', 'woocommerce-jetpack' ), 'id' => 'wcj_payment_gateways_options' ),
109
+
110
+ array(
111
+ 'title' => __( 'Payment Gateways', 'woocommerce-jetpack' ),
112
+ 'desc' => __( 'Enable the Payment Gateways feature', 'woocommerce-jetpack' ),
113
+ 'desc_tip' => __( 'Add custom payment gateway, change icons (images) for all default WooCommerce payment gateways.', 'woocommerce-jetpack' ),
114
+ 'id' => 'wcj_payment_gateways_enabled',
115
+ 'default' => 'yes',
116
+ 'type' => 'checkbox',
117
+ ),
118
+
119
+ array( 'type' => 'sectionend', 'id' => 'wcj_payment_gateways_options' ),
120
+ );
121
+
122
+ $settings[] = array( 'title' => __( 'Default WooCommerce Payment Gateways Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( 'If you want to show an image next to the gateway\'s name on the frontend, enter a URL to an image.', 'woocommerce-jetpack' ), 'id' => 'wcj_payment_gateways_icons_options' );
123
+
124
+ foreach ( $this->woocommerce_icon_filters as $filter_name => $filter_title ) {
125
+ // Prepare current value
126
+ $desc = '';
127
+ $icon_url = apply_filters( $filter_name, '' );
128
+ if ( $icon_url !== '' )
129
+ $desc = '<img src="' . $icon_url . '" alt="' . $filter_title . '" title="' . $filter_title . '" />';
130
+ //$desc = __( 'Current Icon: ', 'woocommerce-jetpack' ) . '<img src="' . $icon_url . '" alt="' . $filter_title . '" title="' . $filter_title . '" />';
131
+
132
+ $settings[] = array(
133
+ 'title' => $filter_title,
134
+ //'title' => sprintf( __( 'Icon for %s payment gateway', 'woocommerce-jetpack' ), $filter_title ),
135
+ 'desc' => $desc,
136
+ //'desc_tip' => $filter_name,
137
+ 'id' => 'wcj_payment_gateways_icons_' . $filter_name,
138
+ 'default' => '',
139
+ 'type' => 'text',
140
+ 'css' => 'min-width:300px;width:50%;',
141
+ );
142
+ }
143
+
144
+ $settings[] = array( 'type' => 'sectionend', 'id' => 'wcj_payment_gateways_icons_options' );
145
+
146
+ return $settings;
147
+ }
148
+
149
+ /**
150
+ * settings_section.
151
+ */
152
+ function settings_section( $sections ) {
153
+
154
+ $sections['payment_gateways'] = __( 'Payment Gateways', 'woocommerce-jetpack' );
155
+
156
+ return $sections;
157
+ }
158
+ }
159
+
160
+ endif;
161
+
162
+ return new WCJ_Payment_Gateways();
includes/class-wcj-pdf-invoices.php CHANGED
@@ -26,6 +26,10 @@ class WCJ_PDF_Invoices {
26
  //wp_ajax_
27
 
28
  add_action( 'admin_head', array( $this, 'add_custom_css' ) );
 
 
 
 
29
  }
30
 
31
  //$this->generate_pdf();
@@ -36,13 +40,26 @@ class WCJ_PDF_Invoices {
36
  add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
37
  }
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  /**
40
  * add_custom_css.
41
  */
42
  function add_custom_css() {
43
 
44
- echo '<style> a.button.tips.view.pdf_invoice:after { content: "\e011" !important; } </style>';
45
- echo '<style> a.button.tips.view.save_pdf_invoice:after { content: "\e011" !important; } </style>';
46
  }
47
 
48
  /**
@@ -408,7 +425,7 @@ class WCJ_PDF_Invoices {
408
  */
409
  function settings_section( $sections ) {
410
 
411
- $sections['pdf_invoices'] = 'PDF Invoices';
412
 
413
  return $sections;
414
  }
26
  //wp_ajax_
27
 
28
  add_action( 'admin_head', array( $this, 'add_custom_css' ) );
29
+
30
+ if ( get_option( 'wcj_pdf_invoices_enabled_for_customers' ) == 'yes' )
31
+ add_filter( 'woocommerce_my_account_my_orders_actions', array( $this, 'add_pdf_invoices_link_to_my_account' ), 100, 2 );
32
+ //add_filter( apply_filters( 'wcj_get_option_filter', 'wcj_empty_filter', 'woocommerce_my_account_my_orders_actions' ), array( $this, 'add_pdf_invoices_link_to_my_account' ), 100, 2 );
33
  }
34
 
35
  //$this->generate_pdf();
40
  add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
41
  }
42
 
43
+ /**
44
+ * Unlocks - PDF Invoices - add_pdf_invoices_link_to_my_account.
45
+ */
46
+ public function add_pdf_invoices_link_to_my_account( $actions, $the_order ) {
47
+
48
+ $actions['pdf_invoice'] = array(
49
+ 'url' => $_SERVER['REQUEST_URI'] . '?pdf_invoice=' . $the_order->id,
50
+ 'name' => __( 'Invoice', 'woocommerce-jetpack' ),
51
+ );
52
+
53
+ return $actions;
54
+ }
55
+
56
  /**
57
  * add_custom_css.
58
  */
59
  function add_custom_css() {
60
 
61
+ echo '<style> a.button.tips.view.pdf_invoice:after { content: "\e028" !important; } </style>';
62
+ echo '<style> a.button.tips.view.save_pdf_invoice:after { content: "\e028" !important; } </style>';
63
  }
64
 
65
  /**
425
  */
426
  function settings_section( $sections ) {
427
 
428
+ $sections['pdf_invoices'] = __( 'PDF Invoices', 'woocommerce-jetpack' );
429
 
430
  return $sections;
431
  }
includes/class-wcj-shipping.php CHANGED
@@ -17,9 +17,13 @@ class WCJ_Shipping {
17
  */
18
  public function __construct() {
19
 
20
- // Main hooks
21
  if ( get_option( 'wcj_shipping_enabled' ) == 'yes' ) {
 
 
 
22
 
 
23
  //add_filter( 'woocommerce_available_shipping_methods', array( $this, 'hide_all_shipping_when_free_is_available' ), 10, 1 );
24
  add_filter( 'woocommerce_package_rates', array( $this, 'hide_shipping_when_free_is_available' ), 10, 2 );
25
 
17
  */
18
  public function __construct() {
19
 
20
+
21
  if ( get_option( 'wcj_shipping_enabled' ) == 'yes' ) {
22
+ // Include custom shipping method
23
+ //include_once( 'class-wc-shipping-wcj-custom.php' );
24
+
25
 
26
+ // Main hooks
27
  //add_filter( 'woocommerce_available_shipping_methods', array( $this, 'hide_all_shipping_when_free_is_available' ), 10, 1 );
28
  add_filter( 'woocommerce_package_rates', array( $this, 'hide_shipping_when_free_is_available' ), 10, 2 );
29
 
includes/class-wcj-sorting.php CHANGED
@@ -29,14 +29,16 @@ class WCJ_Sorting {
29
  add_filter( 'woocommerce_get_catalog_ordering_args', array( $this, 'custom_woocommerce_get_catalog_ordering_args' ), 100 ); // Sorting
30
  add_filter( 'woocommerce_catalog_orderby', array( $this, 'custom_woocommerce_catalog_orderby' ), 100 ); // Front end
31
  add_filter( 'woocommerce_default_catalog_orderby_options', array( $this, 'custom_woocommerce_catalog_orderby' ), 100 ); // Back end (default sorting)
32
- //add_action( 'init', array( $this, 'custom_init' ), 100 ); // Remove sorting
 
 
 
 
33
  }
34
 
35
  // Settings hooks
36
  add_filter( 'wcj_settings_sections', array( $this, 'settings_section' ) ); // Add section to WooCommerce > Settings > Jetpack
37
  add_filter( 'wcj_settings_sorting', array( $this, 'get_settings' ), 100 ); // Add the settings
38
- if ( get_option( 'wcj_sorting_enabled' ) == 'yes' )
39
- add_filter( 'woocommerce_product_settings', array( $this, 'add_remove_sorting_checkbox' ), 100 ); // Add 'Remove All Sorting' checkbox to WooCommerce > Settings > Products
40
  add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 ); // Add Enable option to Jetpack Settings Dashboard
41
  }
42
 
@@ -51,6 +53,13 @@ class WCJ_Sorting {
51
  return $settings;
52
  }
53
 
 
 
 
 
 
 
 
54
  /*
55
  * Add Remove All Sorting checkbox to WooCommerce > Settings > Products.
56
  */
29
  add_filter( 'woocommerce_get_catalog_ordering_args', array( $this, 'custom_woocommerce_get_catalog_ordering_args' ), 100 ); // Sorting
30
  add_filter( 'woocommerce_catalog_orderby', array( $this, 'custom_woocommerce_catalog_orderby' ), 100 ); // Front end
31
  add_filter( 'woocommerce_default_catalog_orderby_options', array( $this, 'custom_woocommerce_catalog_orderby' ), 100 ); // Back end (default sorting)
32
+ if ( get_option( 'wcj_sorting_remove_all_enabled' ) )
33
+ add_action( apply_filters( 'wcj_get_option_filter', 'wcj_empty_action', 'init' ), array( $this, 'remove_sorting' ), 100 ); // Remove sorting
34
+
35
+ // Settings
36
+ add_filter( 'woocommerce_product_settings', array( $this, 'add_remove_sorting_checkbox' ), 100 ); // Add 'Remove All Sorting' checkbox to WooCommerce > Settings > Products
37
  }
38
 
39
  // Settings hooks
40
  add_filter( 'wcj_settings_sections', array( $this, 'settings_section' ) ); // Add section to WooCommerce > Settings > Jetpack
41
  add_filter( 'wcj_settings_sorting', array( $this, 'get_settings' ), 100 ); // Add the settings
 
 
42
  add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 ); // Add Enable option to Jetpack Settings Dashboard
43
  }
44
 
53
  return $settings;
54
  }
55
 
56
+ /**
57
+ * Unlocks - Sorting - remove_sorting.
58
+ */
59
+ public function remove_sorting() {
60
+ remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
61
+ }
62
+
63
  /*
64
  * Add Remove All Sorting checkbox to WooCommerce > Settings > Products.
65
  */
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === WooCommerce Jetpack ===
2
  Contributors: algoritmika
3
  Donate link: http://algoritmika.com/donate/
4
- Tags: woocommerce,woocommerce jetpack,custom price labels,call for price,currency symbol,remove sorting,remove old product slugs,add to cart text,order number,sequential order numbering,pdf invoice,pdf invoices,already in cart,empty cart,redirect to checkout,minimum order amount,customize checkout fields,checkout fields,email,customize product tabs,product tabs,related products number,empty cart,redirect add to cart,redirect to checkout,product already in cart,custom payment gateway
5
  Requires at least: 3.9.1
6
- Tested up to: 3.9.1
7
- Stable tag: 1.1.1
8
  License: GNU General Public License v3.0
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -16,7 +16,7 @@ WooCommerce Jetpack is a WordPress plugin that supercharges your site with aweso
16
 
17
  = Features =
18
 
19
- * Custom Payment Gateway - Add and customize simple custom offline payment gateway.
20
  * Orders - Set minimum order amount.
21
  * Checkout - Customize checkout fields: disable/enable fields, set required, change labels and/or placeholders.
22
  * Shipping - Hide shipping when free is available.
@@ -58,9 +58,16 @@ To unlock all WooCommerce Jetpack features, please install additional <a href="h
58
 
59
  == Changelog ==
60
 
 
 
 
 
 
 
 
61
  = 1.1.1 - 06/08/2014 =
62
- * Feature Upgraded - Custom Price Labels - more visibility options added: hide for main variable product price or for each variation.
63
- * Feature - Custom Payment Gateway (offline).
64
  * Dev - Move needed functions from Plus to standard version.
65
  * Fix - Custom Price Labels - Bug with main enable/disable checkbox, fixed.
66
  * Fix - Checkout - Bug with default values, fixed.
1
  === WooCommerce Jetpack ===
2
  Contributors: algoritmika
3
  Donate link: http://algoritmika.com/donate/
4
+ Tags: woocommerce,woocommerce jetpack,custom price labels,call for price,currency symbol,remove sorting,remove old product slugs,add to cart text,order number,sequential order numbering,pdf invoice,pdf invoices,already in cart,empty cart,redirect to checkout,minimum order amount,customize checkout fields,checkout fields,email,customize product tabs,product tabs,related products number,empty cart,redirect add to cart,redirect to checkout,product already in cart,custom payment gateway,payment gateway icon
5
  Requires at least: 3.9.1
6
+ Tested up to: 3.9.2
7
+ Stable tag: 1.1.2
8
  License: GNU General Public License v3.0
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
16
 
17
  = Features =
18
 
19
+ * Payment Gateways - Add and customize simple custom offline payment gateway. Change icons (images) for all default WooCommerce payment gateways.
20
  * Orders - Set minimum order amount.
21
  * Checkout - Customize checkout fields: disable/enable fields, set required, change labels and/or placeholders.
22
  * Shipping - Hide shipping when free is available.
58
 
59
  == Changelog ==
60
 
61
+ = 1.1.2 - 08/08/2014 =
62
+ * Dev - PDF Invoices - Icons at orders list changed.
63
+ * Feature Upgraded - Payment Gateways - Icons for default WooCommerce gateways (COD - Cash on Delivery, Cheque, BACS, Mijireh Checkout, PayPal). Accessible also via WooCommerce > Settings > Checkout Options.
64
+ * Feature Upgraded - Payment Gateways - Custom Payment Gateway upgraded: Shipping methods, Virtual product, Min cart total option, Icon option.
65
+ * Dev - Feature "Custom Payment Gateway" renamed to "Payment Gateways"
66
+ * Dev - Move needed functions from Plus to standard version.
67
+
68
  = 1.1.1 - 06/08/2014 =
69
+ * Feature Upgraded - Custom Price Labels - More visibility options added: hide for main variable product price or for each variation.
70
+ * Feature - Custom Payment Gateway - Simple custom offline payment gateway.
71
  * Dev - Move needed functions from Plus to standard version.
72
  * Fix - Custom Price Labels - Bug with main enable/disable checkbox, fixed.
73
  * Fix - Checkout - Bug with default values, fixed.
woocommerce-jetpack.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WooCommerce Jetpack
4
  Plugin URI: http://woojetpack.com
5
  Description: Supercharge your WooCommerce site with these awesome powerful features.
6
- Version: 1.1.1
7
  Author: Algoritmika Ltd
8
  Author URI: http://www.algoritmika.com
9
  Copyright: © 2014 Algoritmika Ltd.
@@ -152,13 +152,14 @@ final class WC_Jetpack {
152
  $settings[] = include_once( 'includes/class-wcj-cart.php' );
153
  $settings[] = include_once( 'includes/class-wcj-shipping.php' );
154
  $settings[] = include_once( 'includes/class-wcj-checkout.php' );
 
155
 
156
  $settings[] = include_once( 'includes/class-wcj-orders.php' );
157
  $settings[] = include_once( 'includes/class-wcj-emails.php' );
158
  $settings[] = include_once( 'includes/class-wcj-pdf-invoices.php' );
159
  $settings[] = include_once( 'includes/class-wcj-old-slugs.php' );
160
 
161
- include_once( 'includes/class-wc-gateway-wcj-custom.php' );
162
 
163
  // Add options
164
  if ( is_admin() ) {
3
  Plugin Name: WooCommerce Jetpack
4
  Plugin URI: http://woojetpack.com
5
  Description: Supercharge your WooCommerce site with these awesome powerful features.
6
+ Version: 1.1.2
7
  Author: Algoritmika Ltd
8
  Author URI: http://www.algoritmika.com
9
  Copyright: © 2014 Algoritmika Ltd.
152
  $settings[] = include_once( 'includes/class-wcj-cart.php' );
153
  $settings[] = include_once( 'includes/class-wcj-shipping.php' );
154
  $settings[] = include_once( 'includes/class-wcj-checkout.php' );
155
+ $settings[] = include_once( 'includes/class-wcj-payment-gateways.php' );
156
 
157
  $settings[] = include_once( 'includes/class-wcj-orders.php' );
158
  $settings[] = include_once( 'includes/class-wcj-emails.php' );
159
  $settings[] = include_once( 'includes/class-wcj-pdf-invoices.php' );
160
  $settings[] = include_once( 'includes/class-wcj-old-slugs.php' );
161
 
162
+ //include_once( 'includes/class-wc-gateway-wcj-custom.php' );
163
 
164
  // Add options
165
  if ( is_admin() ) {