Side Cart Woocommerce (Ajax) - Version 1.0.1

Version Description

Download this release

Release Info

Developer xootix
Plugin Icon wp plugin Side Cart Woocommerce (Ajax)
Version 1.0.1
Comparing to
See all releases

Code changes from version 1.0.0 to 1.0.1

README.txt CHANGED
@@ -1,10 +1,10 @@
1
- ===WooCommerce Side Cart===
2
  Contributors: XootiX
3
  Donate link: https://www.paypal.me/xootix
4
- Tags: woocommerce , cart , added to cart , cart pop up , added to cart
5
  Requires at least: 3.0.1
6
  Tested up to: 4.7
7
- Stable tag: 1.0.0
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
1
+ ===WooCommerce Cart===
2
  Contributors: XootiX
3
  Donate link: https://www.paypal.me/xootix
4
+ Tags: woocommerce , woocommerce cart , added to cart , cart pop up , added to cart
5
  Requires at least: 3.0.1
6
  Tested up to: 4.7
7
+ Stable tag: 1.0.1
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
admin/class-xoo-wsc-admin.php CHANGED
@@ -43,6 +43,7 @@ class xoo_wsc_Admin {
43
  $this->plugin_settings_tabs['general'] = 'General';
44
  $this->plugin_settings_tabs['style'] = 'Style';
45
  $this->plugin_settings_tabs['advanced'] = 'Advanced';
 
46
  }
47
 
48
  /**
43
  $this->plugin_settings_tabs['general'] = 'General';
44
  $this->plugin_settings_tabs['style'] = 'Style';
45
  $this->plugin_settings_tabs['advanced'] = 'Advanced';
46
+ $this->plugin_settings_tabs['premium'] = 'Premium';
47
  }
48
 
49
  /**
admin/css/xoo-wsc-admin.css CHANGED
@@ -73,4 +73,19 @@ table.form-table{
73
  margin-top: 20px;
74
  margin-left: 0;
75
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  }
73
  margin-top: 20px;
74
  margin-left: 0;
75
  }
76
+ }
77
+ .prem-images{
78
+ cursor: not-allowed;
79
+ opacity: 0.8;
80
+ }
81
+ .prem-images img{
82
+ width: 100%;
83
+ height: 100%;
84
+ }
85
+ .xoo-wsc-prem .xoo-hero-btns{
86
+ display: table;
87
+ margin: 10px auto;
88
+ }
89
+ .xoo-wsc-prem .xoo-hero-btns a{
90
+ margin: 0 10px;
91
  }
admin/partials/images/1.png ADDED
Binary file
admin/partials/images/2.png ADDED
Binary file
admin/partials/images/3.png ADDED
Binary file
admin/partials/xoo-wsc-admin-display.php CHANGED
@@ -47,6 +47,23 @@
47
  submit_button( 'Save Settings' );
48
  ?>
49
  </form>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  <?php
51
  break;
52
  default:
47
  submit_button( 'Save Settings' );
48
  ?>
49
  </form>
50
+
51
+ <?php
52
+ break;
53
+ case 'premium':
54
+ ?>
55
+ <div class="xoo-wsc-prem">
56
+ <div class="xoo-hero-btns">
57
+ <a class="buy-prem button button-primary button-hero" href="http://demo.xootix.com/side-cart-for-woocommerce/">LIVE DEMO</a>
58
+ <a class="live-demo button button-primary button-hero" href="http://xootix.com/plugins/side-cart-for-woocommerce/">BUY PREMIUM - 9$</a>
59
+ </div>
60
+ <div class="prem-images">
61
+ <img src="<?php echo plugin_dir_url( __FILE__ ).'images/1.png'?>">
62
+ <img src="<?php echo plugin_dir_url( __FILE__ ).'images/2.png'?>">
63
+ <img src="<?php echo plugin_dir_url( __FILE__ ).'images/3.png'?>">
64
+ </div>
65
+ </div>
66
+
67
  <?php
68
  break;
69
  default:
admin/settings/class-xoo-wsc-advanced-settings.php CHANGED
@@ -64,7 +64,7 @@ class xoo_wsc_Advanced_Settings extends xoo_wsc_Admin {
64
  // add_settings_field( $id, $title, $callback, $menu_slug, $section, $args );
65
  add_settings_field(
66
  'custom-css',
67
- __( 'Custom CSS',XOO_WSC_DOMAIN ),
68
  array( $this, 'custom_css' ),
69
  $this->group,
70
  $this->group . '-options' // Custom CSS
@@ -72,7 +72,7 @@ class xoo_wsc_Advanced_Settings extends xoo_wsc_Admin {
72
 
73
  add_settings_field(
74
  'shop-btn-class',
75
- __( 'Shop Button Class',XOO_WSC_DOMAIN ),
76
  array( $this, 'shop_btn_class' ),
77
  $this->group,
78
  $this->group . '-options' // Shop Button Class
64
  // add_settings_field( $id, $title, $callback, $menu_slug, $section, $args );
65
  add_settings_field(
66
  'custom-css',
67
+ __( 'Custom CSS','side-cart-woocommerce' ),
68
  array( $this, 'custom_css' ),
69
  $this->group,
70
  $this->group . '-options' // Custom CSS
72
 
73
  add_settings_field(
74
  'shop-btn-class',
75
+ __( 'Shop Button Class','side-cart-woocommerce' ),
76
  array( $this, 'shop_btn_class' ),
77
  $this->group,
78
  $this->group . '-options' // Shop Button Class
admin/settings/class-xoo-wsc-general-settings.php CHANGED
@@ -76,7 +76,7 @@ class xoo_wsc_General_Settings extends xoo_wsc_Admin {
76
  // add_settings_field( $id, $title, $callback, $menu_slug, $section, $args );
77
  add_settings_field(
78
  'sc-auto-open',
79
- __( 'Auto Open', XOO_WSC_DOMAIN ),
80
  array( $this, 'sc_auto_open' ),
81
  $this->group,
82
  $this->group . '-sc-options' // Auto Open Side Cart
@@ -84,7 +84,7 @@ class xoo_wsc_General_Settings extends xoo_wsc_Admin {
84
 
85
  add_settings_field(
86
  'sc-ajax-atc',
87
- __( 'Ajax Add to Cart', XOO_WSC_DOMAIN ),
88
  array( $this, 'sc_ajax_atc' ),
89
  $this->group,
90
  $this->group . '-sc-options' // ajax add to cart
@@ -92,7 +92,7 @@ class xoo_wsc_General_Settings extends xoo_wsc_Admin {
92
 
93
  add_settings_field(
94
  'sc-head-text',
95
- __( 'Head Title', XOO_WSC_DOMAIN ),
96
  array( $this, 'sc_head_text' ),
97
  $this->group,
98
  $this->group . '-sc-options' // Cart Head Text
@@ -101,7 +101,7 @@ class xoo_wsc_General_Settings extends xoo_wsc_Admin {
101
 
102
  add_settings_field(
103
  'sc-shipping-text',
104
- __( 'Shipping Text', XOO_WSC_DOMAIN ),
105
  array( $this, 'sc_shipping_text' ),
106
  $this->group,
107
  $this->group . '-sc-options' // Shipping Text
@@ -109,7 +109,7 @@ class xoo_wsc_General_Settings extends xoo_wsc_Admin {
109
 
110
  add_settings_field(
111
  'sc-cart-text',
112
- __( 'Cart Button Text', XOO_WSC_DOMAIN ),
113
  array( $this, 'sc_cart_text' ),
114
  $this->group,
115
  $this->group . '-sc-options' // Cart Button Text
@@ -117,7 +117,7 @@ class xoo_wsc_General_Settings extends xoo_wsc_Admin {
117
 
118
  add_settings_field(
119
  'sc-checkout-text',
120
- __( 'Checkout Button Text', XOO_WSC_DOMAIN ),
121
  array( $this, 'sc_checkout_text' ),
122
  $this->group,
123
  $this->group . '-sc-options' // Checkout Button Text
@@ -125,37 +125,21 @@ class xoo_wsc_General_Settings extends xoo_wsc_Admin {
125
 
126
  add_settings_field(
127
  'sc-continue-text',
128
- __( 'Continue Button Text', XOO_WSC_DOMAIN ),
129
  array( $this, 'sc_continue_text' ),
130
  $this->group,
131
  $this->group . '-sc-options' // Continue Button Text
132
  );
133
 
134
 
135
- add_settings_field(
136
- 'sc-show-price',
137
- __( 'Product Price', XOO_WSC_DOMAIN ),
138
- array( $this, 'sc_show_price' ),
139
- $this->group,
140
- $this->group . '-sc-options' // Product Price
141
- );
142
-
143
  add_settings_field(
144
  'sc-show-ptotal',
145
- __( 'Product total', XOO_WSC_DOMAIN ),
146
  array( $this, 'sc_show_ptotal' ),
147
  $this->group,
148
  $this->group . '-sc-options' // Product total
149
  );
150
 
151
- add_settings_field(
152
- 'sc-price-format',
153
- __( 'Price Format', XOO_WSC_DOMAIN ),
154
- array( $this, 'sc_price_format' ),
155
- $this->group,
156
- $this->group . '-sc-options' // Price Format
157
- );
158
-
159
 
160
  /*
161
  =============================================
@@ -165,7 +149,7 @@ class xoo_wsc_General_Settings extends xoo_wsc_Admin {
165
 
166
  add_settings_field(
167
  'bk-show-basket',
168
- __( 'Enable Basket', XOO_WSC_DOMAIN ),
169
  array( $this, 'bk_show_basket' ),
170
  $this->group,
171
  $this->group . '-bk-options' // Cart Basket
@@ -173,7 +157,7 @@ class xoo_wsc_General_Settings extends xoo_wsc_Admin {
173
 
174
  add_settings_field(
175
  'bk-show-bkcount',
176
- __( 'Product Count', XOO_WSC_DOMAIN ),
177
  array( $this, 'bk_show_bkcount' ),
178
  $this->group,
179
  $this->group . '-bk-options' // Product Count
@@ -253,7 +237,7 @@ class xoo_wsc_General_Settings extends xoo_wsc_Admin {
253
  public function sc_head_text() {
254
 
255
  $options = get_option( $this->group . '-options' );
256
- $option = isset( $options['sc-head-text']) ? $options['sc-head-text'] : __('Your Cart',XOO_WSC_DOMAIN);
257
 
258
  ?>
259
  <input type="text" value="<?php echo $option; ?>" name="<?php echo $this->group; ?>-options[sc-head-text]" />
@@ -272,7 +256,7 @@ class xoo_wsc_General_Settings extends xoo_wsc_Admin {
272
  public function sc_shipping_text() {
273
 
274
  $options = get_option( $this->group . '-options' );
275
- $option = isset( $options['sc-shipping-text']) ? $options['sc-shipping-text'] : __('To find out your shipping cost , Please proceed to checkout.',XOO_WSC_DOMAIN);
276
 
277
  ?>
278
  <input type="text" value="<?php echo $option; ?>" name="<?php echo $this->group; ?>-options[sc-shipping-text]" />
@@ -289,7 +273,7 @@ class xoo_wsc_General_Settings extends xoo_wsc_Admin {
289
  public function sc_cart_text() {
290
 
291
  $options = get_option( $this->group . '-options' );
292
- $option = isset( $options['sc-cart-text']) ? $options['sc-cart-text'] : __('View Cart',XOO_WSC_DOMAIN);
293
 
294
  ?>
295
  <input type="text" value="<?php echo $option; ?>" name="<?php echo $this->group; ?>-options[sc-cart-text]" />
@@ -305,7 +289,7 @@ class xoo_wsc_General_Settings extends xoo_wsc_Admin {
305
  public function sc_checkout_text() {
306
 
307
  $options = get_option( $this->group . '-options' );
308
- $option = isset( $options['sc-checkout-text']) ? $options['sc-checkout-text'] : __('Checkout',XOO_WSC_DOMAIN);
309
 
310
  ?>
311
  <input type="text" value="<?php echo $option; ?>" name="<?php echo $this->group; ?>-options[sc-checkout-text]" />
@@ -322,7 +306,7 @@ class xoo_wsc_General_Settings extends xoo_wsc_Admin {
322
  public function sc_continue_text() {
323
 
324
  $options = get_option( $this->group . '-options' );
325
- $option = isset( $options['sc-continue-text']) ? $options['sc-continue-text'] : __('Continue Shopping',XOO_WSC_DOMAIN);
326
 
327
  ?>
328
  <input type="text" value="<?php echo $option; ?>" name="<?php echo $this->group; ?>-options[sc-continue-text]" />
@@ -330,23 +314,6 @@ class xoo_wsc_General_Settings extends xoo_wsc_Admin {
330
  }
331
 
332
 
333
- /**
334
- * Product Price
335
- *
336
- * @since 1.0.0
337
- * @return mixed The settings field
338
- */
339
- public function sc_show_price() {
340
-
341
- $options = get_option( $this->group . '-options' );
342
- $option = isset( $options['sc-show-price']) ? $options['sc-show-price'] : 0;
343
- $id = $this->group.'-options[sc-show-price]';
344
- ?>
345
- <input type="hidden" name="<?php echo $id; ?>" value="false">
346
- <input type="checkbox" id="<?php echo $id; ?>" name="<?php echo $id; ?>" value="1" <?php checked($option, 1); ?> />
347
- <label for="<?php echo $id; ?>">Show Product Price.</label>
348
- <?php
349
- }
350
 
