Version Description
- Fix: WP eCommerce compatibility
- New: Better custom ajax options, using a custom event trigger (
wpmenucart_update_cart_ajax
) - Tested up to WooCommerce 5.8
Download this release
Release Info
Developer | wpovernight |
Plugin | WooCommerce Menu Cart |
Version | 2.10.1 |
Comparing to | |
See all releases |
Code changes from version 2.10.0 to 2.10.1
- assets/js/wpmenucart.js +24 -10
- assets/js/wpmenucart.min.js +1 -1
- includes/wpmenucart-wpec.php +1 -20
- readme.txt +6 -1
- wp-menu-cart.php +3 -3
assets/js/wpmenucart.js
CHANGED
@@ -1,14 +1,21 @@
|
|
1 |
/*
|
2 |
* JS for WPEC, EDD and eShop
|
3 |
*
|
4 |
-
* AJAX not working for you?
|
5 |
-
*
|
6 |
-
*
|
|
|
7 |
*
|
|
|
|
|
|
|
|
|
|
|
8 |
*/
|
9 |
|
10 |
jQuery( function( $ ) {
|
11 |
-
|
|
|
12 |
".edd-add-to-cart",
|
13 |
".wpsc_buy_button",
|
14 |
".eshopbutton",
|
@@ -18,27 +25,34 @@ jQuery( function( $ ) {
|
|
18 |
".cart_item a.remove",
|
19 |
"#order_review .opc_cart_item a.remove",
|
20 |
".woocommerce-cart input.plus",
|
21 |
-
".single_add_to_cart_button"
|
|
|
22 |
];
|
23 |
|
24 |
-
|
25 |
"input.edd-item-quantity"
|
26 |
];
|
27 |
|
28 |
-
|
29 |
WPMenucart_Timeout();
|
30 |
});
|
31 |
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
33 |
WPMenucart_Timeout();
|
34 |
});
|
35 |
|
36 |
function WPMenucart_Timeout() {
|
37 |
-
|
|
|
38 |
}
|
39 |
|
40 |
function WPMenucart_Load_AJAX() {
|
41 |
-
|
42 |
security: wpmenucart_ajax.nonce,
|
43 |
action: "wpmenucart_ajax",
|
44 |
};
|
1 |
/*
|
2 |
* JS for WPEC, EDD and eShop
|
3 |
*
|
4 |
+
* AJAX not working for you?
|
5 |
+
* You can use our custom 'wpmenucart_update_cart_ajax' handle to trigger a refresh
|
6 |
+
* with a custom script added to your site (in a child theme or using "Code Snippets")
|
7 |
+
* Here's an example:
|
8 |
*
|
9 |
+
* jQuery( function( $ ) {
|
10 |
+
* $(document).on('click', '.YOURCLASS', function(){
|
11 |
+
* $(document).trigger('wpmenucart_update_cart_ajax');
|
12 |
+
* });
|
13 |
+
* });
|
14 |
*/
|
15 |
|
16 |
jQuery( function( $ ) {
|
17 |
+
let wpmenucart_ajax_timer;
|
18 |
+
let buttons = [
|
19 |
".edd-add-to-cart",
|
20 |
".wpsc_buy_button",
|
21 |
".eshopbutton",
|
25 |
".cart_item a.remove",
|
26 |
"#order_review .opc_cart_item a.remove",
|
27 |
".woocommerce-cart input.plus",
|
28 |
+
".single_add_to_cart_button",
|
29 |
+
".emptycart"
|
30 |
];
|
31 |
|
32 |
+
let inputs = [
|
33 |
"input.edd-item-quantity"
|
34 |
];
|
35 |
|
36 |
+
$(document.body).on('click', buttons.join(','), function(){
|
37 |
WPMenucart_Timeout();
|
38 |
});
|
39 |
|
40 |
+
$(document.body).on('change', inputs.join(','), function(){
|
41 |
+
WPMenucart_Timeout();
|
42 |
+
});
|
43 |
+
|
44 |
+
// allow triggering refresh with a custom handle
|
45 |
+
$(document).on('wpmenucart_update_cart_ajax', function( event ) {
|
46 |
WPMenucart_Timeout();
|
47 |
});
|
48 |
|
49 |
function WPMenucart_Timeout() {
|
50 |
+
clearTimeout( wpmenucart_ajax_timer );
|
51 |
+
wpmenucart_ajax_timer = setTimeout( WPMenucart_Load_AJAX, 1000);
|
52 |
}
|
53 |
|
54 |
function WPMenucart_Load_AJAX() {
|
55 |
+
let data = {
|
56 |
security: wpmenucart_ajax.nonce,
|
57 |
action: "wpmenucart_ajax",
|
58 |
};
|
assets/js/wpmenucart.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(function(a){function b(){setTimeout(c,1e3)}function c(){
|
1 |
+
jQuery(function(a){function b(){clearTimeout(d),d=setTimeout(c,1e3)}function c(){let b={security:wpmenucart_ajax.nonce,action:"wpmenucart_ajax"};xhr=a.ajax({type:"POST",url:wpmenucart_ajax.ajaxurl,data:b,success:function(b){a(".wpmenucartli").html(b)}})}let d;a(document.body).on("click",[".edd-add-to-cart",".wpsc_buy_button",".eshopbutton","div.cartopt p label.update input#update",".add_to_cart_button",".woocommerce-cart input.minus",".cart_item a.remove","#order_review .opc_cart_item a.remove",".woocommerce-cart input.plus",".single_add_to_cart_button",".emptycart"].join(","),function(){b()}),a(document.body).on("change",["input.edd-item-quantity"].join(","),function(){b()}),a(document).on("wpmenucart_update_cart_ajax",function(){b()})});
|
includes/wpmenucart-wpec.php
CHANGED
@@ -1,16 +1,14 @@
|
|
1 |
<?php
|
2 |
if ( ! class_exists( 'WPMenuCart_WPEC' ) ) {
|
3 |
class WPMenuCart_WPEC {
|
4 |
-
|
5 |
/**
|
6 |
* Construct.
|
7 |
*/
|
8 |
public function __construct() {
|
9 |
-
add_action('wpsc_alternate_cart_html', array( &$this, 'wpec_cart_ajax' ) );
|
10 |
}
|
11 |
|
12 |
public function menu_item() {
|
13 |
-
|
14 |
$menu_item = array(
|
15 |
'cart_url' => esc_url( get_option( 'shopping_cart_url' ) ),
|
16 |
'shop_page_url' => esc_url( get_option( 'product_list_url' ) ),
|
@@ -20,22 +18,5 @@ if ( ! class_exists( 'WPMenuCart_WPEC' ) ) {
|
|
20 |
|
21 |
return apply_filters( 'wpmenucart_menu_item_data', $menu_item );
|
22 |
}
|
23 |
-
/**
|
24 |
-
* action hook for wp-e-commerce to provide our own AJAX cart updates
|
25 |
-
*/
|
26 |
-
|
27 |
-
public function wpec_cart_ajax() {
|
28 |
-
/*
|
29 |
-
$item_data = $this->menu_item();
|
30 |
-
$cart_contents = sprintf(_n('%d item', '%d items', $item_data['cart_contents_count'], 'wp-menu-cart'), $item_data['cart_contents_count']);
|
31 |
-
$cart_total = $item_data['cart_total'];
|
32 |
-
$cart_url = $item_data['cart_url'];
|
33 |
-
?>
|
34 |
-
jQuery("span.cartcontents").html("<?php echo $cart_contents;?>");
|
35 |
-
jQuery("span.pricedisplay").html("<?php echo $cart_total;?>");
|
36 |
-
jQuery("a.wpmenucart-contents").attr("href", "<?php echo $cart_url;?>");
|
37 |
-
<?php
|
38 |
-
*/
|
39 |
-
}
|
40 |
}
|
41 |
}
|
1 |
<?php
|
2 |
if ( ! class_exists( 'WPMenuCart_WPEC' ) ) {
|
3 |
class WPMenuCart_WPEC {
|
|
|
4 |
/**
|
5 |
* Construct.
|
6 |
*/
|
7 |
public function __construct() {
|
|
|
8 |
}
|
9 |
|
10 |
public function menu_item() {
|
11 |
+
global $wpsc_cart, $options;
|
12 |
$menu_item = array(
|
13 |
'cart_url' => esc_url( get_option( 'shopping_cart_url' ) ),
|
14 |
'shop_page_url' => esc_url( get_option( 'product_list_url' ) ),
|
18 |
|
19 |
return apply_filters( 'wpmenucart_menu_item_data', $menu_item );
|
20 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
}
|
22 |
}
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: woocommerce, menu, bar, cart, basket, header, shopping cart, navigation, e
|
|
5 |
Requires at least: 3.4
|
6 |
Tested up to: 5.8
|
7 |
Requires PHP: 5.3
|
8 |
-
Stable tag: 2.10.
|
9 |
|
10 |
Automatically displays a shopping cart in your menu bar. Works with WooCommerce, WP-Ecommerce, EDD, Eshop and Jigoshop
|
11 |
|
@@ -85,6 +85,11 @@ Once the plugin is activated navigate to Settings > Menu Cart Setup. Select your
|
|
85 |
|
86 |
== Changelog ==
|
87 |
|
|
|
|
|
|
|
|
|
|
|
88 |
= 2.10.0 =
|
89 |
* New: use minified JS & CSS files to reduce load time on live sites (enabling `SCRIPT_DEBUG` will load full versions)
|
90 |
* Tested up to WooCommerce 5.7 & WP5.8
|
5 |
Requires at least: 3.4
|
6 |
Tested up to: 5.8
|
7 |
Requires PHP: 5.3
|
8 |
+
Stable tag: 2.10.1
|
9 |
|
10 |
Automatically displays a shopping cart in your menu bar. Works with WooCommerce, WP-Ecommerce, EDD, Eshop and Jigoshop
|
11 |
|
85 |
|
86 |
== Changelog ==
|
87 |
|
88 |
+
= 2.10.1 =
|
89 |
+
* Fix: WP eCommerce compatibility
|
90 |
+
* New: Better custom ajax options, using a custom event trigger (`wpmenucart_update_cart_ajax`)
|
91 |
+
* Tested up to WooCommerce 5.8
|
92 |
+
|
93 |
= 2.10.0 =
|
94 |
* New: use minified JS & CSS files to reduce load time on live sites (enabling `SCRIPT_DEBUG` will load full versions)
|
95 |
* Tested up to WooCommerce 5.7 & WP5.8
|
wp-menu-cart.php
CHANGED
@@ -3,14 +3,14 @@
|
|
3 |
* Plugin Name: WooCommerce Menu Cart
|
4 |
* Plugin URI: https://wpovernight.com/
|
5 |
* Description: Extension for your e-commerce plugin (WooCommerce, WP-Ecommerce, Easy Digital Downloads, Eshop or Jigoshop) that places a cart icon with number of items and total cost in the menu bar. Activate the plugin, set your options and you're ready to go! Will automatically conform to your theme styles.
|
6 |
-
* Version: 2.10.
|
7 |
* Author: Jeremiah Prummer, Ewout Fernhout
|
8 |
* Author URI: https://wpovernight.com/
|
9 |
* License: GPLv2 or later
|
10 |
* License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
11 |
* Text Domain: wp-menu-cart
|
12 |
* WC requires at least: 2.0.0
|
13 |
-
* WC tested up to: 5.
|
14 |
*/
|
15 |
|
16 |
if ( ! defined( 'ABSPATH' ) ) {
|
@@ -21,7 +21,7 @@ if ( ! class_exists( 'WpMenuCart' ) && ! class_exists( 'WPO_Menu_Cart_Pro' ) ) :
|
|
21 |
|
22 |
class WpMenuCart {
|
23 |
|
24 |
-
protected $plugin_version = '2.10.
|
25 |
public static $plugin_slug;
|
26 |
public static $plugin_basename;
|
27 |
|
3 |
* Plugin Name: WooCommerce Menu Cart
|
4 |
* Plugin URI: https://wpovernight.com/
|
5 |
* Description: Extension for your e-commerce plugin (WooCommerce, WP-Ecommerce, Easy Digital Downloads, Eshop or Jigoshop) that places a cart icon with number of items and total cost in the menu bar. Activate the plugin, set your options and you're ready to go! Will automatically conform to your theme styles.
|
6 |
+
* Version: 2.10.1
|
7 |
* Author: Jeremiah Prummer, Ewout Fernhout
|
8 |
* Author URI: https://wpovernight.com/
|
9 |
* License: GPLv2 or later
|
10 |
* License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
11 |
* Text Domain: wp-menu-cart
|
12 |
* WC requires at least: 2.0.0
|
13 |
+
* WC tested up to: 5.8.0
|
14 |
*/
|
15 |
|
16 |
if ( ! defined( 'ABSPATH' ) ) {
|
21 |
|
22 |
class WpMenuCart {
|
23 |
|
24 |
+
protected $plugin_version = '2.10.1';
|
25 |
public static $plugin_slug;
|
26 |
public static $plugin_basename;
|
27 |
|