Side Cart Woocommerce (Ajax) - Version 1.0.0

Version Description

Download this release

Release Info

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

Version 1.0.0

README.txt ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
11
+ Adds a site wide basket icon that displays all added items in the side cart with proceed to checkout button.
12
+
13
+ == Description ==
14
+ [Live Demo](http://demo.xootix.com/side-cart-for-woocommerce/)
15
+ Side Cart WooCommerce adds a site wide basket icon that displays the number of products in the cart.
16
+ Customer can see all the cart items directly from the side cart & also remove items.
17
+ Plugin has ajax add to cart feature on single product pages too.
18
+
19
+
20
+
21
+ ### Features And Options:
22
+ * Works for all types of products.
23
+ * See all added items in side cart.
24
+ * Proceed to Checkout Button.
25
+ * Remove added items without refreshing page.
26
+ * Choose your own position for cart icon.
27
+ * Fully Customizable.
28
+
29
+ == Installation ==
30
+
31
+ 1. Upload the plugin files to the `/wp-content/plugins/plugin-name` directory, or install the plugin through the WordPress plugins screen directly.
32
+ 2. Activate the plugin through the 'Plugins' screen in WordPress
33
+ 3. Click on Woo Side Cart on the dashboard.
34
+
35
+ == Frequently Asked Questions ==
36
+
37
+ = How to setup? =
38
+
39
+ Everything is already setup.Just activate the plugin & you are done.
40
+
41
+ == Screenshots ==
42
+ 1. Front End.
43
+ 2. General Settings 1
44
+ 3. General Settings 2
45
+ 4. Style Settings 1
46
+ 5. Style Settings 2
47
+
48
+ == Changelog ==
49
+ = 1.0.0 =
50
+ * Initial Public Release.
51
+
admin/class-xoo-wsc-admin.php ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The admin-specific functionality of the plugin.
4
+ *
5
+ * Defines the plugin name, version, and two examples hooks for how to
6
+ * enqueue the admin-specific stylesheet and JavaScript.
7
+ *
8
+ * @package WooCommerce Side Cart
9
+ */
10
+ class xoo_wsc_Admin {
11
+
12
+ /**
13
+ * The ID of this plugin.
14
+ *
15
+ * @since 1.0.0
16
+ * @access private
17
+ * @var string $xoo_wsc The ID of this plugin.
18
+ */
19
+ private $xoo_wsc;
20
+
21
+ /**
22
+ * The version of this plugin.
23
+ *
24
+ * @since 1.0.0
25
+ * @access private
26
+ * @var string $version The current version of this plugin.
27
+ */
28
+ private $version;
29
+
30
+ public $plugin_settings_tabs = array();
31
+ /**
32
+ * Initialize the class and set its properties.
33
+ *
34
+ * @since 1.0.0
35
+ * @param string $xoo_wsc The name of this plugin.
36
+ * @param string $version The version of this plugin.
37
+ */
38
+ public function __construct( $xoo_wsc, $version ) {
39
+
40
+ $this->xoo_wsc = $xoo_wsc;
41
+ $this->version = $version;
42
+
43
+ $this->plugin_settings_tabs['general'] = 'General';
44
+ $this->plugin_settings_tabs['style'] = 'Style';
45
+ $this->plugin_settings_tabs['advanced'] = 'Advanced';
46
+ }
47
+
48
+ /**
49
+ * Register the stylesheets for the admin area.
50
+ *
51
+ * @since 1.0.0
52
+ */
53
+ public function enqueue_styles($hook) {
54
+
55
+ //Enqueue Styles only on plugin settings page
56
+ if($hook != 'toplevel_page_xoo-wsc'){
57
+ return;
58
+ }
59
+ wp_enqueue_style('wp-color-picker');
60
+ wp_enqueue_style( $this->xoo_wsc, plugin_dir_url( __FILE__ ) . 'css/xoo-wsc-admin.css', array(), $this->version, 'all' );
61
+
62
+ }
63
+
64
+ /**
65
+ * Register the JavaScript for the admin area.
66
+ *
67
+ * @since 1.0.0
68
+ */
69
+ public function enqueue_scripts($hook) {
70
+
71
+ //Enqueue Script only on plugin settings page
72
+ if($hook != 'toplevel_page_xoo-wsc'){
73
+ return;
74
+ }
75
+ wp_enqueue_script( $this->xoo_wsc, plugin_dir_url( __FILE__ ) . 'js/xoo-wsc-admin.js', array( 'jquery','wp-color-picker'), $this->version, false );
76
+
77
+ }
78
+
79
+ /**
80
+ * Register the Settings page.
81
+ *
82
+ * @since 1.0.0
83
+ */
84
+ public function admin_menu() {
85
+
86
+ add_menu_page( __('Woo Side Cart', $this->xoo_wsc), __('Woo Side Cart', $this->xoo_wsc), 'manage_options', $this->xoo_wsc, array($this, 'display_plugin_admin_page'),'dashicons-cart', 61);
87
+
88
+ }
89
+
90
+ /**
91
+ * Settings - Validates saved options
92
+ *
93
+ * @since 1.0.0
94
+ * @param array $input array of submitted plugin options
95
+ * @return array array of validated plugin options
96
+ */
97
+ public function settings_sanitize( $input ) {
98
+
99
+ // Initialize the new array that will hold the sanitize values
100
+ $new_input = array();
101
+
102
+ if(isset($input)) {
103
+ // Loop through the input and sanitize each of the values
104
+ foreach ( $input as $key => $val ) {
105
+
106
+ $new_input[ $key ] = sanitize_text_field( $val );
107
+
108
+ }
109
+
110
+ }
111
+
112
+ return $new_input;
113
+
114
+ } // sanitize()
115
+
116
+
117
+ /**
118
+ * Renders Settings Tabs
119
+ *
120
+ * @since 1.0.0
121
+ * @return mixed The settings field
122
+ */
123
+ function render_tabs() {
124
+ $current_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'general';
125
+
126
+ echo '<h2 class="nav-tab-wrapper">';
127
+ foreach ( $this->plugin_settings_tabs as $tab_key => $tab_caption ) {
128
+ $active = $current_tab == $tab_key ? 'nav-tab-active' : '';
129
+ echo '<a class="nav-tab ' . $active . '" href="?page=' . $this->xoo_wsc . '&tab=' . $tab_key . '">' . $tab_caption . '</a>';
130
+ }
131
+ echo '</h2>';
132
+ }
133
+
134
+ /**
135
+ * Plugin Settings Link on plugin page
136
+ *
137
+ * @since 1.0.0
138
+ * @return mixed The settings field
139
+ */
140
+ function add_settings_link( $links ) {
141
+
142
+ $mylinks = array(
143
+ '<a href="' . admin_url( 'options-general.php?page=wsc' ) . '">Settings</a>',
144
+ );
145
+ return array_merge( $links, $mylinks );
146
+ }
147
+
148
+
149
+ /**
150
+ * Callback function for the admin settings page.
151
+ *
152
+ * @since 1.0.0
153
+ */
154
+ public function display_plugin_admin_page(){
155
+
156
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/partials/xoo-wsc-admin-display.php';
157
+ }
158
+
159
+ /**
160
+ * Section function markup
161
+ *
162
+ * @since 1.0.0
163
+ */
164
+ public function get_section_markup($title){
165
+ echo '<span class="section-title">'.$title.'</span>';
166
+
167
+ }
168
+
169
+
170
+ }
admin/class-xoo-wsc-general-settings.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Admin Part of Plugin, dashboard and options.
5
+ *
6
+ * @package xoo_wsc
7
+ * @subpackage xoo_wsc/admin
8
+ */
9
+ class xoo_wsc_General_Settings extends xoo_wsc_Admin {
10
+
11
+ /**
12
+ * The ID of this plugin.
13
+ *
14
+ * @since 1.0.0
15
+ * @access private
16
+ * @var string $xoo_wsc The ID of this plugin.
17
+ */
18
+ private $xoo_wsc;
19
+
20
+ /**
21
+ * The ID of General Settings.
22
+ *
23
+ * @since 1.0.0
24
+ * @access private
25
+ * @var string $group The ID of General Settings.
26
+ */
27
+ private $group;
28
+
29
+ /**
30
+ * Initialize the class and set its properties.
31
+ *
32
+ * @since 1.0.0
33
+ * @var string $xoo_wsc The name of this plugin.
34
+ * @var string $version The version of this plugin.
35
+ */
36
+ public function __construct( $xoo_wsc ) {
37
+
38
+ $this->xoo_wsc = $xoo_wsc;
39
+ $this->group = $xoo_wsc.'_gl';
40
+ }
41
+
42
+ /**
43
+ * Creates our settings sections with fields etc.
44
+ *
45
+ * @since 1.0.0
46
+ */
47
+ public function settings_api_init(){
48
+
49
+ // register_setting( $option_group, $option_name, $settings_sanitize_callback );
50
+ register_setting(
51
+ $this->group . '_options',
52
+ $this->group . '_options',
53
+ array( $this, 'settings_sanitize' )
54
+ );
55
+
56
+ // add_settings_section( $id, $title, $callback, $menu_slug );
57
+ add_settings_section(
58
+ $this->group . '-sc-options', // section
59
+ '',
60
+ array( $this, 'sc_options_section' ),
61
+ $this->group
62
+ );
63
+
64
+ // add_settings_field( $id, $title, $callback, $menu_slug, $section, $args );
65
+ add_settings_field(
66
+ 'auto-open-sc',
67
+ __( 'Auto Open', $this->xoo_wsc ),
68
+ array( $this, 'auto_open_sc' ),
69
+ $this->group,
70
+ $this->group . '-sc-options' // section to add to
71
+ );
72
+
73
+ add_settings_field(
74
+ 'head-txt-sc',
75
+ __( 'Head Title', $this->xoo_wsc ),
76
+ array( $this, 'head_txt_sc' ),
77
+ $this->group,
78
+ $this->group . '-sc-options' // Cart Text
79
+ );
80
+
81
+
82
+ }
83
+
84
+ /**
85
+ * Creates a settings section
86
+ *
87
+ * @since 1.0.0
88
+ * @param array $params Array of parameters for the section
89
+ * @return mixed The settings section
90
+ */
91
+ public function sc_options_section() {
92
+ $this->get_section_markup('Side Cart');
93
+
94
+ } // display_options_section()
95
+
96
+
97
+ /**
98
+ * Enable Bar Field
99
+ *
100
+ * @since 1.0.0
101
+ * @return mixed The settings field
102
+ */
103
+ public function auto_open_sc() {
104
+ $options = get_option( $this->group . '_options' );
105
+ $option = 0;
106
+
107
+ if ( ! empty( $options['auto-open-sc'] ) ) {
108
+
109
+ $option = $options['auto-open-sc'];
110
+
111
+ }
112
+
113
+ ?><input type="checkbox" id="<?php echo $this->group; ?>_options[auto-open-sc]" name="<?php echo $this->group; ?>_options[auto-open-sc]" value="1" <?php checked( $option, 1 , true ); ?> />
114
+ <p class="description">Disabling bar is also disabling front end loading of scripts css/js.</p> <?php
115
+ }
116
+
117
+
118
+ /**
119
+ * Head Title
120
+ *
121
+ * @since 1.0.0
122
+ * @return mixed The settings field
123
+ */
124
+ public function head_txt_sc() {
125
+ $options = get_option( $this->group . '_options' );
126
+ $option = 0;
127
+
128
+ if ( ! empty( $options['head-txt-sc'] ) ) {
129
+
130
+ $option = $options['head-txt-sc'];
131
+
132
+ }
133
+
134
+ ?><input type="checkbox" id="<?php echo $this->group; ?>_options[head-txt-sc]" name="<?php echo $this->group; ?>_options[head-txt-sc]" value="1" <?php checked( $option, 1 , true ); ?> />
135
+ <p class="description">Disabling bar is also disabling front end loading of scripts css/js.</p> <?php
136
+ }
137
+ }
admin/css/xoo-wsc-admin.css ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * All of the CSS for your admin-specific functionality should be
3
+ * included in this file.
4
+ */
5
+ .section-title{
6
+ display: block;
7
+ font-weight: 600;
8
+ text-transform: uppercase;
9
+ padding-bottom: 5px;
10
+ font-size: 17px;
11
+ margin: 0 -10px;
12
+ padding: 8px;
13
+ background-color: #333333;
14
+ color: #ffffff;
15
+ }
16
+ .xoo-main{
17
+ background-color: #ffffff;
18
+ padding: 0 10px;
19
+ width: 72%;
20
+ float: left;
21
+ max-width: 845px;
22
+ }
23
+ .xoo-container {
24
+ margin-top: 12px;
25
+ }
26
+ input[name="xoo_wsc_gl_options[sc-shipping-text]"]{
27
+ width: 500px;
28
+ }
29
+ table.form-table{
30
+ margin-bottom: 20px;
31
+ }
32
+
33
+ /*sidebar*/
34
+ .xoo-sidebar{
35
+ width: 18%;
36
+ margin-top: 2px;
37
+ padding: 10px;
38
+ box-shadow: 1px 1px 3px 0px;
39
+ text-align: center;
40
+ margin-left: 10px;
41
+ display: table;
42
+ min-width: 165px;
43
+ float: left;
44
+ margin-left: 50px;
45
+ }
46
+ .xoo-chhead{
47
+ margin-bottom: 10px;
48
+ display: block;
49
+ font-size: 20px;
50
+ }
51
+ .xoo-chicon{
52
+ height: 34px;
53
+ width: 34px;
54
+ font-size: 34px;
55
+ }
56
+ .xoo-chtxt {
57
+ font-size: 16px;
58
+ margin-right: 24px;
59
+ line-height: 25px;
60
+ }
61
+ .xoo-more-plugins{
62
+ margin-top: 4px;
63
+ }
64
+ /* End sidebar */
65
+
66
+ @media only screen and (max-width: 1130px) {
67
+ .xoo-main{
68
+ width: 95%;
69
+ max-width: 100%;
70
+ }
71
+
72
+ .xoo-sidebar{
73
+ margin-top: 20px;
74
+ margin-left: 0;
75
+ }
76
+ }
admin/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
admin/js/xoo-wsc-admin.js ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ (function( $ ) {
2
+ 'use strict';
3
+
4
+ //Initialize Color Picker
5
+ $(function(){
6
+ $('.color-field').wpColorPicker();
7
+ });
8
+
9
+ })( jQuery );
admin/partials/xoo-wsc-admin-display.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Provide a dashboard view for the plugin
5
+ *
6
+ * This file is used to markup the public-facing aspects of the plugin.
7
+ *
8
+ * @since 1.0.0
9
+ *
10
+ * @package xoo-wsc
11
+ * @subpackage xoo-wsc/admin/partials
12
+ */
13
+ ?>
14
+ <?php
15
+ ?>
16
+ <div class="wrap">
17
+ <?php
18
+ $tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'general';
19
+ $this->render_tabs();
20
+ ?>
21
+
22
+ <div class="xoo-container">
23
+ <div class="xoo-main">
24
+ <?php
25
+ switch ($tab) {
26
+ case 'style': ?>
27
+ <form method="post" action="options.php">
28
+ <?php
29
+ settings_fields( 'xoo-wsc-sy-options' ); // Display Settings
30
+
31
+ do_settings_sections( 'xoo-wsc-sy' ); // Display Sections
32
+
33
+ submit_button( 'Save Settings' ); // Display Save Button
34
+ ?>
35
+ </form>
36
+ <?php
37
+ break;
38
+ case 'advanced':
39
+ ?>
40
+ <form method="post" action="options.php">
41
+
42
+ <?php
43
+ settings_fields( 'xoo-wsc-av-options' );
44
+
45
+ do_settings_sections( 'xoo-wsc-av' );
46
+
47
+ submit_button( 'Save Settings' );
48
+ ?>
49
+ </form>
50
+ <?php
51
+ break;
52
+ default:
53
+ ?>
54
+ <form method="post" action="options.php">
55
+ <div class="inside">
56
+ <?php
57
+ settings_fields( 'xoo-wsc-gl-options' );
58
+
59
+ do_settings_sections( 'xoo-wsc-gl' );
60
+
61
+ submit_button( 'Save Settings' );
62
+ ?>
63
+ <div class="clear"></div>
64
+ </form>
65
+ <?php
66
+ }
67
+ ?>
68
+ </div>
69
+ </div>
70
+
71
+ <div class="xoo-sidebar">
72
+ <div class="xoo-chat">
73
+ <span class="xoo-chhead">Need Help?</span>
74
+ <span class="dashicons dashicons-format-chat xoo-chicon"></span>
75
+ <span class="xoo-chtxt">Use <a href="http://xootix.com">Live Chat</a></span>
76
+ </div>
77
+ <a href="http://xootix.com" class="xoo-more-plugins">Try other awesome plugins.</a>
78
+ </div>
79
+ </div>
80
+
81
+
82
+
admin/settings/class-xoo-wsc-advanced-settings.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Admin Part of Plugin, dashboard and options.
5
+ *
6
+ * @package WooCommerce Side Cart
7
+ */
8
+ class xoo_wsc_Advanced_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 Advanced 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.'-av';
39
+ }
40
+
41
+ /**
42
+ * Creates our settings sections with fields etc.
43
+ *
44
+ * @since 1.0.0
45
+ */
46
+ public function settings_api_init(){
47
+
48
+ // register_setting( $option_group, $option_name, $settings_sanitize_callback );
49
+ register_setting(
50
+ $this->group . '-options',
51
+ $this->group . '-options',
52
+ array( $this, 'settings_sanitize' )
53
+ );
54
+
55
+ // add_settings_section( $id, $title, $callback, $menu_slug );
56
+ add_settings_section(
57
+ $this->group . '-options', // section
58
+ '',
59
+ array( $this, 'options_section' ),
60
+ $this->group // Advanced Section
61
+ );
62
+
63
+
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
71
+ );
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
79
+ );
80
+
81
+ }
82
+
83
+ /**
84
+ * Creates a settings section
85
+ *
86
+ * @since 1.0.0
87
+ * @return mixed The settings section
88
+ */
89
+ public function options_section() {}
90
+
91
+ /**
92
+ * Custom CSS
93
+ *
94
+ * @since 1.0.0
95
+ * @return mixed The settings field
96
+ */
97
+ public function custom_css() {
98
+
99
+ $options = get_option( $this->group . '-options' );
100
+ $option = isset( $options['custom-css']) ? $options['custom-css'] : '';
101
+
102
+ ?>
103
+ <textarea name="<?php echo $this->group; ?>-options[custom-css]" cols="80" rows="20" placeholder="/* Place your custom CSS here */"><?php echo $option; ?></textarea>
104
+ <?php
105
+ }
106
+
107
+
108
+ /**
109
+ * Shop Button Class
110
+ *
111
+ * @since 1.0.0
112
+ * @return mixed The settings field
113
+ */
114
+ public function shop_btn_class() {
115
+
116
+ $options = get_option( $this->group . '-options' );
117
+ $option = isset( $options['shop-btn-class']) ? $options['shop-btn-class'] : '';
118
+
119
+ ?>
120
+ <input type="text" name="<?php echo $this->group; ?>-options[shop-btn-class]" value="<?php echo $option; ?> ">
121
+ <?php
122
+ }
123
+ }
admin/settings/class-xoo-wsc-general-settings.php ADDED
@@ -0,0 +1,434 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Admin Part of Plugin, dashboard and options.
5
+ *
6
+ * @package WooCommerce Side Cart
7
+ */
8
+ class xoo_wsc_General_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 General Settings.
21
+ *
22
+ * @since 1.0.0
23
+ * @access private
24
+ * @var string $group The ID of General 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.'-gl';
39
+ }
40
+
41
+ /**
42
+ * Creates our settings sections with fields etc.
43
+ *
44
+ * @since 1.0.0
45
+ */
46
+ public function settings_api_init(){
47
+
48
+ // register_setting( $option_group, $option_name, $settings_sanitize_callback );
49
+ register_setting(
50
+ $this->group . '-options',
51
+ $this->group . '-options',
52
+ array( $this, 'settings_sanitize' )
53
+ );
54
+
55
+ // add_settings_section( $id, $title, $callback, $menu_slug );
56
+ add_settings_section(
57
+ $this->group . '-sc-options', // section
58
+ '',
59
+ array( $this, 'sc_options_section' ),
60
+ $this->group // Side Cart Section
61
+ );
62
+
63
+ add_settings_section(
64
+ $this->group . '-bk-options', // section
65
+ '',
66
+ array( $this, 'bk_options_section' ),
67
+ $this->group // Cart Basket Section
68
+ );
69
+
70
+ /*
71
+ =============================================
72
+ ============= Side Cart Fields ==============
73
+ =============================================
74
+ */
75
+
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
83
+ );
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
91
+ );
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
99
+ );
100
+
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
108
+ );
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
116
+ );
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
124
+ );
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
+ =============================================
162
+ ============= Cart Basket Fields ============
163
+ =============================================
164
+ */
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
172
+ );
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
180
+ );
181
+ }
182
+
183
+ /**
184
+ * Creates a settings section
185
+ *
186
+ * @since 1.0.0
187
+ * @return mixed The settings section
188
+ */
189
+ public function sc_options_section() {
190
+ $this->get_section_markup('Side Cart');
191
+
192
+ }
193
+
194
+
195
+ /**
196
+ * Creates a basket section
197
+ *
198
+ * @since 1.0.0
199
+ * @return mixed The settings section
200
+ */
201
+ public function bk_options_section() {
202
+ $this->get_section_markup('Cart Basket');
203
+ }
204
+
205
+
206
+ /*
207
+ =============================================
208
+ ============= Side Cart Section =============
209
+ =============================================
210
+ */
211
+
212
+ /**
213
+ * Enable Bar Field
214
+ *
215
+ * @since 1.0.0
216
+ * @return mixed The settings field
217
+ */
218
+ public function sc_auto_open() {
219
+
220
+ $options = get_option( $this->group . '-options' );
221
+ $option = isset( $options['sc-auto-open']) ? $options['sc-auto-open'] : 1;
222
+ $id = $this->group.'-options[sc-auto-open]';
223
+ ?>
224
+ <input type="hidden" name="<?php echo $id; ?>" value="false">
225
+ <input type="checkbox" id="<?php echo $id; ?>" name="<?php echo $id; ?>" value="1" <?php checked($option, 1); ?> />
226
+ <label for="<?php echo $id; ?>">Auto open side cart when item is added to cart.</label> <?php
227
+ }
228
+
229
+ /**
230
+ * Enable Ajax add to cart
231
+ *
232
+ * @since 1.0.0
233
+ * @return mixed The settings field
234
+ */
235
+ public function sc_ajax_atc() {
236
+
237
+ $options = get_option( $this->group . '-options' );
238
+ $option = isset( $options['sc-ajax-atc']) ? $options['sc-ajax-atc'] : 1;
239
+ $id = $this->group.'-options[sc-ajax-atc]';
240
+ ?>
241
+ <input type="hidden" name="<?php echo $id; ?>" value="false">
242
+ <input type="checkbox" id="<?php echo $id; ?>" name="<?php echo $id; ?>" value="1" <?php checked($option, 1); ?> />
243
+ <label for="<?php echo $id; ?>">Add to cart without page refresh.</label> <?php
244
+ }
245
+
246
+
247
+ /**
248
+ * Head Title
249
+ *
250
+ * @since 1.0.0
251
+ * @return mixed The settings field
252
+ */
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]" />
260
+ <?php
261
+ }
262
+
263
+
264
+
265
+
266
+ /**
267
+ * Shipping text
268
+ *
269
+ * @since 1.0.0
270
+ * @return mixed The settings field
271
+ */
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]" />
279
+ <?php
280
+ }
281
+
282
+
283
+ /**
284
+ * Cart text
285
+ *
286
+ * @since 1.0.0
287
+ * @return mixed The settings field
288
+ */
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]" />
296
+ <?php
297
+ }
298
+
299
+ /**
300
+ * Checkout text
301
+ *
302
+ * @since 1.0.0
303
+ * @return mixed The settings field
304
+ */
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]" />
312
+ <?php
313
+ }
314
+
315
+
316
+ /**
317
+ * Continue text
318
+ *
319
+ * @since 1.0.0
320
+ * @return mixed The settings field
321
+ */
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]" />
329
+ <?php
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
+ /**
353
+ * Product Total
354
+ *
355
+ * @since 1.0.0
356
+ * @return mixed The settings field
357
+ */
358
+ public function sc_show_ptotal() {
359
+
360
+ $options = get_option( $this->group . '-options' );
361
+ $option = isset( $options['sc-show-ptotal']) ? $options['sc-show-ptotal'] : 1;
362
+ $id = $this->group.'-options[sc-show-ptotal]';
363
+ ?>
364
+ <input type="hidden" name="<?php echo $id; ?>" value="false">
365
+ <input type="checkbox" id="<?php echo $id; ?>" name="<?php echo $id; ?>" value="1" <?php checked($option, 1); ?> />
366
+ <label for="<?php echo $id; ?>">Show Product Total.</label>
367
+ <?php
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 ============
393
+ =============================================
394
+ */
395
+
396
+
397
+ /**
398
+ * Enable Cart Basket
399
+ *
400
+ * @since 1.0.0
401
+ * @return mixed The settings field
402
+ */
403
+ public function bk_show_basket() {
404
+
405
+ $options = get_option( $this->group . '-options' );
406
+ $option = isset( $options['bk-show-basket']) ? $options['bk-show-basket'] : 1;
407
+ $id = $this->group.'-options[bk-show-basket]';
408
+ ?>
409
+ <input type="hidden" name="<?php echo $id; ?>" value="false">
410
+ <input type="checkbox" id="<?php echo $id; ?>" name="<?php echo $id; ?>" value="1" <?php checked($option, 1); ?> />
411
+ <label for="<?php echo $id; ?>">Show Cart Basket.</label>
412
+ <?php
413
+ }
414
+
415
+
416
+ /**
417
+ * Product Count
418
+ *
419
+ * @since 1.0.0
420
+ * @return mixed The settings field
421
+ */
422
+ public function bk_show_bkcount() {
423
+
424
+ $options = get_option( $this->group . '-options' );
425
+ $option = isset( $options['bk-show-bkcount']) ? $options['bk-show-bkcount'] : 1;
426
+ $id = $this->group.'-options[bk-show-bkcount]';
427
+ ?>
428
+ <input type="hidden" name="<?php echo $id; ?>" value="false">
429
+ <input type="checkbox" id="<?php echo $id; ?>" name="<?php echo $id; ?>" value="1" <?php checked($option, 1); ?> />
430
+ <label for="<?php echo $id; ?>">Show Product Count.</label>
431
+ <?php
432
+ }
433
+
434
+ }
admin/settings/class-xoo-wsc-style-settings.php ADDED
@@ -0,0 +1,444 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Admin Part of Plugin, dashboard and options.
5
+ *
6
+ * @package WooCommerce Side Cart
7
+ */
8
+ class xoo_wsc_Style_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 General Settings.
21
+ *
22
+ * @since 1.0.0
23
+ * @access private
24
+ * @var string $group The ID of General 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.'-sy';
39
+ }
40
+
41
+ /**
42
+ * Creates our settings sections with fields etc.
43
+ *
44
+ * @since 1.0.0
45
+ */
46
+ public function settings_api_init(){
47
+
48
+ // register_setting( $option_group, $option_name, $settings_sanitize_callback );
49
+ register_setting(
50
+ $this->group . '-options',
51
+ $this->group . '-options',
52
+ array( $this, 'settings_sanitize' )
53
+ );
54
+
55
+ // add_settings_section( $id, $title, $callback, $menu_slug );
56
+ add_settings_section(
57
+ $this->group . '-sc-options', // section
58
+ '',
59
+ array( $this, 'sc_options_section' ),
60
+ $this->group // Side Cart - Head Section
61
+ );
62
+
63
+
64
+ add_settings_section(
65
+ $this->group . '-bk-options', // section
66
+ '',
67
+ array( $this, 'bk_options_section' ),
68
+ $this->group // Cart Basket Section
69
+ );
70
+
71
+ /*
72
+ =============================================
73
+ ============= Side Cart - Head ==============
74
+ =============================================
75
+ */
76
+
77
+ // add_settings_field( $id, $title, $callback, $menu_slug, $section, $args );
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
85
+ );
86
+
87
+ /*
88
+ =============================================
89
+ ============= Side Cart - Body ==============
90
+ =============================================
91
+ */
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
99
+ );
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
107
+ );
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
115
+ );
116
+
117
+
118
+ /*
119
+ =============================================
120
+ ============ Side Cart - Footer =============
121
+ =============================================
122
+ */
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
130
+ );
131
+
132
+
133
+ /*
134
+ =============================================
135
+ =============== Cart Basket =================
136
+ =============================================
137
+ */
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
145
+ );
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
153
+ );
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
161
+ );
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
169
+ );
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
177
+ );
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
185
+ );
186
+
187
+ }
188
+
189
+ /**
190
+ * Creates a settings section
191
+ *
192
+ * @since 1.0.0
193
+ * @return mixed The settings section
194
+ */
195
+ public function sc_options_section() {
196
+ $this->get_section_markup('Side Cart');
197
+
198
+ }
199
+
200
+ /**
201
+ * Creates a basket section
202
+ *
203
+ * @since 1.0.0
204
+ * @return mixed The settings section
205
+ */
206
+ public function bk_options_section() {
207
+ $this->get_section_markup('Cart Basket');
208
+ }
209
+
210
+
211
+ /*
212
+ =============================================
213
+ ========= Side Cart - Head Section ==========
214
+ =============================================
215
+ */
216
+
217
+ /**
218
+ * Head- font Size
219
+ *
220
+ * @since 1.0.0
221
+ * @return mixed The settings field
222
+ */
223
+ public function sch_fs() {
224
+
225
+ $options = get_option( $this->group . '-options' );
226
+ $option = isset( $options['sch-fs']) ? $options['sch-fs'] : 25;
227
+ $id = $this->group.'-options[sch-fs]';
228
+ ?>
229
+ <input type="number" id="<?php echo $id; ?>" name="<?php echo $id; ?>" value="<?php echo $option; ?>" />
230
+ <span class="description">Size in px (Default: 25)</span>
231
+ <?php
232
+ }
233
+
234
+
235
+ /**
236
+ * Head- Close Cart Icon Size
237
+ *
238
+ * @since 1.0.0
239
+ * @return mixed The settings field
240
+ */
241
+ public function sch_cis() {
242
+
243
+ $options = get_option( $this->group . '-options' );
244
+ $option = isset( $options['sch-cis']) ? $options['sch-cis'] : 20;
245
+ $id = $this->group.'-options[sch-cis]';
246
+ ?>
247
+ <input type="number" id="<?php echo $id; ?>" name="<?php echo $id; ?>" value="<?php echo $option; ?>" />
248
+ <span class="description">Size in px (Default: 20)</span>
249
+ <?php
250
+ }
251
+
252
+
253
+ /*
254
+ =============================================
255
+ ========= Side Cart - Body Section ==========
256
+ =============================================
257
+ */
258
+
259
+ /**
260
+ * Container Width
261
+ *
262
+ * @since 1.0.0
263
+ * @return mixed The settings field
264
+ */
265
+ public function scb_cw() {
266
+
267
+ $options = get_option( $this->group . '-options' );
268
+ $option = !empty( $options['scb-cw']) ? $options['scb-cw'] : 300;
269
+ $id = $this->group.'-options[scb-cw]';
270
+ ?>
271
+ <input type="number" id="<?php echo $id; ?>" name="<?php echo $id; ?>" value="<?php echo $option; ?>" />
272
+ <span class="description">Size in px (Default: 300)</span>
273
+ <?php
274
+ }
275
+
276
+
277
+ /**
278
+ * Body- font Size
279
+ *
280
+ * @since 1.0.0
281
+ * @return mixed The settings field
282
+ */
283
+ public function scb_fs() {
284
+
285
+ $options = get_option( $this->group . '-options' );
286
+ $option = isset( $options['scb-fs']) ? $options['scb-fs'] : 14;
287
+ $id = $this->group.'-options[scb-fs]';
288
+ ?>
289
+ <input type="number" id="<?php echo $id; ?>" name="<?php echo $id; ?>" value="<?php echo $option; ?>" />
290
+ <span class="description">Size in px (Default: 25)</span>
291
+ <?php
292
+ }
293
+
294
+
295
+ /**
296
+ * Body- Product Images Width
297
+ *
298
+ * @since 1.0.0
299
+ * @return mixed The settings field
300
+ */
301
+ public function scb_imgw() {
302
+
303
+ $options = get_option( $this->group . '-options' );
304
+ $option = isset( $options['scb-imgw']) ? $options['scb-imgw'] : 35;
305
+ $id = $this->group.'-options[scb-imgw]';
306
+ ?>
307
+ <input type="number" id="<?php echo $id; ?>" name="<?php echo $id; ?>" value="<?php echo $option; ?>" />
308
+ <span class="description">Width in percentage. (Default: 35)</span>
309
+ <?php
310
+ }
311
+
312
+ /*
313
+ =============================================
314
+ ========= Side Cart - Footer Section ==========
315
+ =============================================
316
+ */
317
+
318
+
319
+ /**
320
+ * Footer- Buttons Margin
321
+ *
322
+ * @since 1.0.0
323
+ * @return mixed The settings field
324
+ */
325
+ public function scf_bm() {
326
+
327
+ $options = get_option( $this->group . '-options' );
328
+ $option = isset( $options['scf-bm']) ? $options['scf-bm'] : 4;
329
+ $id = $this->group.'-options[scf-bm]';
330
+ ?>
331
+ <input type="number" id="<?php echo $id; ?>" name="<?php echo $id; ?>" value="<?php echo $option; ?>" />
332
+ <span class="description">Size in px (Default: 4)</span>
333
+ <?php
334
+ }
335
+
336
+ /*
337
+ =============================================
338
+ ============= Cart Basket - Section =========
339
+ =============================================
340
+ */
341
+
342
+ /**
343
+ * Basket Position
344
+ *
345
+ * @since 1.0.0
346
+ * @return mixed The settings field
347
+ */
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
+
360
+
361
+ /**
362
+ * Basket Background Color
363
+ *
364
+ * @since 1.0.0
365
+ * @return mixed The settings field
366
+ */
367
+ public function bk_bbgc() {
368
+
369
+ $options = get_option( $this->group . '-options' );
370
+ $option = isset( $options['bk-bbgc']) ? $options['bk-bbgc'] : '#ffffff';
371
+ $id = $this->group.'-options[bk-bbgc]';
372
+ ?>
373
+ <input type="text" class="color-field" id="<?php echo $id; ?>" name="<?php echo $id; ?>" value="<?php echo $option; ?>" />
374
+ <?php
375
+ }
376
+
377
+
378
+ /**
379
+ * Basket Icon Color
380
+ *
381
+ * @since 1.0.0
382
+ * @return mixed The settings field
383
+ */
384
+ public function bk_bfc() {
385
+
386
+ $options = get_option( $this->group . '-options' );
387
+ $option = isset( $options['bk-bfc']) ? $options['bk-bfc'] : '#000000';
388
+ $id = $this->group.'-options[bk-bfc]';
389
+ ?>
390
+ <input type="text" class="color-field" id="<?php echo $id; ?>" name="<?php echo $id; ?>" value="<?php echo $option; ?>" />
391
+ <?php
392
+ }
393
+
394
+ /**
395
+ * Basket Icon Size
396
+ *
397
+ * @since 1.0.0
398
+ * @return mixed The settings field
399
+ */
400
+ public function bk_bfs() {
401
+
402
+ $options = get_option( $this->group . '-options' );
403
+ $option = isset( $options['bk-bfs']) ? $options['bk-bfs'] : 35;
404
+ $id = $this->group.'-options[bk-bfs]';
405
+ ?>
406
+ <input type="number" id="<?php echo $id; ?>" name="<?php echo $id; ?>" value="<?php echo $option; ?>" />
407
+ <span class="description">Size in px (Default: 35)</span>
408
+ <?php
409
+ }
410
+
411
+ /**
412
+ * Count BG Color
413
+ *
414
+ * @since 1.0.0
415
+ * @return mixed The settings field
416
+ */
417
+ public function bk_cbgc() {
418
+
419
+ $options = get_option( $this->group . '-options' );
420
+ $option = isset( $options['bk-cbgc']) ? $options['bk-cbgc'] : '#cc0086';
421
+ $id = $this->group.'-options[bk-cbgc]';
422
+ ?>
423
+ <input type="text" class="color-field" id="<?php echo $id; ?>" name="<?php echo $id; ?>" value="<?php echo $option; ?>" />
424
+ <?php
425
+ }
426
+
427
+
428
+ /**
429
+ * Count Text Color
430
+ *
431
+ * @since 1.0.0
432
+ * @return mixed The settings field
433
+ */
434
+ public function bk_cfc() {
435
+
436
+ $options = get_option( $this->group . '-options' );
437
+ $option = isset( $options['bk-cfc']) ? $options['bk-cfc'] : '#ffffff';
438
+ $id = $this->group.'-options[bk-cfc]';
439
+ ?>
440
+ <input type="text" class="color-field" id="<?php echo $id; ?>" name="<?php echo $id; ?>" value="<?php echo $option; ?>" />
441
+ <?php
442
+ }
443
+
444
+ }
includes/class-xoo-wsc-activator.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Fired during plugin activation.
4
+ *
5
+ * This class defines all code necessary to run during the plugin's activation.
6
+ *
7
+ * @since 1.0.0
8
+ * @package Side Cart WooCommerce
9
+ */
10
+ class xoo_wsc_Activator {
11
+
12
+ /**
13
+ * Disable woocommerce ajax add to cart option.
14
+ *
15
+ * Store user setting for "Enable ajax add to cart" in an option & disable ajax add to cart.
16
+ *
17
+ * @since 1.0.0
18
+ */
19
+ public static function activate() {
20
+ $ajax_atc = get_option('woocommerce_enable_ajax_add_to_cart');
21
+ update_option('xoo_wsc_ajax_atc_default',$ajax_atc);
22
+ if($ajax_atc == 'yes'){
23
+ update_option('woocommerce_enable_ajax_add_to_cart','no');
24
+ }
25
+ }
26
+
27
+ }
includes/class-xoo-wsc-deactivator.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Fired during plugin deactivation.
4
+ *
5
+ * This class defines all code necessary to run during the plugin's deactivation.
6
+ *
7
+ * @since 1.0.0
8
+ * @package Side Cart WooCommerce
9
+ */
10
+ class xoo_wsc_Deactivator {
11
+
12
+ /**
13
+ * Reset option "Enable ajax add to cart" option to default user choice
14
+ *
15
+ * @since 1.0.0
16
+ */
17
+ public static function deactivate() {
18
+ $user_atc = get_option('xoo_wsc_ajax_atc_default');
19
+ update_option('woocommerce_enable_ajax_add_to_cart',$user_atc);
20
+ }
21
+
22
+ }
includes/class-xoo-wsc-i18n.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Define the internationalization functionality.
4
+ *
5
+ * Loads and defines the internationalization files for this plugin
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
+
13
+ /**
14
+ * Load the plugin text domain for translation.
15
+ *
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
+ }
includes/class-xoo-wsc-loader.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Register all actions and filters for the plugin
5
+ *
6
+ * Maintain a list of all hooks that are registered throughout
7
+ * the plugin, and register them with the WordPress API. Call the
8
+ * run function to execute the list of actions and filters.
9
+ *
10
+ */
11
+ class xoo_wsc_Loader {
12
+
13
+ /**
14
+ * The array of actions registered with WordPress.
15
+ *
16
+ * @since 1.0.0
17
+ * @access protected
18
+ * @var array $actions The actions registered with WordPress to fire when the plugin loads.
19
+ */
20
+ protected $actions;
21
+
22
+ /**
23
+ * The array of filters registered with WordPress.
24
+ *
25
+ * @since 1.0.0
26
+ * @access protected
27
+ * @var array $filters The filters registered with WordPress to fire when the plugin loads.
28
+ */
29
+ protected $filters;
30
+
31
+ /**
32
+ * Initialize the collections used to maintain the actions and filters.
33
+ *
34
+ * @since 1.0.0
35
+ */
36
+ public function __construct() {
37
+
38
+ $this->actions = array();
39
+ $this->filters = array();
40
+
41
+ }
42
+
43
+ /**
44
+ * Add a new action to the collection to be registered with WordPress.
45
+ *
46
+ * @since 1.0.0
47
+ * @param string $hook The name of the WordPress action that is being registered.
48
+ * @param object $component A reference to the instance of the object on which the action is defined.
49
+ * @param string $callback The name of the function definition on the $component.
50
+ * @param int $priority Optional. he priority at which the function should be fired. Default is 10.
51
+ * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1.
52
+ */
53
+ public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
54
+ $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
55
+ }
56
+
57
+ /**
58
+ * Add a new filter to the collection to be registered with WordPress.
59
+ *
60
+ * @since 1.0.0
61
+ * @param string $hook The name of the WordPress filter that is being registered.
62
+ * @param object $component A reference to the instance of the object on which the filter is defined.
63
+ * @param string $callback The name of the function definition on the $component.
64
+ * @param int $priority Optional. he priority at which the function should be fired. Default is 10.
65
+ * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1
66
+ */
67
+ public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
68
+ $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
69
+ }
70
+
71
+ /**
72
+ * A utility function that is used to register the actions and hooks into a single
73
+ * collection.
74
+ *
75
+ * @since 1.0.0
76
+ * @access private
77
+ * @param array $hooks The collection of hooks that is being registered (that is, actions or filters).
78
+ * @param string $hook The name of the WordPress filter that is being registered.
79
+ * @param object $component A reference to the instance of the object on which the filter is defined.
80
+ * @param string $callback The name of the function definition on the $component.
81
+ * @param int $priority The priority at which the function should be fired.
82
+ * @param int $accepted_args The number of arguments that should be passed to the $callback.
83
+ * @return array The collection of actions and filters registered with WordPress.
84
+ */
85
+ private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
86
+
87
+ $hooks[] = array(
88
+ 'hook' => $hook,
89
+ 'component' => $component,
90
+ 'callback' => $callback,
91
+ 'priority' => $priority,
92
+ 'accepted_args' => $accepted_args
93
+ );
94
+
95
+ return $hooks;
96
+
97
+ }
98
+
99
+ /**
100
+ * Register the filters and actions with WordPress.
101
+ *
102
+ * @since 1.0.0
103
+ */
104
+ public function run() {
105
+
106
+ foreach ( $this->filters as $hook ) {
107
+ add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
108
+ }
109
+
110
+ foreach ( $this->actions as $hook ) {
111
+ add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
112
+ }
113
+
114
+ }
115
+
116
+ }
includes/class-xoo-wsc.php ADDED
@@ -0,0 +1,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The core plugin class.
4
+ *
5
+ * This is used to define internationalization, admin-specific hooks, and
6
+ * public-facing site hooks.
7
+ *
8
+ * Also maintains the unique identifier of this plugin as well as the current
9
+ * version of the plugin.
10
+ *
11
+ * @since 1.0.0
12
+ */
13
+ class xoo_wsc {
14
+
15
+ /**
16
+ * The loader that's responsible for maintaining and registering all hooks that power
17
+ * the plugin.
18
+ *
19
+ * @since 1.0.0
20
+ * @access protected
21
+ * @var $loader Maintains and registers all hooks for the plugin.
22
+ */
23
+ protected $loader;
24
+
25
+ /**
26
+ * The unique identifier of this plugin.
27
+ *
28
+ * @since 1.0.0
29
+ * @access protected
30
+ * @var string $xoo_wsc The string used to uniquely identify this plugin.
31
+ */
32
+ protected $xoo_wsc;
33
+
34
+ /**
35
+ * The current version of the plugin.
36
+ *
37
+ * @since 1.0.0
38
+ * @access protected
39
+ * @var string $version The current version of the plugin.
40
+ */
41
+ protected $version;
42
+
43
+ /**
44
+ * Define the core functionality of the plugin.
45
+ *
46
+ * Set the plugin name and the plugin version that can be used throughout the plugin.
47
+ * Load the dependencies, define the locale, and set the hooks for the admin area and
48
+ * the public-facing side of the site.
49
+ *
50
+ * @since 1.0.0
51
+ */
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();
59
+ $this->define_admin_hooks();
60
+ $this->define_public_hooks();
61
+
62
+ }
63
+
64
+ /**
65
+ * Load the required dependencies for this plugin.
66
+ *
67
+ * Include the following files that make up the plugin:
68
+ *
69
+ * - xoo_wsc_Loader. Orchestrates the hooks of the plugin.
70
+ * - xoo_wsc_i18n. Defines internationalization functionality.
71
+ * - xoo_wsc_Admin. Defines all hooks for the admin area.
72
+ * - xoo_wsc_Public. Defines all hooks for the public side of the site.
73
+ *
74
+ * Create an instance of the loader which will be used to register the hooks
75
+ * with WordPress.
76
+ *
77
+ * @since 1.0.0
78
+ * @access private
79
+ */
80
+ private function load_dependencies() {
81
+
82
+ /**
83
+ * The class responsible for orchestrating the actions and filters of the
84
+ * core plugin.
85
+ */
86
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xoo-wsc-loader.php';
87
+
88
+ /**
89
+ * The class responsible for defining internationalization functionality
90
+ * of the plugin.
91
+ */
92
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xoo-wsc-i18n.php';
93
+
94
+ /**
95
+ * The class responsible for defining all actions that occur in the admin area.
96
+ */
97
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-xoo-wsc-admin.php';
98
+
99
+ /**
100
+ * The class responsible for defining all General Settings.
101
+ */
102
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/settings/class-xoo-wsc-general-settings.php';
103
+
104
+
105
+ /**
106
+ * The class responsible for defining all Style Settings.
107
+ */
108
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/settings/class-xoo-wsc-style-settings.php';
109
+
110
+ /**
111
+ * The class responsible for defining all Advanced Settings.
112
+ */
113
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/settings/class-xoo-wsc-advanced-settings.php';
114
+
115
+
116
+ /**
117
+ * The class responsible for defining all actions that occur in the public-facing
118
+ * side of the site.
119
+ */
120
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-xoo-wsc-public.php';
121
+
122
+ /**
123
+ * The class responsible for showing side cart data
124
+ */
125
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-xoo-wsc-cart-data.php';
126
+
127
+ $this->loader = new xoo_wsc_Loader();
128
+
129
+ }
130
+
131
+ /**
132
+ * Define the locale for this plugin for internationalization.
133
+ *
134
+ * Uses the xoo_wsc_i18n class in order to set the domain and to register the hook
135
+ * with WordPress.
136
+ *
137
+ * @since 1.0.0
138
+ * @access private
139
+ */
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
+
148
+ /**
149
+ * Register all of the hooks related to the admin area functionality
150
+ * of the plugin.
151
+ *
152
+ * @since 1.0.0
153
+ * @access private
154
+ */
155
+ private function define_admin_hooks() {
156
+
157
+ $plugin_admin = new xoo_wsc_Admin( $this->get_xoo_wsc(), $this->get_version() );
158
+ $settings_init_general = new xoo_wsc_General_Settings( $this->get_xoo_wsc() ); // Initialize General Settings
159
+ $settings_init_style = new xoo_wsc_Style_Settings( $this->get_xoo_wsc() ); // Initialize Style Settings
160
+ $settings_init_advanced = new xoo_wsc_Advanced_Settings( $this->get_xoo_wsc() ); // Initialize Advanced Settings
161
+
162
+
163
+ $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
164
+ $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
165
+ $this->loader->add_action( 'admin_menu', $plugin_admin, 'admin_menu' );
166
+ $this->loader->add_action( 'admin_init', $settings_init_general, 'settings_api_init' );
167
+ $this->loader->add_action( 'admin_init', $settings_init_style, 'settings_api_init' );
168
+ $this->loader->add_action( 'admin_init', $settings_init_advanced, 'settings_api_init' );
169
+
170
+ }
171
+
172
+ /**
173
+ * Register all of the hooks related to the public-facing functionality
174
+ * of the plugin.
175
+ *
176
+ * @since 1.0.0
177
+ * @access private
178
+ */
179
+ private function define_public_hooks() {
180
+
181
+ $plugin_public = new xoo_wsc_Public( $this->get_xoo_wsc(), $this->get_version() );
182
+ $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
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');
190
+ $this->loader->add_action('wp_ajax_update_cart',$get_cart,'update_cart');
191
+ $this->loader->add_action('wp_ajax_nopriv_update_cart',$get_cart,'update_cart');
192
+ }
193
+ }
194
+
195
+ /**
196
+ * Run the loader to execute all of the hooks with WordPress.
197
+ *
198
+ * @since 1.0.0
199
+ */
200
+ public function run() {
201
+ $this->loader->run();
202
+ }
203
+
204
+ /**
205
+ * The name of the plugin used to uniquely identify it within the context of
206
+ * WordPress and to define internationalization functionality.
207
+ *
208
+ * @since 1.0.0
209
+ * @return string The name of the plugin.
210
+ */
211
+ public function get_xoo_wsc() {
212
+ return $this->xoo_wsc;
213
+ }
214
+
215
+ /**
216
+ * The reference to the class that orchestrates the hooks with the plugin.
217
+ *
218
+ * @since 1.0.0
219
+ * @return xoo_wsc_Loader Orchestrates the hooks of the plugin.
220
+ */
221
+ public function get_loader() {
222
+ return $this->loader;
223
+ }
224
+
225
+ /**
226
+ * Retrieve the version number of the plugin.
227
+ *
228
+ * @since 1.0.0
229
+ * @return string The version number of the plugin.
230
+ */
231
+ public function get_version() {
232
+ return $this->version;
233
+ }
234
+
235
+ }
includes/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
languages/xoo-wsc.pot ADDED
@@ -0,0 +1,239 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,342 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class xoo_wsc_Cart_Data{
3
+ /**
4
+ * The ID of this plugin.
5
+ *
6
+ * @since 1.0.0
7
+ * @access private
8
+ * @var string $xoo_wsc The ID of this plugin.
9
+ */
10
+ private $xoo_wsc;
11
+
12
+ /**
13
+ * Initialize the class and set its properties.
14
+ *
15
+ * @since 1.0.0
16
+ * @param string $xoo_wsc The name of the plugin.
17
+ * @param string $version The version of this plugin.
18
+ */
19
+ public function __construct( $xoo_wsc ) {
20
+
21
+ $this->xoo_wsc = $xoo_wsc;
22
+
23
+ }
24
+
25
+ /**
26
+ * Formats the RAW woocommerce price
27
+ *
28
+ * @since 1.0.0
29
+ * @param int $price
30
+ * @return string
31
+ */
32
+
33
+ public function formatted_price($price){
34
+ if(!$price)
35
+ return;
36
+ $options = get_option('xoo-wsc-gl-options');
37
+ $default_wc = isset( $options['sc-price-format']) ? $options['sc-price-format'] : 0;
38
+
39
+ if($default_wc == 1){
40
+ return wc_price($price);
41
+ }
42
+
43
+ $thous_sep = wc_get_price_thousand_separator();
44
+ $dec_sep = wc_get_price_decimal_separator();
45
+ $decimals = wc_get_price_decimals();
46
+ $price = number_format( $price, $decimals, $dec_sep, $thous_sep );
47
+
48
+ $format = get_option( 'woocommerce_currency_pos' );
49
+ $csymbol = get_woocommerce_currency_symbol();
50
+
51
+ switch ($format) {
52
+ case 'left':
53
+ $fm_price = $csymbol.$price;
54
+ break;
55
+
56
+ case 'left_space':
57
+ $fm_price = $csymbol.' '.$price;
58
+ break;
59
+
60
+ case 'right':
61
+ $fm_price = $price.$csymbol;
62
+ break;
63
+
64
+ case 'right_space':
65
+ $fm_price = $price.' '.$csymbol;
66
+ break;
67
+
68
+ default:
69
+ $fm_price = $csymbol.$price;
70
+ break;
71
+ }
72
+ return $fm_price;
73
+ }
74
+
75
+ /**
76
+ * Get Side Cart HTML
77
+ *
78
+ * @since 1.0.0
79
+ * @return string
80
+ */
81
+
82
+ public function get_cart_markup(){
83
+ if(is_cart() || is_checkout()){return;}
84
+ require_once plugin_dir_path( dirname( __FILE__ ) ).'/public/partials/xoo-wsc-markup.php';
85
+ }
86
+
87
+
88
+ /**
89
+ * Sends JSON data on cart update
90
+ *
91
+ * @since 1.0.0
92
+ */
93
+
94
+ public function send_json_data(){
95
+
96
+ ob_start();
97
+ $this->get_cart_content();
98
+ $cart_markup = ob_get_clean();
99
+ $ajax_fragm = $this->get_ajax_fragments();
100
+
101
+ //Get User Settings
102
+ $options = get_option('xoo-wsc-gl-options');
103
+ $show_count = isset( $options['bk-show-bkcount']) ? $options['bk-show-bkcount'] : 1;
104
+
105
+ if($show_count == 1){
106
+ $count_value = WC()->cart->get_cart_contents_count();
107
+ }
108
+ else{
109
+ $count_value = 0;
110
+ }
111
+
112
+ //Send JSON data back to browser
113
+ wp_send_json(
114
+ array(
115
+ 'ajax_fragm' => $ajax_fragm,
116
+ 'items_count' => $count_value,
117
+ 'cart_markup' => $cart_markup
118
+ )
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
+ *
242
+ * @since 1.0.0
243
+ */
244
+
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
+
271
+ //Successfully added to cart.
272
+ if($cart_success){
273
+ $this->send_json_data();
274
+ }
275
+ else{
276
+ if(wc_notice_count('error') > 0){
277
+ echo wc_print_notices();
278
+ }
279
+ }
280
+ die();
281
+ }
282
+
283
+
284
+
285
+ /**
286
+ * Update product quantity in cart.
287
+ *
288
+ * @since 1.0.0
289
+ */
290
+
291
+ public function update_cart(){
292
+
293
+ //Form Input Values
294
+ $cart_key = sanitize_text_field($_POST['cart_key']);
295
+ $new_qty = 0;
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);
303
+
304
+ if($cart_success){
305
+ $this->send_json_data();
306
+ }
307
+ else{
308
+ if(wc_notice_count('error') > 0){
309
+ echo wc_print_notices();
310
+ }
311
+ }
312
+ die();
313
+ }
314
+
315
+ /**
316
+ * Get Cart fragments on update
317
+ *
318
+ * @since 1.0.0
319
+ * @return array
320
+ */
321
+
322
+ public function get_ajax_fragments(){
323
+
324
+ // Get mini cart
325
+ ob_start();
326
+
327
+ woocommerce_mini_cart();
328
+
329
+ $mini_cart = ob_get_clean();
330
+
331
+ // Fragments and mini cart are returned
332
+ $data = array(
333
+ 'fragments' => apply_filters( 'woocommerce_add_to_cart_fragments', array(
334
+ 'div.widget_shopping_cart_content' => '<div class="widget_shopping_cart_content">' . $mini_cart . '</div>'
335
+ )
336
+ ),
337
+ 'cart_hash' => apply_filters( 'woocommerce_add_to_cart_hash', WC()->cart->get_cart_for_session() ? md5( json_encode( WC()->cart->get_cart_for_session() ) ) : '', WC()->cart->get_cart_for_session() )
338
+ );
339
+ return $data;
340
+ }
341
+ }
342
+ ?>
public/class-xoo-wsc-public.php ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * The public-facing functionality of the plugin.
5
+ *
6
+ * Defines the plugin name, version, and two examples hooks for how to
7
+ * enqueue the admin-specific stylesheet and JavaScript.
8
+ *
9
+ * @since 1.0.0
10
+ *
11
+ * @package Side Cart WooCommerce
12
+ */
13
+
14
+ class xoo_wsc_Public {
15
+
16
+ /**
17
+ * The ID of this plugin.
18
+ *
19
+ * @since 1.0.0
20
+ * @access private
21
+ * @var string $xoo_wsc The ID of this plugin.
22
+ */
23
+ private $xoo_wsc;
24
+
25
+ /**
26
+ * The version of this plugin.
27
+ *
28
+ * @since 1.0.0
29
+ * @access private
30
+ * @var string $version The current version of this plugin.
31
+ */
32
+ private $version;
33
+
34
+ /**
35
+ * Initialize the class and set its properties.
36
+ *
37
+ * @since 1.0.0
38
+ * @param string $xoo_wsc The name of the plugin.
39
+ * @param string $version The version of this plugin.
40
+ */
41
+ public function __construct( $xoo_wsc, $version ) {
42
+
43
+ $this->xoo_wsc = $xoo_wsc;
44
+ $this->version = $version;
45
+
46
+ }
47
+
48
+ /**
49
+ * Register the stylesheets for the public-facing side of the site.
50
+ *
51
+ * @since 1.0.0
52
+ */
53
+ public function enqueue_styles() {
54
+
55
+ wp_enqueue_style( $this->xoo_wsc, plugin_dir_url( __FILE__ ) . 'css/xoo-wsc-public.css', array(), $this->version, 'all' );
56
+
57
+ $options = get_option('xoo-wsc-sy-options');
58
+
59
+ /*
60
+ * User Style Options
61
+ */
62
+
63
+ //Head
64
+ $sch_fs = isset( $options['sch-fs']) ? $options['sch-fs'] : 25; // Font Size
65
+
66
+ //Body
67
+ $scb_cw = !empty( $options['scb-cw']) ? $options['scb-cw'] : 300; // Container Width
68
+ $scb_fs = isset( $options['scb-fs']) ? $options['scb-fs'] : 14; // Font Size
69
+ $scb_imgw = isset( $options['scb-imgw']) ? $options['scb-imgw'] : 35; // Product Images width
70
+ $scb_sumw = 100-($scb_imgw+5);
71
+
72
+ //Footer
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;
86
+ }
87
+
88
+ .xoo-wsc-container{
89
+ right: -{$scb_cw}px;
90
+ width: {$scb_cw}px;
91
+ }
92
+ .xoo-wsc-body{
93
+ font-size: {$scb_fs}px;
94
+ }
95
+ .xoo-wsc-img-col{
96
+ width: {$scb_imgw}%;
97
+ }
98
+ .xoo-wsc-sum-col{
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};
108
+ font-size: {$bk_bfs}px;
109
+ }
110
+ .xoo-wsc-items-count{
111
+ background-color: {$bk_cbgc};
112
+ color: {$bk_cfc};
113
+ }
114
+ .xoo-wsc-footer a.button{
115
+ margin: {$scf_bm}px 0;
116
+ }
117
+ ";
118
+
119
+ wp_add_inline_style($this->xoo_wsc,$inline_style);
120
+
121
+ //Custom CSS from user settings
122
+ $av_options = get_option('xoo-wsc-av-options');
123
+ if(isset($av_options['custom-css']) && !empty($av_options['custom-css'])){
124
+ wp_add_inline_style($this->xoo_wsc,$av_options['custom-css']);
125
+ }
126
+
127
+ }
128
+
129
+ /**
130
+ * Register the JavaScript for the public-facing side of the site.
131
+ *
132
+ * @since 1.0.0
133
+ */
134
+ public function enqueue_scripts() {
135
+
136
+ //User Options
137
+ $gl_options = get_option('xoo-wsc-gl-options');
138
+ $av_options = get_option('xoo-wsc-av-options');
139
+
140
+ $ajax_atc = isset( $gl_options['sc-ajax-atc']) ? $gl_options['sc-ajax-atc'] : 1;
141
+
142
+ //Check if item added to cart
143
+ if($ajax_atc != 1 && isset($_POST['add-to-cart'])){
144
+ $added_to_cart = true;
145
+ }
146
+ else{
147
+ $added_to_cart = false;
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');
161
+ }
162
+
163
+
164
+
165
+ }
public/css/fonts/Woo-Side-Cart.eot ADDED
Binary file
public/css/fonts/Woo-Side-Cart.svg ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <metadata>Generated by IcoMoon</metadata>
5
+ <defs>
6
+ <font id="Woo-Side-Cart" horiz-adv-x="1024">
7
+ <font-face units-per-em="1024" ascent="960" descent="-64" />
8
+ <missing-glyph horiz-adv-x="1024" />
9
+ <glyph unicode="&#x20;" horiz-adv-x="512" d="" />
10
+ <glyph unicode="&#xe900;" glyph-name="basket5" d="M928 512h-832c-17.696 0-32 14.304-32 32s14.304 32 32 32h64l192 352c0 17.696 14.304 32 32 32h64c17.696 0 32-14.304 32-32l-192-352h448l-192 352c0 17.696 14.304 32 32 32h96c17.696 0 32-14.304 32-32l160-352h64c17.696 0 32-14.304 32-32s-14.304-32-32-32zM96 448h832c17.696 0 32-14.304 32-32l-64-448c0-17.696-14.304-32-32-32h-704c-17.696 0-32 14.304-32 32l-64 448c0 17.696 14.304 32 32 32zM704 64h64c17.696 0 32 14.304 32 32l32 192c0 17.696-14.304 32-32 32h-64c-17.696 0-32-14.304-32-32l-32-192c0-17.696 14.304-32 32-32zM448 96c0-17.696 14.304-32 32-32h64c17.696 0 32 14.304 32 32v192c0 17.696-14.304 32-32 32h-64c-17.696 0-32-14.304-32-32v-192zM224 96c0-17.696 14.304-32 32-32h64c17.696 0 32 14.304 32 32l-32 192c0 17.696-14.304 32-32 32h-64c-17.696 0-32-14.304-32-32l32-192z" />
11
+ <glyph unicode="&#xe901;" glyph-name="basket4" d="M942.029 614.4h-256.358l-92.774-92.774c-23.194-23.194-54.067-35.942-86.835-35.942-32.87 0-63.693 12.8-86.938 35.994-23.142 23.142-35.942 53.965-35.994 86.784 0 1.997 0.512 3.942 0.563 5.939h-301.773c-16.998 0-30.72-13.722-30.72-30.72v-122.88h921.6v122.88c0 16.998-13.824 30.72-30.771 30.72zM551.322 563.251l258.816 258.816c12.032 11.981 12.134 31.386 0.102 43.469l-47.104 47.104c-11.981 11.981-31.437 11.93-43.52 0l-258.816-258.867c-24.986-24.986-24.986-65.536 0-90.522 24.986-24.934 65.485-24.986 90.522 0zM195.738 88.525c4.966-20.531 26.368-37.325 47.462-37.325h537.6c21.094 0 42.496 16.794 47.462 37.325l77.978 321.075h-788.48l77.978-321.075z" />
12
+ <glyph unicode="&#xe902;" glyph-name="basket6" horiz-adv-x="1170" d="M1097.143 512c40.571 0 73.143-32.571 73.143-73.143s-32.571-73.143-73.143-73.143h-8.571l-65.714-378.286c-6.286-34.857-36.571-60.571-72-60.571h-731.429c-35.429 0-65.714 25.714-72 60.571l-65.714 378.286h-8.571c-40.571 0-73.143 32.571-73.143 73.143s32.571 73.143 73.143 73.143h1024zM277.143 54.857c20 1.714 35.429 19.429 33.714 39.429l-18.286 237.714c-1.714 20-19.429 35.429-39.429 33.714s-35.429-19.429-33.714-39.429l18.286-237.714c1.714-18.857 17.714-33.714 36.571-33.714h2.857zM512 91.428v237.714c0 20-16.571 36.571-36.571 36.571s-36.571-16.571-36.571-36.571v-237.714c0-20 16.571-36.571 36.571-36.571s36.571 16.571 36.571 36.571zM731.429 91.428v237.714c0 20-16.571 36.571-36.571 36.571s-36.571-16.571-36.571-36.571v-237.714c0-20 16.571-36.571 36.571-36.571s36.571 16.571 36.571 36.571zM932.571 88.571l18.286 237.714c1.714 20-13.714 37.714-33.714 39.429s-37.714-13.714-39.429-33.714l-18.286-237.714c-1.714-20 13.714-37.714 33.714-39.429h2.857c18.857 0 34.857 14.857 36.571 33.714zM272 784l-53.143-235.429h-75.429l57.714 252c14.857 66.857 73.714 113.714 142.286 113.714h95.429c0 20 16.571 36.571 36.571 36.571h219.429c20 0 36.571-16.571 36.571-36.571h95.429c68.571 0 127.429-46.857 142.286-113.714l57.714-252h-75.429l-53.143 235.429c-8 33.714-37.143 57.143-71.429 57.143h-95.429c0-20-16.571-36.571-36.571-36.571h-219.429c-20 0-36.571 16.571-36.571 36.571h-95.429c-34.286 0-63.429-23.429-71.429-57.143z" />
13
+ <glyph unicode="&#xe903;" glyph-name="basket1" d="M512 212.667c46 0 86 40 86 86s-40 86-86 86-86-40-86-86 40-86 86-86zM384 554.667h256l-128 188zM734 554.667h204c24 0 44-18 44-42-34.625-138.041-73.705-271.628-110-408-10-36-42-62-82-62h-556c-40 0-72 26-82 62l-108 396c-2 4-2 8-2 12 0 24 20 42 44 42h204l186 280c8 12 22 18 36 18s28-6 36-18z" />
14
+ <glyph unicode="&#xe904;" glyph-name="basket2" d="M0 512v96h120l240.992 241.024c-1.6 4.768-2.976 9.632-2.976 14.976 0 26.528 21.472 48 48 48 26.496 0 48-21.472 48-48 0-26.496-21.504-48-48-48-3.552 0-6.688 1.312-9.984 2.016l-210.048-210.016h619.328l-208.8 210.528c-4.128-1.152-8.064-2.528-12.512-2.528-26.496 0-48 21.504-48 48 0 26.528 21.504 48 48 48s48-21.472 48-48c0-4.896-1.44-9.376-2.816-13.856l242.144-242.144h120.672v-96h-992zM795.808 35.136c-9.376-37.504-35.36-35.424-35.36-35.424l-531.040-1.024c-27.072 0-34.336 34.304-34.336 34.304l-140.384 446.56 882.368 0.832-141.248-445.248zM319.968 416h-32v-160h32v160zM319.968 224h-32v-160h32v160zM383.968 416h-31.968v-160h31.968v160zM383.968 224h-31.968v-160h31.968v160zM447.968 416h-32v-160h32v160zM447.968 224h-32v-160h32v160zM512 416h-32v-160h32v160zM512 224h-32v-160h32v160zM576 416h-32v-160h32v160zM576 224h-32v-160h32v160zM640 416h-32v-160h32v160zM640 224h-32v-160h32v160zM704 416h-32v-160h32v160zM704 224h-32v-160h32v160z" />
15
+ <glyph unicode="&#xe905;" glyph-name="basket3" horiz-adv-x="1344" d="M1264 512h-1184c-4.928 0-9.6-2.272-12.64-6.144s-4.096-8.928-2.912-13.728l128.192-512.544c3.072-10.784 12.512-43.584 47.36-43.584h864c34.976 0 44.32 32.832 47.52 44.128l128 512c1.184 4.768 0.128 9.856-2.912 13.728-3.008 3.872-7.68 6.144-12.608 6.144zM1120.64-11.616c-5.824-20.384-11.84-20.384-16.64-20.384h-864c-4.768 0-10.752 0-16.48 19.872l-123.008 492.128h1143.008l-122.88-491.616zM592 64c8.832 0 16 7.168 16 16v288c0 8.832-7.168 16-16 16s-16-7.168-16-16v-288c0-8.832 7.168-16 16-16zM367.968 64c0.608 0 1.184 0.032 1.824 0.096 8.768 0.992 15.104 8.896 14.112 17.664l-32 288c-0.96 8.8-8.64 15.008-17.696 14.144-8.768-0.992-15.104-8.896-14.112-17.664l32-288c0.896-8.192 7.84-14.24 15.872-14.24zM784 64c8.832 0 16 7.168 16 16v288c0 8.832-7.168 16-16 16s-16-7.168-16-16v-288c0-8.832 7.168-16 16-16zM974.208 64.096c0.64-0.064 1.216-0.096 1.824-0.096 8.032 0 14.976 6.048 15.872 14.24l32 288c0.96 8.768-5.344 16.672-14.112 17.664-9.184 0.896-16.704-5.344-17.696-14.144l-32-288c-0.96-8.768 5.344-16.672 14.112-17.664zM1104 576c3.712 0 7.424 1.28 10.464 3.904 6.688 5.792 7.392 15.872 1.632 22.56l-304 352c-5.792 6.72-15.872 7.392-22.56 1.664-6.688-5.792-7.392-15.872-1.632-22.56l304-352c3.168-3.68 7.616-5.568 12.096-5.568zM570.112 956.384c-6.816 5.536-16.896 4.608-22.496-2.272l-288-352c-5.6-6.816-4.608-16.896 2.24-22.528 2.976-2.4 6.592-3.584 10.144-3.584 4.64 0 9.216 1.984 12.384 5.888l288 352c5.6 6.816 4.576 16.896-2.272 22.496zM1328 640h-128c-8.832 0-16-7.168-16-16s7.168-16 16-16h128c8.832 0 16 7.168 16 16s-7.168 16-16 16zM432 608h512c8.832 0 16 7.168 16 16s-7.168 16-16 16h-512c-8.832 0-16-7.168-16-16s7.168-16 16-16zM16 608h160c8.832 0 16 7.168 16 16s-7.168 16-16 16h-160c-8.832 0-16-7.168-16-16s7.168-16 16-16z" />
16
+ <glyph unicode="&#xe97a;" glyph-name="spinner" d="M384 832c0 70.692 57.308 128 128 128s128-57.308 128-128c0-70.692-57.308-128-128-128s-128 57.308-128 128zM655.53 719.53c0 70.692 57.308 128 128 128s128-57.308 128-128c0-70.692-57.308-128-128-128s-128 57.308-128 128zM832 448c0 35.346 28.654 64 64 64s64-28.654 64-64c0-35.346-28.654-64-64-64s-64 28.654-64 64zM719.53 176.47c0 35.346 28.654 64 64 64s64-28.654 64-64c0-35.346-28.654-64-64-64s-64 28.654-64 64zM448.002 64c0 0 0 0 0 0 0 35.346 28.654 64 64 64s64-28.654 64-64c0 0 0 0 0 0 0-35.346-28.654-64-64-64s-64 28.654-64 64zM176.472 176.47c0 0 0 0 0 0 0 35.346 28.654 64 64 64s64-28.654 64-64c0 0 0 0 0 0 0-35.346-28.654-64-64-64s-64 28.654-64 64zM144.472 719.53c0 0 0 0 0 0 0 53.019 42.981 96 96 96s96-42.981 96-96c0 0 0 0 0 0 0-53.019-42.981-96-96-96s-96 42.981-96 96zM56 448c0 39.765 32.235 72 72 72s72-32.235 72-72c0-39.765-32.235-72-72-72s-72 32.235-72 72z" />
17
+ <glyph unicode="&#xe97b;" glyph-name="spinner2" d="M1024 448c-1.278 66.862-15.784 133.516-42.576 194.462-26.704 61-65.462 116.258-113.042 161.92-47.552 45.696-103.944 81.82-164.984 105.652-61.004 23.924-126.596 35.352-191.398 33.966-64.81-1.282-129.332-15.374-188.334-41.356-59.048-25.896-112.542-63.47-156.734-109.576-44.224-46.082-79.16-100.708-102.186-159.798-23.114-59.062-34.128-122.52-32.746-185.27 1.286-62.76 14.964-125.148 40.134-182.206 25.088-57.1 61.476-108.828 106.11-151.548 44.61-42.754 97.472-76.504 154.614-98.72 57.118-22.304 118.446-32.902 179.142-31.526 60.708 1.29 120.962 14.554 176.076 38.914 55.15 24.282 105.116 59.48 146.366 102.644 41.282 43.14 73.844 94.236 95.254 149.43 13.034 33.458 21.88 68.4 26.542 103.798 1.246-0.072 2.498-0.12 3.762-0.12 35.346 0 64 28.652 64 64 0 1.796-0.094 3.572-0.238 5.332h0.238zM922.306 278.052c-23.472-53.202-57.484-101.4-99.178-141.18-41.67-39.81-91-71.186-144.244-91.79-53.228-20.678-110.29-30.452-166.884-29.082-56.604 1.298-112.596 13.736-163.82 36.474-51.25 22.666-97.684 55.49-135.994 95.712-38.338 40.198-68.528 87.764-88.322 139.058-19.87 51.284-29.228 106.214-27.864 160.756 1.302 54.552 13.328 108.412 35.254 157.69 21.858 49.3 53.498 93.97 92.246 130.81 38.73 36.868 84.53 65.87 133.874 84.856 49.338 19.060 102.136 28.006 154.626 26.644 52.5-1.306 104.228-12.918 151.562-34.034 47.352-21.050 90.256-51.502 125.624-88.782 35.396-37.258 63.21-81.294 81.39-128.688 18.248-47.392 26.782-98.058 25.424-148.496h0.238c-0.144-1.76-0.238-3.536-0.238-5.332 0-33.012 24.992-60.174 57.086-63.624-6.224-34.822-16.53-68.818-30.78-100.992z" />
18
+ <glyph unicode="&#xea0f;" glyph-name="cross" d="M1014.662 137.34c-0.004 0.004-0.008 0.008-0.012 0.010l-310.644 310.65 310.644 310.65c0.004 0.004 0.008 0.006 0.012 0.010 3.344 3.346 5.762 7.254 7.312 11.416 4.246 11.376 1.824 24.682-7.324 33.83l-146.746 146.746c-9.148 9.146-22.45 11.566-33.828 7.32-4.16-1.55-8.070-3.968-11.418-7.31 0-0.004-0.004-0.006-0.008-0.010l-310.648-310.652-310.648 310.65c-0.004 0.004-0.006 0.006-0.010 0.010-3.346 3.342-7.254 5.76-11.414 7.31-11.38 4.248-24.682 1.826-33.83-7.32l-146.748-146.748c-9.148-9.148-11.568-22.452-7.322-33.828 1.552-4.16 3.97-8.072 7.312-11.416 0.004-0.002 0.006-0.006 0.010-0.010l310.65-310.648-310.65-310.652c-0.002-0.004-0.006-0.006-0.008-0.010-3.342-3.346-5.76-7.254-7.314-11.414-4.248-11.376-1.826-24.682 7.322-33.83l146.748-146.746c9.15-9.148 22.452-11.568 33.83-7.322 4.16 1.552 8.070 3.97 11.416 7.312 0.002 0.004 0.006 0.006 0.010 0.010l310.648 310.65 310.648-310.65c0.004-0.002 0.008-0.006 0.012-0.008 3.348-3.344 7.254-5.762 11.414-7.314 11.378-4.246 24.684-1.826 33.828 7.322l146.746 146.748c9.148 9.148 11.57 22.454 7.324 33.83-1.552 4.16-3.97 8.068-7.314 11.414z" />
19
+ <glyph unicode="&#xea10;" glyph-name="checkmark" d="M864 832l-480-480-224 224-160-160 384-384 640 640z" />
20
+ </font></defs></svg>
public/css/fonts/Woo-Side-Cart.ttf ADDED
Binary file
public/css/fonts/Woo-Side-Cart.woff ADDED
Binary file
public/css/xoo-wsc-public.css ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .xoo-wsc-basket,.xoo-wsc-close {
2
+ cursor: pointer;
3
+ position: absolute
4
+ }
5
+
6
+ @font-face {
7
+ font-family: Woo-Side-Cart;
8
+ src: url(fonts/Woo-Side-Cart.eot?w0cuef);
9
+ src: url(fonts/Woo-Side-Cart.eot?w0cuef#iefix) format('embedded-opentype'), url(fonts/Woo-Side-Cart.ttf?w0cuef) format('truetype'), url(fonts/Woo-Side-Cart.woff?w0cuef) format('woff'), url(fonts/Woo-Side-Cart.svg?w0cuef#Woo-Side-Cart) format('svg');
10
+ font-weight: 400;
11
+ font-style: normal
12
+ }
13
+
14
+ [class*=" xoo-wsc-icon-"],
15
+ [class^=xoo-wsc-icon-] {
16
+ font-family: Woo-Side-Cart!important;
17
+ speak: none;
18
+ font-style: normal;
19
+ font-weight: 400;
20
+ font-variant: normal;
21
+ text-transform: none;
22
+ line-height: 1;
23
+ -webkit-font-smoothing: antialiased;
24
+ -moz-osx-font-smoothing: grayscale
25
+ }
26
+
27
+ .xoo-wsc-icon-basket1:before {
28
+ content: "\e903"
29
+ }
30
+
31
+ .xoo-wsc-icon-checkmark:before {
32
+ content: "\ea10"
33
+ }
34
+
35
+ .xoo-wsc-icon-cross:before {
36
+ content: "\ea0f"
37
+ }
38
+
39
+ .xoo-wsc-icon-spinner:before {
40
+ content: "\e97a"
41
+ }
42
+
43
+ .xoo-wsc-icon-spinner2:before {
44
+ content: "\e97b"
45
+ }
46
+
47
+ @keyframes xoo-wsc-spin {
48
+ 0% {
49
+ transform: rotate(0)
50
+ }
51
+ 100% {
52
+ transform: rotate(360deg)
53
+ }
54
+ }
55
+
56
+ .xoo-wsc-icon-atc {
57
+ margin-left: 5px
58
+ }
59
+
60
+ .xoo-wsc-icon-atc.xoo-wsc-active {
61
+ display: inline-block;
62
+ -webkit-animation: xoo-wsc-spin 575ms infinite linear;
63
+ animation: xoo-wsc-spin 575ms infinite linear
64
+ }
65
+
66
+ .xoo-wsc-updating {
67
+ display: none;
68
+ text-align: center;
69
+ z-index: 1
70
+ }
71
+
72
+ .xoo-wsc-updating .xoo-wsc-icon-spinner2 {
73
+ position: absolute;
74
+ -webkit-animation: xoo-wsc-spin 575ms infinite linear;
75
+ animation: xoo-wsc-spin 575ms infinite linear;
76
+ display: inline-block;
77
+ font-size: 30px;
78
+ z-index: 1;
79
+ color: #000;
80
+ bottom: 10px
81
+ }
82
+
83
+ .xoo-wsc-uopac,
84
+ .xoo-wsc-updating {
85
+ top: 0;
86
+ bottom: 0;
87
+ left: 0;
88
+ right: 0;
89
+ position: absolute
90
+ }
91
+
92
+ .xoo-wsc-uopac {
93
+ background-color: #f0f0f0;
94
+ opacity: .7
95
+ }
96
+
97
+ body.xoo-wsc-active {
98
+ overflow: hidden
99
+ }
100
+
101
+ .xoo-wsc-modal.xoo-wsc-active .xoo-wsc-opac {
102
+ top: 0;
103
+ left: 0;
104
+ right: 0;
105
+ position: fixed;
106
+ bottom: 0;
107
+ background-color: #000;
108
+ z-index: 99999;
109
+ opacity: .5
110
+ }
111
+
112
+ .xoo-wsc-container {
113
+ position: fixed;
114
+ z-index: 999999;
115
+ background-color: #fff;
116
+ top: 0;
117
+ bottom: 0;
118
+ transition: right .5s
119
+ }
120
+
121
+ .xoo-wsc-header {
122
+ position: relative;
123
+ border-bottom: 1px solid #eee;
124
+ padding: 15px;
125
+ }
126
+
127
+ .xoo-wsc-basket {
128
+ padding: 10px;
129
+ border-radius: 14px;
130
+ margin: 10px;
131
+ box-shadow: 0 1px 4px 0
132
+ }
133
+
134
+ .xoo-wsc-items-count {
135
+ border-radius: 50%;
136
+ left: -15px;
137
+ position: absolute;
138
+ top: -15px;
139
+ font-size: 13px;
140
+ width: 28px;
141
+ height: 28px;
142
+ line-height: 28px;
143
+ text-align: center;
144
+ overflow: hidden
145
+ }
146
+
147
+ .xoo-wsc-close {
148
+ transform: translateY(-50%);
149
+ top: 50%;
150
+ right: 20px
151
+ }
152
+
153
+ .xoo-wsc-body {
154
+ overflow: auto;
155
+ position: relative
156
+ }
157
+
158
+ .xoo-wsc-product {
159
+ padding: 15px;
160
+ width: 100%;
161
+ display: inline-block;
162
+ border-bottom: 1px solid #eee;
163
+ }
164
+
165
+ .xoo-wsc-img-col {
166
+ float: left;
167
+ text-align: center
168
+ }
169
+
170
+ a.xoo-wsc-remove {
171
+ margin-top: 5px;
172
+ display: inline-block;
173
+ text-transform: uppercase;
174
+ font-size: 10px
175
+ }
176
+
177
+ .xoo-wsc-sum-col {
178
+ display: inline-block;
179
+ margin-left: 10px;
180
+ float: left
181
+ }
182
+
183
+ a.xoo-wsc-pname {
184
+ word-wrap: break-word;
185
+ display: block;
186
+ width: 100%
187
+ }
188
+
189
+ .xoo-wsc-price {
190
+ margin: 3px 0
191
+ }
192
+
193
+ .xoo-wsc-sum-col .variation {
194
+ overflow: auto;
195
+ font-size: 12px;
196
+ margin: 5px 0
197
+ }
198
+
199
+ .xoo-wsc-sum-col .variation dt {
200
+ display: inline-block;
201
+ margin: 0 3px 0 0;
202
+ float: none
203
+ }
204
+
205
+ .xoo-wsc-sum-col .variation dd {
206
+ display: inline-block;
207
+ margin: 0 5px 0 0;
208
+ float: none
209
+ }
210
+
211
+
212
+ .xoo-wsc-footer,
213
+ .xoo-wsc-footer a.button {
214
+ width: 100%;
215
+ text-align: center
216
+ }
217
+
218
+ .xoo-wsc-subtotal {
219
+ text-align: center;
220
+ margin-top: 10px;
221
+ font-weight: 700;
222
+ font-size: 17px
223
+ }
224
+
225
+ .xoo-wsc-footer {
226
+ position: absolute;
227
+ bottom: 0;
228
+ padding: 10px;
229
+ box-sizing: border-box;
230
+ border-top: 2px solid #eee;
231
+ }
232
+
233
+ .xoo-wsc-modal.xoo-wsc-active .xoo-wsc-container {
234
+ right: 0
235
+ }
236
+
237
+ .xoo-wsc-mgn {
238
+ margin: 10px 0;
239
+ display: block
240
+ }
241
+
242
+ input.xoo-wsc-qty::-webkit-inner-spin-button,
243
+ input.xoo-wsc-qty::-webkit-outer-spin-button {
244
+ -webkit-appearance: none;
245
+ margin: 0
246
+ }
247
+
248
+ .xoo-wsc-ecnt {
249
+ padding: 15px;
250
+ font-size: 20px;
251
+ display: block
252
+ }
253
+
254
+ .xoo-wsc-shiptxt {
255
+ padding: 0 15px;
256
+ display: block;
257
+ font-size: 13px
258
+ }
public/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
public/js/xoo-wsc-public.js ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($){
2
+ 'use strict';
3
+
4
+ //Toggle Side Cart
5
+ function toggle_sidecart(){
6
+ $('.xoo-wsc-modal , body').toggleClass('xoo-wsc-active');
7
+ }
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
+
15
+
16
+ //Close Side Cart
17
+ function close_sidecart(e){
18
+ $.each(e.target.classList,function(key,value){
19
+ if(value != 'xoo-wsc-container' && (value == 'xoo-wsc-close' || value == 'xoo-wsc-opac' || value == 'xoo-wsc-basket' || value == 'xoo-wsc-cont')){
20
+ $('.xoo-wsc-modal , body').removeClass('xoo-wsc-active');
21
+ }
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(){
29
+ var header = $('.xoo-wsc-header').outerHeight();
30
+ var footer = $('.xoo-wsc-footer').outerHeight();
31
+ var screen = $(window).height();
32
+ $('.xoo-wsc-body').outerHeight(screen-(header+footer));
33
+ };
34
+ content_height();
35
+ $(window).resize(function(){
36
+ content_height();
37
+ });
38
+
39
+ //Refresh ajax fragments
40
+ function refresh_ajax_fragm(ajax_fragm){
41
+ var fragments = ajax_fragm.fragments;
42
+ var cart_hash = ajax_fragm.cart_hash;
43
+ var cart_html = ajax_fragm.fragments["div.widget_shopping_cart_content"];
44
+ $('.woofc-trigger').css('transform','scale(1)');
45
+ $('.shopping-cart-inner').html(cart_html);
46
+ var cart_count = $('.cart_list:first').find('li').length;
47
+ $('.shopping-cart span.counter , ul.woofc-count li').html(cart_count);
48
+ }
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',
82
+ cart_key: cart_key,
83
+ new_qty: new_qty
84
+ },
85
+ success: function(response){
86
+ on_cart_success(response);
87
+ $('.xoo-wsc-updating').hide();
88
+ }
89
+
90
+ })
91
+ }
92
+
93
+
94
+ //Remove item from cart
95
+ $(document).on('click','.xoo-wsc-remove',function(e){
96
+ e.preventDefault();
97
+ var product_row = $(this).parents('.xoo-wsc-product');
98
+ var cart_key = product_row.data('xoo_wsc');
99
+ update_cart(cart_key,0);
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');
107
+ if(atc_btn.find('.xoo-wsc-icon-atc').length !== 0){
108
+ atc_btn.find('.xoo-wsc-icon-atc').attr('class','xoo-wsc-icon-spinner xoo-wsc-icon-atc xoo-wsc-active');
109
+ }
110
+ else{
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;
135
+ }
136
+
137
+ $(shop_btn).on('click',function(e){
138
+ var atc_btn = $(this);
139
+ if(atc_btn.hasClass('product_type_variable')){return;}
140
+ e.preventDefault();
141
+
142
+
143
+ if(atc_btn.find('.xoo-wsc-icon-atc').length !== 0){
144
+ atc_btn.find('.xoo-wsc-icon-atc').attr('class','xoo-wsc-icon-spinner xoo-wsc-icon-atc xoo-wsc-active');
145
+ }
146
+ else{
147
+ atc_btn.append('<span class="xoo-wsc-icon-spinner xoo-wsc-icon-atc xoo-wsc-active"></span>');
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
+
157
+ })
public/js/xoo-wsc-public.min.js ADDED
@@ -0,0 +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)}})});
public/partials/xoo-wsc-markup.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Side Cart HTML
5
+ *
6
+ * @since 1.0.0
7
+ */
8
+
9
+ //User Settings
10
+ $options = get_option('xoo-wsc-gl-options');
11
+ $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">
41
+ <div class="xoo-wsc-content">
42
+ <?php do_action('xoo_wsc_cart_content'); ?>
43
+ </div>
44
+ <div class="xoo-wsc-updating">
45
+ <span class="xoo-wsc-icon-spinner2" aria-hidden="true"></span>
46
+ <span class="xoo-wsc-uopac"></span>
47
+ </div>
48
+ </div>
49
+
50
+ <?php if(!empty($cart_txt) || !empty($chk_txt) || !empty($cont_txt)): // If any footer button exists , add footer div ?>
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>
67
+
68
+ <?php endif; ?>
69
+
70
+ </div>
71
+ </div>
xoo-wsc.php ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * The plugin bootstrap file
5
+ *
6
+ * @since 1.0.0
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
+
22
+ // If this file is called directly, abort.
23
+ if ( ! defined( 'WPINC' ) ) {
24
+ die;
25
+ }
26
+
27
+ /**
28
+ * The code that runs during plugin activation.
29
+ * This action is documented in includes/class-xoo-sc-activator.php
30
+ */
31
+ function activate_xoo_wsc() {
32
+ require_once plugin_dir_path( __FILE__ ) . 'includes/class-xoo-wsc-activator.php';
33
+ xoo_wsc_Activator::activate();
34
+ }
35
+
36
+ /**
37
+ * The code that runs during plugin deactivation.
38
+ * This action is documented in includes/class-plugin-name-deactivator.php
39
+ */
40
+ function deactivate_xoo_wsc() {
41
+ require_once plugin_dir_path( __FILE__ ) . 'includes/class-xoo-wsc-deactivator.php';
42
+ xoo_wsc_Deactivator::deactivate();
43
+ }
44
+
45
+ register_activation_hook( __FILE__, 'activate_xoo_wsc' );
46
+ register_deactivation_hook( __FILE__, 'deactivate_xoo_wsc' );
47
+
48
+ /**
49
+ * Begins execution of the plugin.
50
+ *
51
+ * Since everything within the plugin is registered via hooks,
52
+ * then kicking off the plugin from this point in the file does
53
+ * not affect the page life cycle.
54
+ *
55
+ * @since 1.0.0
56
+ */
57
+ function run_xoo_wsc() {
58
+
59
+ $plugin = new xoo_wsc();
60
+ $plugin->run();
61
+
62
+ }
63
+
64
+ /**
65
+ * Check if WooCommerce is activated
66
+ *
67
+ * @since 1.0.0
68
+ */
69
+ function xoo_wsc_init(){
70
+ if ( function_exists( 'WC' ) ) {
71
+
72
+ /*The core plugin class that is used to define internationalization,
73
+ admin-specific hooks, and public-facing site hooks.*/
74
+
75
+ require plugin_dir_path( __FILE__ ) . 'includes/class-xoo-wsc.php';
76
+ run_xoo_wsc();
77
+ }
78
+ else{
79
+ add_action( 'admin_notices', 'xoo_wsc_install_wc_notice' );
80
+ }
81
+ }
82
+ add_action('plugins_loaded','xoo_wsc_init');
83
+
84
+
85
+ /**
86
+ * WooCommerce not activated admin notice
87
+ *
88
+ * @since 1.0.0
89
+ */
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
+ }