351
 
352
  /**
@@ -368,25 +335,6 @@ class xoo_wsc_General_Settings extends xoo_wsc_Admin {
368
  }
369
 
370
 
371
- /**
372
- * Price Format
373
- *
374
- * @since 1.0.0
375
- * @return mixed The settings field
376
- */
377
- public function sc_price_format() {
378
-
379
- $options = get_option( $this->group . '-options' );
380
- $option = isset( $options['sc-price-format']) ? $options['sc-price-format'] : 0;
381
- $id = $this->group.'-options[sc-price-format]';
382
- ?>
383
- <input type="hidden" name="<?php echo $id; ?>" value="false">
384
- <input type="checkbox" id="<?php echo $id; ?>" name="<?php echo $id; ?>" value="1" <?php checked($option, 1); ?> />
385
- <label for="<?php echo $id; ?>">Use default woocommerce price format.</label>
386
- <?php
387
- }
388
-
389
-
390
  /*
391
  =============================================
392
  ============ Cart Basket Section ============
76
  // add_settings_field( $id, $title, $callback, $menu_slug, $section, $args );
77
  add_settings_field(
78
  'sc-auto-open',
79
+ __( 'Auto Open', 'side-cart-woocommerce' ),
80
  array( $this, 'sc_auto_open' ),
81
  $this->group,
82
  $this->group . '-sc-options' // Auto Open Side Cart
84
 
85
  add_settings_field(
86
  'sc-ajax-atc',
87
+ __( 'Ajax Add to Cart', 'side-cart-woocommerce' ),
88
  array( $this, 'sc_ajax_atc' ),
89
  $this->group,
90
  $this->group . '-sc-options' // ajax add to cart
92
 
93
  add_settings_field(
94
  'sc-head-text',
95
+ __( 'Head Title', 'side-cart-woocommerce' ),
96
  array( $this, 'sc_head_text' ),
97
  $this->group,
98
  $this->group . '-sc-options' // Cart Head Text
101
 
102
  add_settings_field(
103
  'sc-shipping-text',
104
+ __( 'Shipping Text', 'side-cart-woocommerce' ),
105
  array( $this, 'sc_shipping_text' ),
106
  $this->group,
107
  $this->group . '-sc-options' // Shipping Text
109
 
110
  add_settings_field(
111
  'sc-cart-text',
112
+ __( 'Cart Button Text', 'side-cart-woocommerce' ),
113
  array( $this, 'sc_cart_text' ),
114
  $this->group,
115
  $this->group . '-sc-options' // Cart Button Text
117
 
118
  add_settings_field(
119
  'sc-checkout-text',
120
+ __( 'Checkout Button Text', 'side-cart-woocommerce' ),
121
  array( $this, 'sc_checkout_text' ),
122
  $this->group,
123
  $this->group . '-sc-options' // Checkout Button Text
125
 
126
  add_settings_field(
127
  'sc-continue-text',
128
+ __( 'Continue Button Text', 'side-cart-woocommerce' ),
129
  array( $this, 'sc_continue_text' ),
130
  $this->group,
131
  $this->group . '-sc-options' // Continue Button Text
132
  );
133
 
134
 
 
 
 
 
 
 
 
 
135
  add_settings_field(
136
  'sc-show-ptotal',
137
+ __( 'Product total', 'side-cart-woocommerce' ),
138
  array( $this, 'sc_show_ptotal' ),
139
  $this->group,
140
  $this->group . '-sc-options' // Product total
141
  );
142
 
 
 
 
 
 
 
 
 
143
 
144
  /*
145
  =============================================
149
 
150
  add_settings_field(
151
  'bk-show-basket',
152
+ __( 'Enable Basket', 'side-cart-woocommerce' ),
153
  array( $this, 'bk_show_basket' ),
154
  $this->group,
155
  $this->group . '-bk-options' // Cart Basket
157
 
158
  add_settings_field(
159
  'bk-show-bkcount',
160
+ __( 'Product Count', 'side-cart-woocommerce' ),
161
  array( $this, 'bk_show_bkcount' ),
162
  $this->group,
163
  $this->group . '-bk-options' // Product Count
237
  public function sc_head_text() {
238
 
239
  $options = get_option( $this->group . '-options' );
240
+ $option = isset( $options['sc-head-text']) ? $options['sc-head-text'] : __('Your Cart','side-cart-woocommerce');
241
 
242
  ?>
243
  <input type="text" value="<?php echo $option; ?>" name="<?php echo $this->group; ?>-options[sc-head-text]" />
256
  public function sc_shipping_text() {
257
 
258
  $options = get_option( $this->group . '-options' );
259
+ $option = isset( $options['sc-shipping-text']) ? $options['sc-shipping-text'] : __('To find out your shipping cost , Please proceed to checkout.','side-cart-woocommerce');
260
 
261
  ?>
262
  <input type="text" value="<?php echo $option; ?>" name="<?php echo $this->group; ?>-options[sc-shipping-text]" />
273
  public function sc_cart_text() {
274
 
275
  $options = get_option( $this->group . '-options' );
276
+ $option = isset( $options['sc-cart-text']) ? $options['sc-cart-text'] : __('View Cart','side-cart-woocommerce');
277
 
278
  ?>
279
  <input type="text" value="<?php echo $option; ?>" name="<?php echo $this->group; ?>-options[sc-cart-text]" />
289
  public function sc_checkout_text() {
290
 
291
  $options = get_option( $this->group . '-options' );
292
+ $option = isset( $options['sc-checkout-text']) ? $options['sc-checkout-text'] : __('Checkout','side-cart-woocommerce');
293
 
294
  ?>
295
  <input type="text" value="<?php echo $option; ?>" name="<?php echo $this->group; ?>-options[sc-checkout-text]" />
306
  public function sc_continue_text() {
307
 
308
  $options = get_option( $this->group . '-options' );
309
+ $option = isset( $options['sc-continue-text']) ? $options['sc-continue-text'] : __('Continue Shopping','side-cart-woocommerce');
310
 
311
  ?>
312
  <input type="text" value="<?php echo $option; ?>" name="<?php echo $this->group; ?>-options[sc-continue-text]" />
314
  }
315
 
316
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
317
 
318
 
319
  /**
335
  }
336
 
337
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
338
  /*
339
  =============================================
340
  ============ Cart Basket Section ============
admin/settings/class-xoo-wsc-premium-settings.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Admin Part of Plugin, dashboard and options.
5
+ *
6
+ * @package WooCommerce Side Cart
7
+ */
8
+ class xoo_wsc_Premium_Settings extends xoo_wsc_Admin {
9
+
10
+ /**
11
+ * The ID of this plugin.
12
+ *
13
+ * @since 1.0.0
14
+ * @access private
15
+ * @var string $xoo_wsc The ID of this plugin.
16
+ */
17
+ private $xoo_wsc;
18
+
19
+ /**
20
+ * The ID of Advanced Settings.
21
+ *
22
+ * @since 1.0.0
23
+ * @access private
24
+ * @var string $group The ID of Premium Settings.
25
+ */
26
+ private $group;
27
+
28
+ /**
29
+ * Initialize the class and set its properties.
30
+ *
31
+ * @since 1.0.0
32
+ * @var string $xoo_wsc The name of this plugin.
33
+ * @var string $version The version of this plugin.
34
+ */
35
+ public function __construct( $xoo_wsc ) {
36
+
37
+ $this->xoo_wsc = $xoo_wsc;
38
+ $this->group = $xoo_wsc.'-pm';
39
+ }
40
+ }
admin/settings/class-xoo-wsc-style-settings.php CHANGED
@@ -78,7 +78,7 @@ class xoo_wsc_Style_Settings extends xoo_wsc_Admin {
78
 
79
  add_settings_field(
80
  'sch-fs',
81
- __( 'Head Font Size', XOO_WSC_DOMAIN ),
82
  array( $this, 'sch_fs' ),
83
  $this->group,
84
  $this->group . '-sc-options' // Font Size
@@ -92,7 +92,7 @@ class xoo_wsc_Style_Settings extends xoo_wsc_Admin {
92
 
93
  add_settings_field(
94
  'scb-cw',
95
- __( 'Container Width', XOO_WSC_DOMAIN ),
96
  array( $this, 'scb_cw' ),
97
  $this->group,
98
  $this->group . '-sc-options' // Container Width
@@ -100,7 +100,7 @@ class xoo_wsc_Style_Settings extends xoo_wsc_Admin {
100
 
101
  add_settings_field(
102
  'scb-fs',
103
- __( 'Body Font Size', XOO_WSC_DOMAIN ),
104
  array( $this, 'scb_fs' ),
105
  $this->group,
106
  $this->group . '-sc-options' // Font Size
@@ -108,7 +108,7 @@ class xoo_wsc_Style_Settings extends xoo_wsc_Admin {
108
 
109
  add_settings_field(
110
  'scb-imgw',
111
- __( 'Product Image Width', XOO_WSC_DOMAIN ),
112
  array( $this, 'scb_imgw' ),
113
  $this->group,
114
  $this->group . '-sc-options' // Image Width
@@ -123,7 +123,7 @@ class xoo_wsc_Style_Settings extends xoo_wsc_Admin {
123
 
124
  add_settings_field(
125
  'scf-bm',
126
- __( 'Footer Buttons Margin', XOO_WSC_DOMAIN ),
127
  array( $this, 'scf_bm' ),
128
  $this->group,
129
  $this->group . '-sc-options' // Button Margin
@@ -138,7 +138,7 @@ class xoo_wsc_Style_Settings extends xoo_wsc_Admin {
138
 
139
  add_settings_field(
140
  'bk-pos',
141
- __( 'Basket Position', XOO_WSC_DOMAIN ),
142
  array( $this, 'bk_pos' ),
143
  $this->group,
144
  $this->group . '-bk-options' // Basket Position
@@ -146,7 +146,7 @@ class xoo_wsc_Style_Settings extends xoo_wsc_Admin {
146
 
147
  add_settings_field(
148
  'bk-bbgc',
149
- __( 'Basket Background Color', XOO_WSC_DOMAIN ),
150
  array( $this, 'bk_bbgc' ),
151
  $this->group,
152
  $this->group . '-bk-options' // Basket Bg Color
@@ -154,7 +154,7 @@ class xoo_wsc_Style_Settings extends xoo_wsc_Admin {
154
 
155
  add_settings_field(
156
  'bk-bfc',
157
- __( 'Basket Icon Color', XOO_WSC_DOMAIN ),
158
  array( $this, 'bk_bfc' ),
159
  $this->group,
160
  $this->group . '-bk-options' // Basket Icon Color
@@ -162,7 +162,7 @@ class xoo_wsc_Style_Settings extends xoo_wsc_Admin {
162
 
163
  add_settings_field(
164
  'bk-bfs',
165
- __( 'Basket Icon Size', XOO_WSC_DOMAIN ),
166
  array( $this, 'bk_bfs' ),
167
  $this->group,
168
  $this->group . '-bk-options' // Basket Font Size
@@ -170,7 +170,7 @@ class xoo_wsc_Style_Settings extends xoo_wsc_Admin {
170
 
171
  add_settings_field(
172
  'bk-cbgc',
173
- __( 'Count Background Color', XOO_WSC_DOMAIN ),
174
  array( $this, 'bk_cbgc' ),
175
  $this->group,
176
  $this->group . '-bk-options' // Count background Color
@@ -178,7 +178,7 @@ class xoo_wsc_Style_Settings extends xoo_wsc_Admin {
178
 
179
  add_settings_field(
180
  'bk-cfc',
181
- __( 'Count Text Color', XOO_WSC_DOMAIN ),
182
  array( $this, 'bk_cfc' ),
183
  $this->group,
184
  $this->group . '-bk-options' // Count Text Color
@@ -348,12 +348,13 @@ class xoo_wsc_Style_Settings extends xoo_wsc_Admin {
348
  public function bk_pos() {
349
 
350
  $options = get_option( $this->group . '-options' );
351
- $option = isset( $options['bk-pos']) ? $options['bk-pos'] : 'bottom';
352
  $id = $this->group.'-options[bk-pos]';
353
  ?>
354
  <select name="<?php echo $id; ?>">
355
  <option value="top" <?php selected($option,'top'); ?>>Top</option>
356
- <option value="bottom" <?php selected($option,'bottom'); ?>>Bottom</option>
 
357
  <?php
358
  }
359
 
78
 
79
  add_settings_field(
80
  'sch-fs',
81
+ __( 'Head Font Size', 'side-cart-woocommerce' ),
82
  array( $this, 'sch_fs' ),
83
  $this->group,
84
  $this->group . '-sc-options' // Font Size
92
 
93
  add_settings_field(
94
  'scb-cw',
95
+ __( 'Container Width', 'side-cart-woocommerce' ),
96
  array( $this, 'scb_cw' ),
97
  $this->group,
98
  $this->group . '-sc-options' // Container Width
100
 
101
  add_settings_field(
102
  'scb-fs',
103
+ __( 'Body Font Size', 'side-cart-woocommerce' ),
104
  array( $this, 'scb_fs' ),
105
  $this->group,
106
  $this->group . '-sc-options' // Font Size
108
 
109
  add_settings_field(
110
  'scb-imgw',
111
+ __( 'Product Image Width', 'side-cart-woocommerce' ),
112
  array( $this, 'scb_imgw' ),
113
  $this->group,
114
  $this->group . '-sc-options' // Image Width
123
 
124
  add_settings_field(
125
  'scf-bm',
126
+ __( 'Footer Buttons Margin', 'side-cart-woocommerce' ),
127
  array( $this, 'scf_bm' ),
128
  $this->group,
129
  $this->group . '-sc-options' // Button Margin
138
 
139
  add_settings_field(
140
  'bk-pos',
141
+ __( 'Basket Position', 'side-cart-woocommerce' ),
142
  array( $this, 'bk_pos' ),
143
  $this->group,
144
  $this->group . '-bk-options' // Basket Position
146
 
147
  add_settings_field(
148
  'bk-bbgc',
149
+ __( 'Basket Background Color', 'side-cart-woocommerce' ),
150
  array( $this, 'bk_bbgc' ),
151
  $this->group,
152
  $this->group . '-bk-options' // Basket Bg Color
154
 
155
  add_settings_field(
156
  'bk-bfc',
157
+ __( 'Basket Icon Color', 'side-cart-woocommerce' ),
158
  array( $this, 'bk_bfc' ),
159
  $this->group,
160
  $this->group . '-bk-options' // Basket Icon Color
162
 
163
  add_settings_field(
164
  'bk-bfs',
165
+ __( 'Basket Icon Size', 'side-cart-woocommerce' ),
166
  array( $this, 'bk_bfs' ),
167
  $this->group,
168
  $this->group . '-bk-options' // Basket Font Size
170
 
171
  add_settings_field(
172
  'bk-cbgc',
173
+ __( 'Count Background Color', 'side-cart-woocommerce' ),
174
  array( $this, 'bk_cbgc' ),
175
  $this->group,
176
  $this->group . '-bk-options' // Count background Color
178
 
179
  add_settings_field(
180
  'bk-cfc',
181
+ __( 'Count Text Color', 'side-cart-woocommerce' ),
182
  array( $this, 'bk_cfc' ),
183
  $this->group,
184
  $this->group . '-bk-options' // Count Text Color
348
  public function bk_pos() {
349
 
350
  $options = get_option( $this->group . '-options' );
351
+ $option = isset( $options['bk-pos']) ? $options['bk-pos'] : 'bottom_fixed';
352
  $id = $this->group.'-options[bk-pos]';
353
  ?>
354
  <select name="<?php echo $id; ?>">
355
  <option value="top" <?php selected($option,'top'); ?>>Top</option>
356
+ <option value="top_fixed" <?php selected($option,'top_fixed'); ?>>Top Fixed</option>
357
+ <option value="bottom_fixed" <?php selected($option,'bottom_fixed'); ?>>Bottom Fixed</option>
358
  <?php
359
  }
360
 
includes/class-xoo-wsc-i18n.php CHANGED
@@ -6,7 +6,7 @@
6
  * so that it is ready for translation.
7
  *
8
  * @since 1.0.0
9
- * @package Side Cart WooCommerce
10
  */
11
  class xoo_wsc_i18n {
12
 
@@ -16,8 +16,9 @@ class xoo_wsc_i18n {
16
  * @since 1.0.0
17
  */
18
  public function load_plugin_textdomain() {
19
-
20
- $locale = apply_filters( 'plugin_locale', get_locale(), XOO_WSC_DOMAIN );
21
- load_textdomain( XOO_WSC_DOMAIN, trailingslashit( WP_LANG_DIR ) .'/'.XOO_WSC_DOMAIN . '-'. $locale . '.mo' );
 
22
  }
23
  }
6
  * so that it is ready for translation.
7
  *
8
  * @since 1.0.0
9
+ * @package WooCommerce Side Cart
10
  */
11
  class xoo_wsc_i18n {
12
 
16
  * @since 1.0.0
17
  */
18
  public function load_plugin_textdomain() {
19
+ $domain = 'side-cart-woocommerce';
20
+ $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
21
+ load_textdomain( $domain, WP_LANG_DIR . '/'.$domain.'-' . $locale . '.mo' ); //wp-content languages
22
+ load_plugin_textdomain( $domain, FALSE, basename( dirname( __FILE__ ) ) . '/languages/' ); // Plugin Languages
23
  }
24
  }
includes/class-xoo-wsc.php CHANGED
@@ -52,7 +52,7 @@ class xoo_wsc {
52
  public function __construct() {
53
 
54
  $this->xoo_wsc = 'xoo-wsc';
55
- $this->version = '1.0.0';
56
 
57
  $this->load_dependencies();
58
  $this->set_locale();
@@ -140,8 +140,7 @@ class xoo_wsc {
140
  private function set_locale() {
141
 
142
  $plugin_i18n = new xoo_wsc_i18n();
143
-
144
- $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
145
 
146
  }
147
 
@@ -183,7 +182,7 @@ class xoo_wsc {
183
  $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
184
  if(!is_admin() || wp_doing_ajax()){
185
  $get_cart = new xoo_wsc_Cart_Data($this->get_xoo_wsc());
186
- $this->loader->add_action('wp_head',$get_cart,'get_cart_markup');
187
  $this->loader->add_action('xoo_wsc_cart_content',$get_cart,'get_cart_content');
188
  $this->loader->add_action('wp_ajax_add_to_cart',$get_cart,'add_to_cart');
189
  $this->loader->add_action('wp_ajax_nopriv_add_to_cart',$get_cart,'add_to_cart');
52
  public function __construct() {
53
 
54
  $this->xoo_wsc = 'xoo-wsc';
55
+ $this->version = '1.0.1';
56
 
57
  $this->load_dependencies();
58
  $this->set_locale();
140
  private function set_locale() {
141
 
142
  $plugin_i18n = new xoo_wsc_i18n();
143
+ $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain',100);
 
144
 
145
  }
146
 
182
  $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
183
  if(!is_admin() || wp_doing_ajax()){
184
  $get_cart = new xoo_wsc_Cart_Data($this->get_xoo_wsc());
185
+ $this->loader->add_action('wp_footer',$get_cart,'get_cart_markup');
186
  $this->loader->add_action('xoo_wsc_cart_content',$get_cart,'get_cart_content');
187
  $this->loader->add_action('wp_ajax_add_to_cart',$get_cart,'add_to_cart');
188
  $this->loader->add_action('wp_ajax_nopriv_add_to_cart',$get_cart,'add_to_cart');
languages/side-cart-woocommerce.pot ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #, fuzzy
2
+ msgid ""
3
+ msgstr ""
4
+ "Project-Id-Version: \n"
5
+ "POT-Creation-Date: 2017-07-29 11:01+0530\n"
6
+ "PO-Revision-Date: 2017-04-14 20:19+0530\n"
7
+ "Last-Translator: \n"
8
+ "Language-Team: \n"
9
+ "Language: en\n"
10
+ "MIME-Version: 1.0\n"
11
+ "Content-Type: text/plain; charset=UTF-8\n"
12
+ "Content-Transfer-Encoding: 8bit\n"
13
+ "X-Generator: Poedit 2.0.2\n"
14
+ "X-Poedit-Basepath: ..\n"
15
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
16
+ "X-Poedit-KeywordsList: __;_e\n"
17
+ "X-Poedit-SearchPath-0: .\n"
18
+
19
+ #: admin/class-xoo-wsc-admin.php:87
20
+ msgid "Woo Side Cart"
21
+ msgstr ""
22
+
23
+ #: admin/class-xoo-wsc-general-settings.php:67
24
+ #: admin/settings/class-xoo-wsc-general-settings.php:79
25
+ msgid "Auto Open"
26
+ msgstr ""
27
+
28
+ #: admin/class-xoo-wsc-general-settings.php:75
29
+ #: admin/settings/class-xoo-wsc-general-settings.php:95
30
+ msgid "Head Title"
31
+ msgstr ""
32
+
33
+ #: admin/settings/class-xoo-wsc-advanced-settings.php:67
34
+ msgid "Custom CSS"
35
+ msgstr ""
36
+
37
+ #: admin/settings/class-xoo-wsc-advanced-settings.php:75
38
+ msgid "Shop Button Class"
39
+ msgstr ""
40
+
41
+ #: admin/settings/class-xoo-wsc-general-settings.php:87
42
+ msgid "Ajax Add to Cart"
43
+ msgstr ""
44
+
45
+ #: admin/settings/class-xoo-wsc-general-settings.php:104
46
+ msgid "Shipping Text"
47
+ msgstr ""
48
+
49
+ #: admin/settings/class-xoo-wsc-general-settings.php:112
50
+ msgid "Cart Button Text"
51
+ msgstr ""
52
+
53
+ #: admin/settings/class-xoo-wsc-general-settings.php:120
54
+ msgid "Checkout Button Text"
55
+ msgstr ""
56
+
57
+ #: admin/settings/class-xoo-wsc-general-settings.php:128
58
+ msgid "Continue Button Text"
59
+ msgstr ""
60
+
61
+ #: admin/settings/class-xoo-wsc-general-settings.php:137
62
+ msgid "Product total"
63
+ msgstr ""
64
+
65
+ #: admin/settings/class-xoo-wsc-general-settings.php:152
66
+ msgid "Enable Basket"
67
+ msgstr ""
68
+
69
+ #: admin/settings/class-xoo-wsc-general-settings.php:160
70
+ msgid "Product Count"
71
+ msgstr ""
72
+
73
+ #: admin/settings/class-xoo-wsc-general-settings.php:240
74
+ #: public/partials/xoo-wsc-markup.php:15
75
+ msgid "Your Cart"
76
+ msgstr ""
77
+
78
+ #: admin/settings/class-xoo-wsc-general-settings.php:259
79
+ #: public/class-xoo-wsc-cart-data.php:144
80
+ msgid "To find out your shipping cost , Please proceed to checkout."
81
+ msgstr ""
82
+
83
+ #: admin/settings/class-xoo-wsc-general-settings.php:276
84
+ #: public/partials/xoo-wsc-markup.php:16
85
+ msgid "View Cart"
86
+ msgstr ""
87
+
88
+ #: admin/settings/class-xoo-wsc-general-settings.php:292
89
+ #: public/partials/xoo-wsc-markup.php:17
90
+ msgid "Checkout"
91
+ msgstr ""
92
+
93
+ #: admin/settings/class-xoo-wsc-general-settings.php:309
94
+ #: public/partials/xoo-wsc-markup.php:18
95
+ msgid "Continue Shopping"
96
+ msgstr ""
97
+
98
+ #: admin/settings/class-xoo-wsc-style-settings.php:81
99
+ msgid "Head Font Size"
100
+ msgstr ""
101
+
102
+ #: admin/settings/class-xoo-wsc-style-settings.php:95
103
+ msgid "Container Width"
104
+ msgstr ""
105
+
106
+ #: admin/settings/class-xoo-wsc-style-settings.php:103
107
+ msgid "Body Font Size"
108
+ msgstr ""
109
+
110
+ #: admin/settings/class-xoo-wsc-style-settings.php:111
111
+ msgid "Product Image Width"
112
+ msgstr ""
113
+
114
+ #: admin/settings/class-xoo-wsc-style-settings.php:126
115
+ msgid "Footer Buttons Margin"
116
+ msgstr ""
117
+
118
+ #: admin/settings/class-xoo-wsc-style-settings.php:141
119
+ msgid "Basket Position"
120
+ msgstr ""
121
+
122
+ #: admin/settings/class-xoo-wsc-style-settings.php:149
123
+ msgid "Basket Background Color"
124
+ msgstr ""
125
+
126
+ #: admin/settings/class-xoo-wsc-style-settings.php:157
127
+ msgid "Basket Icon Color"
128
+ msgstr ""
129
+
130
+ #: admin/settings/class-xoo-wsc-style-settings.php:165
131
+ msgid "Basket Icon Size"
132
+ msgstr ""
133
+
134
+ #: admin/settings/class-xoo-wsc-style-settings.php:173
135
+ msgid "Count Background Color"
136
+ msgstr ""
137
+
138
+ #: admin/settings/class-xoo-wsc-style-settings.php:181
139
+ msgid "Count Text Color"
140
+ msgstr ""
141
+
142
+ #: public/class-xoo-wsc-cart-data.php:134
143
+ msgid "Your cart is empty."
144
+ msgstr ""
145
+
146
+ #: public/class-xoo-wsc-cart-data.php:143
147
+ msgid "Subtotal:"
148
+ msgstr ""
149
+
150
+ #: public/class-xoo-wsc-cart-data.php:182
151
+ msgid "Remove"
152
+ msgstr ""
153
+
154
+ #: public/class-xoo-wsc-cart-data.php:307
155
+ msgid "Something went wrong"
156
+ msgstr ""
157
+
158
+ #: xoo-wsc.php:93
159
+ msgid ""
160
+ "Side Cart WooCommerce is enabled but not effective. It requires WooCommerce "
161
+ "in order to work."
162
+ msgstr ""
languages/xoo-wsc.pot DELETED
@@ -1,239 +0,0 @@
1
- #, fuzzy
2
- msgid ""
3
- msgstr ""
4
- "Project-Id-Version: \n"
5
- "POT-Creation-Date: 2017-04-15 10:57+0530\n"
6
- "PO-Revision-Date: 2017-04-14 20:19+0530\n"
7
- "Last-Translator: \n"
8
- "Language-Team: \n"
9
- "Language: en\n"
10
- "MIME-Version: 1.0\n"
11
- "Content-Type: text/plain; charset=UTF-8\n"
12
- "Content-Transfer-Encoding: 8bit\n"
13
- "X-Generator: Poedit 2.0.1\n"
14
- "X-Poedit-Basepath: ..\n"
15
- "Plural-Forms: nplurals=2; plural=(n != 1);\n"
16
- "X-Poedit-KeywordsList: __;_e\n"
17
- "X-Poedit-SearchPath-0: .\n"
18
-
19
- #: admin/class-xoo-wsc-admin.php:87
20
- msgid "Woo Side Cart"
21
- msgstr ""
22
-
23
- #: admin/settings/class-xoo-wsc-advanced-settings.php:68
24
- msgid "Custom CSS"
25
- msgstr ""
26
-
27
- #: admin/settings/class-xoo-wsc-advanced-settings.php:76
28
- msgid "Shop Button Class"
29
- msgstr ""
30
-
31
- #: admin/settings/class-xoo-wsc-general-settings.php:80
32
- msgid "Auto Open"
33
- msgstr ""
34
-
35
- #: admin/settings/class-xoo-wsc-general-settings.php:88
36
- msgid "Head Title"
37
- msgstr ""
38
-
39
- #: admin/settings/class-xoo-wsc-general-settings.php:96
40
- msgid "Subtotal"
41
- msgstr ""
42
-
43
- #: admin/settings/class-xoo-wsc-general-settings.php:104
44
- msgid "Shipping Text"
45
- msgstr ""
46
-
47
- #: admin/settings/class-xoo-wsc-general-settings.php:112
48
- msgid "Cart Button Text"
49
- msgstr ""
50
-
51
- #: admin/settings/class-xoo-wsc-general-settings.php:120
52
- msgid "Checkout Button Text"
53
- msgstr ""
54
-
55
- #: admin/settings/class-xoo-wsc-general-settings.php:128
56
- msgid "Continue Button Text"
57
- msgstr ""
58
-
59
- #: admin/settings/class-xoo-wsc-general-settings.php:136
60
- msgid "Empty Cart Button"
61
- msgstr ""
62
-
63
- #: admin/settings/class-xoo-wsc-general-settings.php:144
64
- msgid "Cart Is Empty Text"
65
- msgstr ""
66
-
67
- #: admin/settings/class-xoo-wsc-general-settings.php:153
68
- msgid "Product Price"
69
- msgstr ""
70
-
71
- #: admin/settings/class-xoo-wsc-general-settings.php:161
72
- msgid "Product total"
73
- msgstr ""
74
-
75
- #: admin/settings/class-xoo-wsc-general-settings.php:176
76
- msgid "Enable Basket"
77
- msgstr ""
78
-
79
- #: admin/settings/class-xoo-wsc-general-settings.php:184
80
- msgid "Product Count"
81
- msgstr ""
82
-
83
- #: admin/settings/class-xoo-wsc-general-settings.php:192
84
- msgid "Count Type"
85
- msgstr ""
86
-
87
- #: admin/settings/class-xoo-wsc-general-settings.php:200
88
- msgid "FlyTo Cart Animation"
89
- msgstr ""
90
-
91
- #: admin/settings/class-xoo-wsc-general-settings.php:265
92
- #: public/partials/xoo-wsc-markup.php:16
93
- msgid "Your Cart"
94
- msgstr ""
95
-
96
- #: admin/settings/class-xoo-wsc-general-settings.php:282
97
- #: public/class-xoo-wsc-cart-data.php:189
98
- msgid "Subtotal:"
99
- msgstr ""
100
-
101
- #: admin/settings/class-xoo-wsc-general-settings.php:299
102
- #: public/class-xoo-wsc-cart-data.php:190
103
- msgid "To find out your shipping cost , Please proceed to checkout."
104
- msgstr ""
105
-
106
- #: admin/settings/class-xoo-wsc-general-settings.php:316
107
- #: public/partials/xoo-wsc-markup.php:17
108
- msgid "View Cart"
109
- msgstr ""
110
-
111
- #: admin/settings/class-xoo-wsc-general-settings.php:332
112
- #: public/partials/xoo-wsc-markup.php:18
113
- msgid "Checkout"
114
- msgstr ""
115
-
116
- #: admin/settings/class-xoo-wsc-general-settings.php:349
117
- #: public/partials/xoo-wsc-markup.php:19
118
- msgid "Continue Shopping"
119
- msgstr ""
120
-
121
- #: admin/settings/class-xoo-wsc-general-settings.php:365
122
- msgid "Empty Cart"
123
- msgstr ""
124
-
125
- #: admin/settings/class-xoo-wsc-general-settings.php:381
126
- #: public/class-xoo-wsc-cart-data.php:191
127
- msgid "Your cart is empty."
128
- msgstr ""
129
-
130
- #: admin/settings/class-xoo-wsc-style-settings.php:94
131
- #: admin/settings/class-xoo-wsc-style-settings.php:165
132
- #: admin/settings/class-xoo-wsc-style-settings.php:244
133
- msgid "Background Color"
134
- msgstr ""
135
-
136
- #: admin/settings/class-xoo-wsc-style-settings.php:102
137
- #: admin/settings/class-xoo-wsc-style-settings.php:173
138
- msgid "Font Color"
139
- msgstr ""
140
-
141
- #: admin/settings/class-xoo-wsc-style-settings.php:110
142
- #: admin/settings/class-xoo-wsc-style-settings.php:181
143
- msgid "Font Size"
144
- msgstr ""
145
-
146
- #: admin/settings/class-xoo-wsc-style-settings.php:118
147
- msgid "Border Color"
148
- msgstr ""
149
-
150
- #: admin/settings/class-xoo-wsc-style-settings.php:126
151
- msgid "Border Size"
152
- msgstr ""
153
-
154
- #: admin/settings/class-xoo-wsc-style-settings.php:134
155
- msgid "Padding"
156
- msgstr ""
157
-
158
- #: admin/settings/class-xoo-wsc-style-settings.php:142
159
- msgid "Close Cart Icon Size"
160
- msgstr ""
161
-
162
- #: admin/settings/class-xoo-wsc-style-settings.php:157
163
- msgid "Container Width"
164
- msgstr ""
165
-
166
- #: admin/settings/class-xoo-wsc-style-settings.php:189
167
- msgid "Product Image Width"
168
- msgstr ""
169
-
170
- #: admin/settings/class-xoo-wsc-style-settings.php:197
171
- msgid "Remove Text Color"
172
- msgstr ""
173
-
174
- #: admin/settings/class-xoo-wsc-style-settings.php:205
175
- msgid "Product Title Color"
176
- msgstr ""
177
-
178
- #: admin/settings/class-xoo-wsc-style-settings.php:213
179
- msgid "Product Title Font Size"
180
- msgstr ""
181
-
182
- #: admin/settings/class-xoo-wsc-style-settings.php:221
183
- msgid "Product Row Border Color"
184
- msgstr ""
185
-
186
- #: admin/settings/class-xoo-wsc-style-settings.php:229
187
- msgid "Product Row Border Size"
188
- msgstr ""
189
-
190
- #: admin/settings/class-xoo-wsc-style-settings.php:252
191
- msgid "Buttons Margin"
192
- msgstr ""
193
-
194
- #: admin/settings/class-xoo-wsc-style-settings.php:267
195
- msgid "Basket Position"
196
- msgstr ""
197
-
198
- #: admin/settings/class-xoo-wsc-style-settings.php:276
199
- msgid "Basket Icon"
200
- msgstr ""
201
-
202
- #: admin/settings/class-xoo-wsc-style-settings.php:284
203
- msgid "Basket Background Color"
204
- msgstr ""
205
-
206
- #: admin/settings/class-xoo-wsc-style-settings.php:292
207
- msgid "Basket Icon Color"
208
- msgstr ""
209
-
210
- #: admin/settings/class-xoo-wsc-style-settings.php:300
211
- msgid "Basket Icon Size"
212
- msgstr ""
213
-
214
- #: admin/settings/class-xoo-wsc-style-settings.php:308
215
- msgid "Count Background Color"
216
- msgstr ""
217
-
218
- #: admin/settings/class-xoo-wsc-style-settings.php:316
219
- msgid "Count Text Color"
220
- msgstr ""
221
-
222
- #: public/class-xoo-wsc-cart-data.php:201
223
- msgid "Remove"
224
- msgstr ""
225
-
226
- #: public/class-xoo-wsc-cart-data.php:213
227
- msgid "Price:"
228
- msgstr ""
229
-
230
- #: public/class-xoo-wsc-cart-data.php:267
231
- #: public/class-xoo-wsc-cart-data.php:312
232
- msgid "Something went wrong"
233
- msgstr ""
234
-
235
- #: xoo-wsc.php:92
236
- msgid ""
237
- "WooCommerce Side Cart is enabled but not effective. It requires WooCommerce "
238
- "in order to work."
239
- msgstr ""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
public/class-xoo-wsc-cart-data.php CHANGED
@@ -119,123 +119,101 @@ class xoo_wsc_Cart_Data{
119
  );
120
  }
121
 
 
 
 
122
  /**
123
- * Get required cart data
124
  *
125
  * @since 1.0.0
126
- * @return array
127
  */
128
 
129
- public function markup_data(){
130
- $cart_data = WC()->cart->get_cart();
131
- if(!$cart_data)
132
- return false;
 
133
 
134
- foreach($cart_data as $cart_item_key => $item){
135
- $item_product_id = $item['product_id'];
136
- $item_variation_id = $item['variation_id'];
 
137
 
138
- if($item_variation_id){
139
- $product_id = $item_variation_id;
140
- $product = new WC_product_variation($product_id);
141
- $attributes = wc_get_formatted_variation($product);
142
- }
143
- else{
144
- $product_id = $item_product_id;
145
- $product = wc_get_product($product_id);
146
- $attributes = 0;
147
- }
148
 
149
- $item_title = $product->get_title();
150
- $item_link = $product->get_permalink();
151
- $item_price_raw = $product->get_price();
152
- $item_price = $this->formatted_price($item_price_raw);
153
- $item_image = $product->get_image('shop_thumbnail');
154
- $is_sold_single = $product->is_sold_individually();
155
- $item_qty = $item['quantity'];
156
- $item_total = $this->formatted_price($item_qty*$item_price_raw);
157
-
158
- $markup_data[] = array(
159
- 'id' => $product_id,
160
- 'title' => $item_title,
161
- 'link' => $item_link,
162
- 'image' => $item_image,
163
- 'price' => $item_price,
164
- 'quantity' => $item_qty,
165
- 'total' => $item_total,
166
- 'attributes' => $attributes,
167
- 'is_sold_single'=> $is_sold_single,
168
- 'cart_key' => $cart_item_key
169
- );
170
- }
171
 
172
- return $markup_data;
173
 
174
- }
175
 
176
 
177
- /**
178
- * Get Side Cart Content
179
- *
180
- * @since 1.0.0
181
- */
182
 
183
- public function get_cart_content(){
184
- $items = $this->markup_data();
185
- $options = get_option('xoo-wsc-gl-options');
186
- ?>
 
 
 
 
187
 
188
- <?php if($items): ?>
189
 
190
- <?php
191
- $shipping_txt = isset($options['sc-shipping-text']) ? $options['sc-shipping-text']: __("To find out your shipping cost , Please proceed to checkout.",XOO_WSC_DOMAIN);
192
- $show_ptotal = isset( $options['sc-show-ptotal']) ? $options['sc-show-ptotal'] : 1;
193
- ?>
194
 
195
- <?php foreach($items as $item) : ?>
 
 
 
196
 
197
- <div class="xoo-wsc-product" data-xoo_wsc="<?php echo $item['cart_key']; ?>">
 
 
198
  <div class="xoo-wsc-img-col">
199
- <?php echo $item['image']; ?>
200
- <a href="#" class="xoo-wsc-remove"><?php _e('Remove',XOO_WSC_DOMAIN); ?></a>
201
  </div>
202
  <div class="xoo-wsc-sum-col">
203
- <a href="<?php echo $item['link']; ?>" class="xoo-wsc-pname"><?php echo $item['title']; ?></a>
204
  <?php
205
 
206
- if($attributes = $item['attributes']){
207
  echo $attributes;
208
- }
209
 
210
  ?>
211
  <div class="xoo-wsc-price">
212
- <span><?php echo $item['quantity']; ?></span> X <span><?php echo $item['price']; ?></span> =
213
  <?php if($show_ptotal == 1): ?>
214
- <span><?php echo $item['total']; ?></span>
215
  <?php endif; ?>
216
  </div>
217
  </div>
218
  </div>
219
 
220
- <?php endforeach ?>
221
 
222
  <div class="xoo-wsc-subtotal">
223
- <span><?php _e("Subtotal:",XOO_WSC_DOMAIN); ?></span> <?php echo $this->formatted_price(WC()->cart->subtotal); ?>
224
  </div>
225
 
226
  <?php if(!empty($shipping_txt)): ?>
227
- <span class="xoo-wsc-shiptxt"><?php echo esc_attr($shipping_txt); ?></span>
228
  <?php endif; ?>
229
 
230
- <?php else : ?>
231
-
232
- <span class="xoo-wsc-ecnt"><?php _e('Your cart is empty.',XOO_WSC_DOMAIN); ?></span>
233
-
234
- <?php endif ?>
235
  <?php
236
  }
237
 
238
 
 
239
  /**
240
  * Add product to cart
241
  *
@@ -245,26 +223,56 @@ class xoo_wsc_Cart_Data{
245
 
246
  public function add_to_cart(){
247
 
248
- //Form Input Values
249
- $item_id = intval($_POST['item_id']);
250
- $quantity = intval($_POST['quantity']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
251
 
252
- //If empty return error
253
- if(!$item_id){
254
- wp_send_json(array('error' => __('Something went wrong','xoo-wsc')));
 
255
  }
256
 
257
- //Check product type
258
- $product_type = get_post_type($item_id);
259
-
260
- if($product_type == 'product_variation'){
261
- $product_id = wp_get_post_parent_id($item_id);
262
- $variation_id = $item_id;
263
- $attribute_values = wc_get_product_variation_attributes($variation_id);
264
- $cart_success = WC()->cart->add_to_cart($product_id,$quantity,$variation_id,$attribute_values );
265
- }
266
- else{
267
- $product_id = $item_id;
268
  $cart_success = WC()->cart->add_to_cart($product_id,$quantity);
269
  }
270
 
@@ -296,7 +304,7 @@ class xoo_wsc_Cart_Data{
296
 
297
  //If empty return error
298
  if(!$cart_key){
299
- wp_send_json(array('error' => __('Something went wrong',XOO_WSC_DOMAIN)));
300
  }
301
 
302
  $cart_success = WC()->cart->set_quantity($cart_key,$new_qty);
119
  );
120
  }
121
 
122
+
123
+
124
+
125
  /**
126
+ * Get Side Cart Content
127
  *
128
  * @since 1.0.0
 
129
  */
130
 
131
+ public function get_cart_content(){
132
+ $cart_data = WC()->cart->get_cart();
133
+ $options = get_option('xoo-wsc-gl-options');
134
+ $empty_cart_txt = isset( $options['sc-empty-text']) ? $options['sc-empty-text'] : __('Your cart is empty.','side-cart-woocommerce');
135
+
136
 
137
+ if(WC()->cart->is_empty()){
138
+ echo '<span class="xoo-wsc-ecnt">'.esc_attr__($empty_cart_txt,'side-cart-woocommerce').'</span>';
139
+ return;
140
+ }
141
 
142
+
143
+ $subtotal_txt = isset($options['sc-subtotal-text']) ? $options['sc-subtotal-text']: __("Subtotal:",'side-cart-woocommerce');
144
+ $shipping_txt = isset($options['sc-shipping-text']) ? $options['sc-shipping-text']: __("To find out your shipping cost , Please proceed to checkout.",'side-cart-woocommerce');
145
+ $show_ptotal = isset( $options['sc-show-ptotal']) ? $options['sc-show-ptotal'] : 1;
146
+
 
 
 
 
 
147
 
148
+ foreach ( $cart_data as $cart_item_key => $cart_item ) {
149
+ $_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
 
151
+ $product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key );
152
 
153
+ $product_permalink = apply_filters( 'woocommerce_cart_item_permalink', $_product->is_visible() ? $_product->get_permalink( $cart_item ) : '', $cart_item, $cart_item_key );
154
 
155
 
156
+
157
+ $thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key );
 
 
 
158
 
159
+
160
+
161
+ if ( ! $product_permalink ) {
162
+ $product_name = apply_filters( 'woocommerce_cart_item_name', $_product->get_title(), $cart_item, $cart_item_key ) . '&nbsp;';
163
+ } else {
164
+ $product_name = apply_filters( 'woocommerce_cart_item_name', sprintf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $_product->get_title() ), $cart_item, $cart_item_key );
165
+ }
166
+
167
 
168
+ $product_price = apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key );
169
 
170
+ $product_subtotal = apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key );
 
 
 
171
 
172
+ //Variation
173
+ $attributes = wc_get_formatted_variation($_product);
174
+ // Meta data
175
+ $attributes .= WC()->cart->get_item_data( $cart_item );
176
 
177
+ ?>
178
+
179
+ <div class="xoo-wsc-product" data-xoo_wsc="<?php echo $cart_item_key; ?>">
180
  <div class="xoo-wsc-img-col">
181
+ <?php echo $thumbnail; ?>
182
+ <a href="#" class="xoo-wsc-remove"><?php _e('Remove','side-cart-woocommerce'); ?></a>
183
  </div>
184
  <div class="xoo-wsc-sum-col">
185
+ <a href="<?php echo $product_permalink ?>" class="xoo-wsc-pname"><?php echo $product_name; ?></a>
186
  <?php
187
 
188
+ if($attributes){
189
  echo $attributes;
190
+ }
191
 
192
  ?>
193
  <div class="xoo-wsc-price">
194
+ <span><?php echo $cart_item['quantity']; ?></span> X <span><?php echo $product_price; ?></span>
195
  <?php if($show_ptotal == 1): ?>
196
+ = <span><?php echo $product_subtotal; ?></span>
197
  <?php endif; ?>
198
  </div>
199
  </div>
200
  </div>
201
 
202
+ <?php } ?>
203
 
204
  <div class="xoo-wsc-subtotal">
205
+ <span><?php esc_attr_e($subtotal_txt,'side-cart-woocommerce') ?></span> <?php echo wc_price(WC()->cart->subtotal); ?>
206
  </div>
207
 
208
  <?php if(!empty($shipping_txt)): ?>
209
+ <span class="xoo-wsc-shiptxt"><?php esc_attr_e($shipping_txt,'side-cart-woocommerce'); ?></span>
210
  <?php endif; ?>
211
 
 
 
 
 
 
212
  <?php
213
  }
214
 
215
 
216
+
217
  /**
218
  * Add product to cart
219
  *
223
 
224
  public function add_to_cart(){
225
 
226
+ //Form Input Values
227
+ $product_data = json_decode(stripslashes($_POST['product_data']),true);
228
+ $product_id = intval($product_data['product_id']);
229
+ $variation_id = intval($product_data['variation_id']);
230
+ $quantity = empty( $product_data['quantity'] ) ? 1 : wc_stock_amount( $product_data['quantity'] );
231
+ $product = wc_get_product($product_id);
232
+ $variations = array();
233
+
234
+ if($variation_id){
235
+ $attributes = $product->get_attributes();
236
+ $variation_data = wc_get_product_variation_attributes($variation_id);
237
+ $chosen_attributes = json_decode(stripslashes($product_data['attributes']),true);
238
+
239
+ foreach($attributes as $attribute){
240
+
241
+ if ( ! $attribute['is_variation'] ) {
242
+ continue;
243
+ }
244
+
245
+ $taxonomy = 'attribute_' . sanitize_title( $attribute['name'] );
246
+
247
+
248
+ if ( isset( $chosen_attributes[ $taxonomy ] ) ) {
249
+
250
+ // Get value from post data
251
+ if ( $attribute['is_taxonomy'] ) {
252
+ // Don't use wc_clean as it destroys sanitized characters
253
+ $value = sanitize_title( stripslashes( $chosen_attributes[ $taxonomy ] ) );
254
+
255
+ } else {
256
+ $value = wc_clean( stripslashes( $chosen_attributes[ $taxonomy ] ) );
257
+
258
+ }
259
+
260
+ // Get valid value from variation
261
+ $valid_value = isset( $variation_data[ $taxonomy ] ) ? $variation_data[ $taxonomy ] : '';
262
+
263
+ // Allow if valid or show error.
264
+ if ( '' === $valid_value || $valid_value === $value ) {
265
+ $variations[ $taxonomy ] = $value;
266
+ }
267
+ }
268
 
269
+ }
270
+ $cart_success = WC()->cart->add_to_cart( $product_id, $quantity, $variation_id, $variations );
271
+ $variation = new WC_product_variation($variation_id);
272
+ $product_image = $variation->get_image();
273
  }
274
 
275
+ elseif($variation_id === 0){
 
 
 
 
 
 
 
 
 
 
276
  $cart_success = WC()->cart->add_to_cart($product_id,$quantity);
277
  }
278
 
304
 
305
  //If empty return error
306
  if(!$cart_key){
307
+ wp_send_json(array('error' => __('Something went wrong','side-cart-woocommerce')));
308
  }
309
 
310
  $cart_success = WC()->cart->set_quantity($cart_key,$new_qty);
public/class-xoo-wsc-public.php CHANGED
@@ -73,13 +73,30 @@ class xoo_wsc_Public {
73
  $scf_bm = isset( $options['scf-bm']) ? $options['scf-bm'] : 4; // buttons margin
74
 
75
  //Basket
76
- $bk_pos = isset( $options['bk-pos']) ? $options['bk-pos'] : 'bottom'; // Basket Position
77
  $bk_bbgc = isset( $options['bk-bbgc']) ? $options['bk-bbgc'] : '#ffffff'; // Basket Background Color
78
  $bk_bfc = isset( $options['bk-bfc']) ? $options['bk-bfc'] : '#000000'; // basket Icon Color
79
  $bk_bfs = isset( $options['bk-bfs']) ? $options['bk-bfs'] : 35; // Basket Icon size
80
  $bk_cbgc = isset( $options['bk-cbgc']) ? $options['bk-cbgc'] : '#cc0086'; // Count background Color
81
  $bk_cfc = isset( $options['bk-cfc']) ? $options['bk-cfc'] : '#ffffff'; // Count font color
82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  $inline_style = "
84
  .xoo-wsc-ctxt{
85
  font-size: {$sch_fs}px;
@@ -99,9 +116,12 @@ class xoo_wsc_Public {
99
  width: {$scb_sumw}%;
100
  }
101
  .xoo-wsc-basket{
102
- right: {$scb_cw}px;
103
  background-color: {$bk_bbgc};
104
- {$bk_pos}: 0;
 
 
 
 
105
  }
106
  .xoo-wsc-bki{
107
  color: {$bk_bfc};
@@ -148,13 +168,15 @@ class xoo_wsc_Public {
148
  }
149
 
150
  $shop_btn_class = isset( $av_options['shop-btn-class']) ? $av_options['shop-btn-class'] : '';
 
151
 
152
  wp_enqueue_script( $this->xoo_wsc, plugin_dir_url( __FILE__ ) . 'js/xoo-wsc-public.min.js', array( 'jquery' ), $this->version, false );
153
- wp_localize_script($this->xoo_wsc,'localize',array(
154
  'adminurl' => admin_url().'admin-ajax.php',
155
  'shop_btn' => $shop_btn_class,
156
  'ajax_atc' => $ajax_atc,
157
- 'added_to_cart' => $added_to_cart
 
158
  )
159
  );
160
  wp_dequeue_script('wc-add-to-cart');
73
  $scf_bm = isset( $options['scf-bm']) ? $options['scf-bm'] : 4; // buttons margin
74
 
75
  //Basket
76
+ $bk_pos = isset( $options['bk-pos']) ? $options['bk-pos'] : 'bottom_fixed'; // Basket Position
77
  $bk_bbgc = isset( $options['bk-bbgc']) ? $options['bk-bbgc'] : '#ffffff'; // Basket Background Color
78
  $bk_bfc = isset( $options['bk-bfc']) ? $options['bk-bfc'] : '#000000'; // basket Icon Color
79
  $bk_bfs = isset( $options['bk-bfs']) ? $options['bk-bfs'] : 35; // Basket Icon size
80
  $bk_cbgc = isset( $options['bk-cbgc']) ? $options['bk-cbgc'] : '#cc0086'; // Count background Color
81
  $bk_cfc = isset( $options['bk-cfc']) ? $options['bk-cfc'] : '#ffffff'; // Count font color
82
 
83
+ switch ($bk_pos) {
84
+ case 'top_fixed':
85
+ $bk_pos_type = 'fixed';
86
+ $bk_pos_dir = 'top';
87
+ break;
88
+
89
+ case 'bottom_fixed':
90
+ $bk_pos_type = 'fixed';
91
+ $bk_pos_dir = 'bottom';
92
+ break;
93
+
94
+ case 'top':
95
+ $bk_pos_type = 'absolute';
96
+ $bk_pos_dir = 'top';
97
+ break;
98
+ }
99
+
100
  $inline_style = "
101
  .xoo-wsc-ctxt{
102
  font-size: {$sch_fs}px;
116
  width: {$scb_sumw}%;
117
  }
118
  .xoo-wsc-basket{
 
119
  background-color: {$bk_bbgc};
120
+ {$bk_pos_dir}: 12px;
121
+ position: {$bk_pos_type};
122
+ }
123
+ .xoo-wsc-modal.xoo-wsc-active .xoo-wsc-basket{
124
+ right: {$scb_cw}px;
125
  }
126
  .xoo-wsc-bki{
127
  color: {$bk_bfc};
168
  }
169
 
170
  $shop_btn_class = isset( $av_options['shop-btn-class']) ? $av_options['shop-btn-class'] : '';
171
+ $auto_open_cart = isset( $gl_options['sc-auto-open']) ? $gl_options['sc-auto-open'] : 1;
172
 
173
  wp_enqueue_script( $this->xoo_wsc, plugin_dir_url( __FILE__ ) . 'js/xoo-wsc-public.min.js', array( 'jquery' ), $this->version, false );
174
+ wp_localize_script($this->xoo_wsc,'xoo_wsc_localize',array(
175
  'adminurl' => admin_url().'admin-ajax.php',
176
  'shop_btn' => $shop_btn_class,
177
  'ajax_atc' => $ajax_atc,
178
+ 'added_to_cart' => $added_to_cart,
179
+ 'auto_open_cart'=> $auto_open_cart
180
  )
181
  );
182
  wp_dequeue_script('wc-add-to-cart');
public/css/xoo-wsc-public.css CHANGED
@@ -1,6 +1,6 @@
1
- .xoo-wsc-basket,.xoo-wsc-close {
2
  cursor: pointer;
3
- position: absolute
4
  }
5
 
6
  @font-face {
@@ -115,7 +115,6 @@ body.xoo-wsc-active {
115
  background-color: #fff;
116
  top: 0;
117
  bottom: 0;
118
- transition: right .5s
119
  }
120
 
121
  .xoo-wsc-header {
@@ -128,7 +127,14 @@ body.xoo-wsc-active {
128
  padding: 10px;
129
  border-radius: 14px;
130
  margin: 10px;
131
- box-shadow: 0 1px 4px 0
 
 
 
 
 
 
 
132
  }
133
 
134
  .xoo-wsc-items-count {
@@ -167,6 +173,11 @@ body.xoo-wsc-active {
167
  text-align: center
168
  }
169
 
 
 
 
 
 
170
  a.xoo-wsc-remove {
171
  margin-top: 5px;
172
  display: inline-block;
@@ -212,7 +223,8 @@ a.xoo-wsc-pname {
212
  .xoo-wsc-footer,
213
  .xoo-wsc-footer a.button {
214
  width: 100%;
215
- text-align: center
 
216
  }
217
 
218
  .xoo-wsc-subtotal {
1
+ .xoo-wsc-close {
2
  cursor: pointer;
3
+ position: absolute;
4
  }
5
 
6
  @font-face {
115
  background-color: #fff;
116
  top: 0;
117
  bottom: 0;
 
118
  }
119
 
120
  .xoo-wsc-header {
127
  padding: 10px;
128
  border-radius: 14px;
129
  margin: 10px;
130
+ box-shadow: 0 1px 4px 0;
131
+ right: 0;
132
+ z-index: 999999;
133
+ cursor: pointer;
134
+ }
135
+
136
+ .xoo-wsc-basket , .xoo-wsc-container{
137
+ transition: right .5s;
138
  }
139
 
140
  .xoo-wsc-items-count {
173
  text-align: center
174
  }
175
 
176
+ .xoo-wsc-img-col img{
177
+ width: 100%;
178
+ height: 100%;
179
+ }
180
+
181
  a.xoo-wsc-remove {
182
  margin-top: 5px;
183
  display: inline-block;
223
  .xoo-wsc-footer,
224
  .xoo-wsc-footer a.button {
225
  width: 100%;
226
+ text-align: center;
227
+ display: inline-block;
228
  }
229
 
230
  .xoo-wsc-subtotal {
public/js/xoo-wsc-public.js CHANGED
@@ -8,7 +8,7 @@ jQuery(document).ready(function($){
8
  $('.xoo-wsc-basket').on('click',toggle_sidecart);
9
 
10
  //Auto open Side Cart when item added to cart without ajax
11
- if(localize.added_to_cart){
12
  toggle_sidecart();
13
  }
14
 
@@ -22,7 +22,10 @@ jQuery(document).ready(function($){
22
  })
23
  }
24
 
25
- $('.xoo-wsc-close , .xoo-wsc-opac , .xoo-wsc-cont').click(close_sidecart);
 
 
 
26
 
27
  //Set Cart content height
28
  function content_height(){
@@ -49,33 +52,42 @@ jQuery(document).ready(function($){
49
 
50
 
51
  //Add to cart function
52
- function add_to_cart(atc_btn,item_id,quantity){
53
  $.ajax({
54
- url: localize.adminurl,
55
  type: 'POST',
56
  data: {action: 'add_to_cart',
57
- item_id: item_id,
58
- quantity: quantity},
59
  success: function(response,status,jqXHR){
60
  atc_btn.find('.xoo-wsc-icon-atc').attr('class','xoo-wsc-icon-checkmark xoo-wsc-icon-atc');
61
- toggle_sidecart();
 
 
62
  on_cart_success(response);
63
  }
64
  })
65
  }
66
 
67
  function on_cart_success(response){
 
 
 
 
 
 
68
  $('.xoo-wsc-content').html(response.cart_markup);
69
  $('.xoo-wsc-items-count').html(response.items_count);
70
  content_height();
71
- refresh_ajax_fragm(response.ajax_fragm);
 
 
72
  }
73
 
74
  //Update cart
75
  function update_cart(cart_key,new_qty){
76
  $('.xoo-wsc-updating').show();
77
  $.ajax({
78
- url: localize.adminurl,
79
  type: 'POST',
80
  data: {
81
  action: 'update_cart',
@@ -100,7 +112,7 @@ jQuery(document).ready(function($){
100
  })
101
 
102
  //Add to cart on single page
103
- if(localize.ajax_atc == 1){
104
  $(document).on('submit','form.cart',function(e){
105
  e.preventDefault();
106
  var atc_btn = $(this).find('.single_add_to_cart_button');
@@ -111,24 +123,33 @@ jQuery(document).ready(function($){
111
  atc_btn.append('<span class="xoo-wsc-icon-spinner xoo-wsc-icon-atc xoo-wsc-active"></span>');
112
  }
113
 
114
- var is_variation = $(this).find('[name=variation_id]');
115
- if(is_variation.length > 0){
116
- var item_id = parseInt($(this).find('[name=variation_id]').val());
117
- }
118
- else{
119
- var item_id = parseInt($(this).find('[name=add-to-cart]').val());
120
- }
121
-
122
  var quantity = parseInt($(this).find('.quantity').find('.qty').val());
 
 
 
 
 
 
 
 
 
 
 
 
123
 
124
- add_to_cart(atc_btn,item_id,quantity);//Ajax add to cart
 
 
 
125
  })
126
  }
127
 
128
  //Add to cart on shop page
129
  var shop_btn_default = '.add_to_cart_button';
130
- if(localize.shop_btn){
131
- var shop_btn = shop_btn_default+', '+localize.shop_btn;
132
  }
133
  else{
134
  var shop_btn = shop_btn_default;
@@ -148,9 +169,11 @@ jQuery(document).ready(function($){
148
  }
149
 
150
 
151
- var item_id = atc_btn.data('product_id');
152
- var quantity = 1;
153
- add_to_cart(atc_btn,item_id,quantity);//Ajax add to cart
 
 
154
  })
155
 
156
 
8
  $('.xoo-wsc-basket').on('click',toggle_sidecart);
9
 
10
  //Auto open Side Cart when item added to cart without ajax
11
+ if(xoo_wsc_localize.added_to_cart){
12
  toggle_sidecart();
13
  }
14
 
22
  })
23
  }
24
 
25
+ $('.xoo-wsc-close , .xoo-wsc-opac , .xoo-wsc-cont').click(function(e){
26
+ e.preventDefault();
27
+ close_sidecart(e);
28
+ });
29
 
30
  //Set Cart content height
31
  function content_height(){
52
 
53
 
54
  //Add to cart function
55
+ function add_to_cart(atc_btn,product_data){
56
  $.ajax({
57
+ url: xoo_wsc_localize.adminurl,
58
  type: 'POST',
59
  data: {action: 'add_to_cart',
60
+ product_data: product_data},
 
61
  success: function(response,status,jqXHR){
62
  atc_btn.find('.xoo-wsc-icon-atc').attr('class','xoo-wsc-icon-checkmark xoo-wsc-icon-atc');
63
+ if(xoo_wsc_localize.auto_open_cart == 1){
64
+ toggle_sidecart();
65
+ }
66
  on_cart_success(response);
67
  }
68
  })
69
  }
70
 
71
  function on_cart_success(response){
72
+ if(response.items_count === 0){
73
+ $('a.xoo-wsc-chkt,a.xoo-wsc-cart').hide();
74
+ }
75
+ else{
76
+ $('a.xoo-wsc-chkt,a.xoo-wsc-cart').show();
77
+ }
78
  $('.xoo-wsc-content').html(response.cart_markup);
79
  $('.xoo-wsc-items-count').html(response.items_count);
80
  content_height();
81
+
82
+ if(response.ajax_fragm)
83
+ refresh_ajax_fragm(response.ajax_fragm);
84
  }
85
 
86
  //Update cart
87
  function update_cart(cart_key,new_qty){
88
  $('.xoo-wsc-updating').show();
89
  $.ajax({
90
+ url: xoo_wsc_localize.adminurl,
91
  type: 'POST',
92
  data: {
93
  action: 'update_cart',
112
  })
113
 
114
  //Add to cart on single page
115
+ if(xoo_wsc_localize.ajax_atc == 1){
116
  $(document).on('submit','form.cart',function(e){
117
  e.preventDefault();
118
  var atc_btn = $(this).find('.single_add_to_cart_button');
123
  atc_btn.append('<span class="xoo-wsc-icon-spinner xoo-wsc-icon-atc xoo-wsc-active"></span>');
124
  }
125
 
126
+ var variation_id = parseInt($(this).find('[name=variation_id]').val());
127
+ var product_id = parseInt($(this).find('[name=add-to-cart]').val());
 
 
 
 
 
 
128
  var quantity = parseInt($(this).find('.quantity').find('.qty').val());
129
+ var product_data = {};
130
+
131
+ if(variation_id){
132
+ var attributes_select = $(this).find('.variations select');
133
+ var attributes = {};
134
+ attributes_select.each(function(){
135
+ attributes[$(this).data('attribute_name')] = $(this).val();
136
+ })
137
+ attributes = JSON.stringify(attributes);
138
+ product_data['attributes'] = attributes;
139
+ product_data['variation_id'] =variation_id;
140
+ }
141
 
142
+ product_data['product_id'] = product_id;
143
+ product_data['quantity'] = quantity;
144
+
145
+ add_to_cart(atc_btn,JSON.stringify(product_data));//Ajax add to cart
146
  })
147
  }
148
 
149
  //Add to cart on shop page
150
  var shop_btn_default = '.add_to_cart_button';
151
+ if(xoo_wsc_localize.shop_btn){
152
+ var shop_btn = shop_btn_default+', '+xoo_wsc_localize.shop_btn;
153
  }
154
  else{
155
  var shop_btn = shop_btn_default;
169
  }
170
 
171
 
172
+ var product_data = {};
173
+ product_data['product_id'] = atc_btn.data('product_id');
174
+ product_data['quantity'] = 1;
175
+
176
+ add_to_cart(atc_btn,JSON.stringify(product_data));//Ajax add to cart
177
  })
178
 
179
 
public/js/xoo-wsc-public.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(a){"use strict";function b(){a(".xoo-wsc-modal , body").toggleClass("xoo-wsc-active")}function c(b){a.each(b.target.classList,function(b,c){"xoo-wsc-container"==c||"xoo-wsc-close"!=c&&"xoo-wsc-opac"!=c&&"xoo-wsc-basket"!=c&&"xoo-wsc-cont"!=c||a(".xoo-wsc-modal , body").removeClass("xoo-wsc-active")})}function d(){var b=a(".xoo-wsc-header").outerHeight(),c=a(".xoo-wsc-footer").outerHeight(),d=a(window).height();a(".xoo-wsc-body").outerHeight(d-(b+c))}function e(b){var e=(b.fragments,b.cart_hash,b.fragments["div.widget_shopping_cart_content"]);a(".woofc-trigger").css("transform","scale(1)"),a(".shopping-cart-inner").html(e);var f=a(".cart_list:first").find("li").length;a(".shopping-cart span.counter , ul.woofc-count li").html(f)}function f(c,d,e){a.ajax({url:localize.adminurl,type:"POST",data:{action:"add_to_cart",item_id:d,quantity:e},success:function(a,d,e){c.find(".xoo-wsc-icon-atc").attr("class","xoo-wsc-icon-checkmark xoo-wsc-icon-atc"),b(),g(a)}})}function g(b){a(".xoo-wsc-content").html(b.cart_markup),a(".xoo-wsc-items-count").html(b.items_count),d(),e(b.ajax_fragm)}function h(b,c){a(".xoo-wsc-updating").show(),a.ajax({url:localize.adminurl,type:"POST",data:{action:"update_cart",cart_key:b,new_qty:c},success:function(b){g(b),a(".xoo-wsc-updating").hide()}})}a(".xoo-wsc-basket").on("click",b),localize.added_to_cart&&b(),a(".xoo-wsc-close , .xoo-wsc-opac , .xoo-wsc-cont").click(c),d(),a(window).resize(function(){d()}),a(document).on("click",".xoo-wsc-remove",function(b){b.preventDefault(),h(a(this).parents(".xoo-wsc-product").data("xoo_wsc"),0)}),1==localize.ajax_atc&&a(document).on("submit","form.cart",function(b){b.preventDefault();var c=a(this).find(".single_add_to_cart_button");if(0!==c.find(".xoo-wsc-icon-atc").length?c.find(".xoo-wsc-icon-atc").attr("class","xoo-wsc-icon-spinner xoo-wsc-icon-atc xoo-wsc-active"):c.append('<span class="xoo-wsc-icon-spinner xoo-wsc-icon-atc xoo-wsc-active"></span>'),a(this).find("[name=variation_id]").length>0)var e=parseInt(a(this).find("[name=variation_id]").val());else var e=parseInt(a(this).find("[name=add-to-cart]").val());f(c,e,parseInt(a(this).find(".quantity").find(".qty").val()))});var i=".add_to_cart_button";if(localize.shop_btn)var j=i+", "+localize.shop_btn;else var j=i;a(j).on("click",function(b){var c=a(this);if(!c.hasClass("product_type_variable")){b.preventDefault(),0!==c.find(".xoo-wsc-icon-atc").length?c.find(".xoo-wsc-icon-atc").attr("class","xoo-wsc-icon-spinner xoo-wsc-icon-atc xoo-wsc-active"):c.append('<span class="xoo-wsc-icon-spinner xoo-wsc-icon-atc xoo-wsc-active"></span>');f(c,c.data("product_id"),1)}})});
1
+ jQuery(document).ready(function(o){"use strict";function t(){o(".xoo-wsc-modal , body").toggleClass("xoo-wsc-active")}function c(t){o.each(t.target.classList,function(t,c){"xoo-wsc-container"==c||"xoo-wsc-close"!=c&&"xoo-wsc-opac"!=c&&"xoo-wsc-basket"!=c&&"xoo-wsc-cont"!=c||o(".xoo-wsc-modal , body").removeClass("xoo-wsc-active")})}function a(){var t=o(".xoo-wsc-header").outerHeight(),c=o(".xoo-wsc-footer").outerHeight(),a=o(window).height();o(".xoo-wsc-body").outerHeight(a-(t+c))}function n(t){t.fragments,t.cart_hash;var c=t.fragments["div.widget_shopping_cart_content"];o(".woofc-trigger").css("transform","scale(1)"),o(".shopping-cart-inner").html(c);var a=o(".cart_list:first").find("li").length;o(".shopping-cart span.counter , ul.woofc-count li").html(a)}function s(c,a){o.ajax({url:xoo_wsc_localize.adminurl,type:"POST",data:{action:"add_to_cart",product_data:a},success:function(o,a,n){c.find(".xoo-wsc-icon-atc").attr("class","xoo-wsc-icon-checkmark xoo-wsc-icon-atc"),1==xoo_wsc_localize.auto_open_cart&&t(),i(o)}})}function i(t){0===t.items_count?o("a.xoo-wsc-chkt,a.xoo-wsc-cart").hide():o("a.xoo-wsc-chkt,a.xoo-wsc-cart").show(),o(".xoo-wsc-content").html(t.cart_markup),o(".xoo-wsc-items-count").html(t.items_count),a(),t.ajax_fragm&&n(t.ajax_fragm)}function e(t,c){o(".xoo-wsc-updating").show(),o.ajax({url:xoo_wsc_localize.adminurl,type:"POST",data:{action:"update_cart",cart_key:t,new_qty:c},success:function(t){i(t),o(".xoo-wsc-updating").hide()}})}o(".xoo-wsc-basket").on("click",t),xoo_wsc_localize.added_to_cart&&t(),o(".xoo-wsc-close , .xoo-wsc-opac , .xoo-wsc-cont").click(function(o){o.preventDefault(),c(o)}),a(),o(window).resize(function(){a()}),o(document).on("click",".xoo-wsc-remove",function(t){t.preventDefault(),e(o(this).parents(".xoo-wsc-product").data("xoo_wsc"),0)}),1==xoo_wsc_localize.ajax_atc&&o(document).on("submit","form.cart",function(t){t.preventDefault();var c=o(this).find(".single_add_to_cart_button");0!==c.find(".xoo-wsc-icon-atc").length?c.find(".xoo-wsc-icon-atc").attr("class","xoo-wsc-icon-spinner xoo-wsc-icon-atc xoo-wsc-active"):c.append('<span class="xoo-wsc-icon-spinner xoo-wsc-icon-atc xoo-wsc-active"></span>');var a=parseInt(o(this).find("[name=variation_id]").val()),n=parseInt(o(this).find("[name=add-to-cart]").val()),i=parseInt(o(this).find(".quantity").find(".qty").val()),e={};if(a){var r={};o(this).find(".variations select").each(function(){r[o(this).data("attribute_name")]=o(this).val()}),r=JSON.stringify(r),e.attributes=r,e.variation_id=a}e.product_id=n,e.quantity=i,s(c,JSON.stringify(e))});if(xoo_wsc_localize.shop_btn)r=".add_to_cart_button, "+xoo_wsc_localize.shop_btn;else var r=".add_to_cart_button";o(r).on("click",function(t){var c=o(this);if(!c.hasClass("product_type_variable")){t.preventDefault(),0!==c.find(".xoo-wsc-icon-atc").length?c.find(".xoo-wsc-icon-atc").attr("class","xoo-wsc-icon-spinner xoo-wsc-icon-atc xoo-wsc-active"):c.append('<span class="xoo-wsc-icon-spinner xoo-wsc-icon-atc xoo-wsc-active"></span>');var a={};a.product_id=c.data("product_id"),a.quantity=1,s(c,JSON.stringify(a))}})});
public/partials/xoo-wsc-markup.php CHANGED
@@ -12,29 +12,30 @@ $sy_options = get_option('xoo-wsc-sy-options');
12
 
13
  $show_basket = isset( $options['bk-show-basket']) ? $options['bk-show-basket'] : 1; //Show Basket
14
  $show_count = isset( $options['bk-show-bkcount']) ? $options['bk-show-bkcount'] : 1; //Show Count
15
- $head_title = isset($options['sc-head-text']) ? $options['sc-head-text']: __("Your Cart",XOO_WSC_DOMAIN); //Head Title
16
- $cart_txt = isset($options['sc-cart-text']) ? $options['sc-cart-text'] : __("View Cart",XOO_WSC_DOMAIN); //Cart Text
17
- $chk_txt = isset($options['sc-checkout-text']) ? $options['sc-checkout-text']: __("Checkout",XOO_WSC_DOMAIN); //Checkout Text
18
- $cont_txt = isset($options['sc-continue-text']) ? $options['sc-continue-text'] :__( "Continue Shopping",XOO_WSC_DOMAIN); //Continue Text
19
  ?>
20
 
21
  <div class="xoo-wsc-modal">
 
 
 
 
 
 
 
 
 
 
 
 
22
  <div class="xoo-wsc-opac"></div>
23
  <div class="xoo-wsc-container">
24
 
25
- <?php if($show_basket == 1): ?>
26
- <div class="xoo-wsc-basket">
27
- <?php if($show_count == 1):
28
- $count_value = WC()->cart->get_cart_contents_count();
29
- ?>
30
- <span class="xoo-wsc-items-count"><?php echo $count_value ?></span>
31
- <?php endif; ?>
32
- <span class="xoo-wsc-icon-basket1 xoo-wsc-bki"></span>
33
- </div>
34
- <?php endif; ?>
35
-
36
  <div class="xoo-wsc-header">
37
- <span class="xoo-wsc-ctxt"><?php echo $head_title; ?></span>
38
  <span class="xoo-wsc-icon-cross xoo-wsc-close"></span>
39
  </div>
40
  <div class="xoo-wsc-body">
@@ -51,16 +52,18 @@ $cont_txt = isset($options['sc-continue-text']) ? $options['sc-continue-text']
51
 
52
  <div class="xoo-wsc-footer">
53
 
 
 
54
  <?php if(!empty($cart_txt)): ?>
55
- <a href="<?php echo WC()->cart->get_cart_url(); ?>" class="button xoo-wsc-chkt"><?php echo esc_attr($cart_txt); ?></a>
56
  <?php endif; ?>
57
 
58
  <?php if(!empty($chk_txt)): ?>
59
- <a href="<?php echo WC()->cart->get_checkout_url(); ?>" class="button xoo-wsc-cart"><?php echo esc_attr($chk_txt); ?></a>
60
  <?php endif; ?>
61
 
62
  <?php if(!empty($cont_txt)): ?>
63
- <a href="#" class="button xoo-wsc-cont"><?php echo esc_attr($cont_txt); ?></a>
64
  <?php endif; ?>
65
 
66
  </div>
12
 
13
  $show_basket = isset( $options['bk-show-basket']) ? $options['bk-show-basket'] : 1; //Show Basket
14
  $show_count = isset( $options['bk-show-bkcount']) ? $options['bk-show-bkcount'] : 1; //Show Count
15
+ $head_title = isset($options['sc-head-text']) ? $options['sc-head-text']: __("Your Cart",'side-cart-woocommerce'); //Head Title
16
+ $cart_txt = isset($options['sc-cart-text']) ? $options['sc-cart-text'] : __("View Cart",'side-cart-woocommerce'); //Cart Text
17
+ $chk_txt = isset($options['sc-checkout-text']) ? $options['sc-checkout-text']: __("Checkout",'side-cart-woocommerce'); //Checkout Text
18
+ $cont_txt = isset($options['sc-continue-text']) ? $options['sc-continue-text'] :__( "Continue Shopping",'side-cart-woocommerce'); //Continue Text
19
  ?>
20
 
21
  <div class="xoo-wsc-modal">
22
+
23
+ <?php if($show_basket == 1): ?>
24
+ <div class="xoo-wsc-basket">
25
+ <?php if($show_count == 1):
26
+ $count_value = WC()->cart->get_cart_contents_count();
27
+ ?>
28
+ <span class="xoo-wsc-items-count"><?php echo $count_value ?></span>
29
+ <?php endif; ?>
30
+ <span class="xoo-wsc-icon-basket1 xoo-wsc-bki"></span>
31
+ </div>
32
+ <?php endif; ?>
33
+
34
  <div class="xoo-wsc-opac"></div>
35
  <div class="xoo-wsc-container">
36
 
 
 
 
 
 
 
 
 
 
 
 
37
  <div class="xoo-wsc-header">
38
+ <span class="xoo-wsc-ctxt"><?php esc_attr_e($head_title,'side-cart-woocommerce'); ?></span>
39
  <span class="xoo-wsc-icon-cross xoo-wsc-close"></span>
40
  </div>
41
  <div class="xoo-wsc-body">
52
 
53
  <div class="xoo-wsc-footer">
54
 
55
+ <?php $hide_btns = WC()->cart->is_empty() ? 'style="display: none;"' : '';?>
56
+
57
  <?php if(!empty($cart_txt)): ?>
58
+ <a href="<?php echo WC()->cart->get_cart_url(); ?>" class="button xoo-wsc-chkt btn" <?php echo $hide_btns; ?>><?php echo esc_attr__($cart_txt,'side-cart-woocommerce'); ?></a>
59
  <?php endif; ?>
60
 
61
  <?php if(!empty($chk_txt)): ?>
62
+ <a href="<?php echo WC()->cart->get_checkout_url(); ?>" class="button xoo-wsc-cart btn" <?php echo $hide_btns; ?>><?php echo esc_attr__($chk_txt,'side-cart-woocommerce'); ?></a>
63
  <?php endif; ?>
64
 
65
  <?php if(!empty($cont_txt)): ?>
66
+ <a href="#" class="button xoo-wsc-cont btn"><?php echo esc_attr__($cont_txt,'side-cart-woocommerce'); ?></a>
67
  <?php endif; ?>
68
 
69
  </div>
xoo-wsc.php CHANGED
@@ -7,15 +7,15 @@
7
  * @package Side Cart WooCommerce
8
  *
9
  * @wordpress-plugin
10
- * Plugin Name: WooCommerce Side Cart
11
  * Plugin URI: http://xotix.com
12
  * Description: Woo Side Cart shows all the items added to cart in a side popup.The plugin is ajax based.
13
- * Version: 1.0.0
14
  * Author: XootiX
15
  * Author URI: http://xootix.com/
16
  * License: GPL-2.0+
17
  * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
18
- * Text Domain: xoo-wsc
19
  * Domain Path: /languages
20
  */
21
 
@@ -90,12 +90,8 @@ add_action('plugins_loaded','xoo_wsc_init');
90
  function xoo_wsc_install_wc_notice(){
91
  ?>
92
  <div class="error">
93
- <p><?php _e( 'Side Cart WooCommerce is enabled but not effective. It requires WooCommerce in order to work.', XOO_WSC_DOMAIN ); ?></p>
94
  </div>
95
  <?php
96
  }
97
 
98
- //Domain name
99
- if ( ! defined( 'XOO_WSC_DOMAIN' ) ){
100
- define( 'XOO_WSC_DOMAIN', 'xoo-wsc' );
101
- }
7
  * @package Side Cart WooCommerce
8
  *
9
  * @wordpress-plugin
10
+ * Plugin Name: WooCommerce Cart
11
  * Plugin URI: http://xotix.com
12
  * Description: Woo Side Cart shows all the items added to cart in a side popup.The plugin is ajax based.
13
+ * Version: 1.0.1
14
  * Author: XootiX
15
  * Author URI: http://xootix.com/
16
  * License: GPL-2.0+
17
  * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
18
+ * Text Domain: side-cart-woocommerce
19
  * Domain Path: /languages
20
  */
21
 
90
  function xoo_wsc_install_wc_notice(){
91
  ?>
92
  <div class="error">
93
+ <p><?php _e( 'Side Cart WooCommerce is enabled but not effective. It requires WooCommerce in order to work.', 'side-cart-woocommerce' ); ?></p>
94
  </div>
95
  <?php
96
  }
97