WooCommerce Cart Tab - Version 0.2.1

Version Description

  • 16/09/2013 =
  • Better way of hiding the cart. Compatible with WP Super Cache as long as "late init" is enabled. Kudos bigbrowncow.
Download this release

Release Info

Developer jameskoster
Plugin Icon wp plugin WooCommerce Cart Tab
Version 0.2.1
Comparing to
See all releases

Code changes from version 0.2 to 0.2.1

README.md CHANGED
File without changes
assets/css/style.css CHANGED
@@ -1 +1 @@
1
- .cart-tab{width:22em;position:fixed;top:5em;z-index:9999999}.cart-tab a.cart-parent{position:absolute;top:0;display:block;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:1.618em;text-decoration:none}.cart-tab a.cart-parent span.contents{display:block;color:#666;font-size:.8em}.cart-tab a.cart-parent:hover{text-decoration:none}.cart-tab .widget{padding:1.618em;margin:0}.cart-tab.light{background:#fff}.cart-tab.light a.cart-parent,.cart-tab.light .widget{box-shadow:0 2px 1em 0 rgba(0,0,0,0.2);-webkit-box-shadow:0 2px 1em 0 rgba(0,0,0,0.2);-moz-box-shadow:0 2px 1em 0 rgba(0,0,0,0.2);-o-box-shadow:0 2px 1em 0 rgba(0,0,0,0.2)}.cart-tab.light a.cart-parent{background:#fff}.cart-tab.light a.cart-parent:after{content:"";display:block;width:10px;height:100%;background:#fff;position:absolute;top:0;right:-10px}.cart-tab.dark{background:#333}.cart-tab.dark a.cart-parent,.cart-tab.dark .widget{box-shadow:0 2px 1em 0 rgba(0,0,0,0.2);-webkit-box-shadow:0 2px 1em 0 rgba(0,0,0,0.2);-moz-box-shadow:0 2px 1em 0 rgba(0,0,0,0.2);-o-box-shadow:0 2px 1em 0 rgba(0,0,0,0.2)}.cart-tab.dark a.cart-parent{background:#333}.cart-tab.dark a.cart-parent:after{content:"";display:block;width:10px;height:100%;background:#333;position:absolute;top:0;right:-10px}.cart-tab.right{right:-22em;-webkit-transition:right ease .5s;-moz-transition:right ease .5s;-o-transition:right ease .5s;transition:right ease .5s}.cart-tab.right a.cart-parent{left:-8.402328em;width:8.402328em;-webkit-border-top-left-radius:3px;-webkit-border-bottom-left-radius:3px;-moz-border-radius-topleft:3px;-moz-border-radius-bottomleft:3px;border-top-left-radius:3px;border-bottom-left-radius:3px}.cart-tab.right:hover{right:0}.cart-tab.right .widget{-webkit-border-bottom-left-radius:3px;-webkit-border-bottom-right-radius:3px;-moz-border-radius-bottomleft:3px;-moz-border-radius-bottomright:3px;border-bottom-left-radius:3px;border-bottom-right-radius:3px;-webkit-border-top-right-radius:0;-webkit-border-bottom-right-radius:0;-moz-border-radius-topright:0;-moz-border-radius-bottomright:0;border-top-right-radius:0;border-bottom-right-radius:0}.cart-tab.left{left:-22em;-webkit-transition:left ease .5s;-moz-transition:left ease .5s;-o-transition:left ease .5s;transition:left ease .5s}.cart-tab.left a.cart-parent{right:-8.402328em;width:8.402328em;-webkit-border-top-right-radius:3px;-webkit-border-bottom-right-radius:3px;-moz-border-radius-topright:3px;-moz-border-radius-bottomright:3px;border-top-right-radius:3px;border-bottom-right-radius:3px}.cart-tab.left:hover{left:0}.cart-tab.left .widget{-webkit-border-bottom-left-radius:3px;-webkit-border-bottom-right-radius:3px;-moz-border-radius-bottomleft:3px;-moz-border-radius-bottomright:3px;border-bottom-left-radius:3px;border-bottom-right-radius:3px;-webkit-border-top-left-radius:0;-webkit-border-bottom-left-radius:0;-moz-border-radius-topleft:0;-moz-border-radius-bottomleft:0;border-top-left-radius:0;border-bottom-left-radius:0}.cart-tab.left.light a.cart-parent:after,.cart-tab.left.dark a.cart-parent:after{right:auto;left:-10px}.cart-tab.no-animation.right:hover{right:-22em}.cart-tab.no-animation.left:hover{left:-22em}@media only screen and (-webkit-min-device-pixel-ratio:2),only screen and (min--moz-device-pixel-ratio:2),only screen and (-o-min-device-pixel-ratio:2/
1
+ .cart-tab{width:22em;position:fixed;top:5em;z-index:9999999}.cart-tab a.cart-parent{position:absolute;top:0;display:block;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:1.618em;text-decoration:none}.cart-tab a.cart-parent span.contents{display:block;color:#666;font-size:.8em}.cart-tab a.cart-parent:hover{text-decoration:none}.cart-tab .widget{padding:1.618em;margin:0}.cart-tab.light{background:#fff}.cart-tab.light a.cart-parent,.cart-tab.light .widget{box-shadow:0 2px 1em 0 rgba(0,0,0,0.2);-webkit-box-shadow:0 2px 1em 0 rgba(0,0,0,0.2);-moz-box-shadow:0 2px 1em 0 rgba(0,0,0,0.2);-o-box-shadow:0 2px 1em 0 rgba(0,0,0,0.2)}.cart-tab.light a.cart-parent{background:#fff}.cart-tab.light a.cart-parent:after{content:"";display:block;width:10px;height:100%;background:#fff;position:absolute;top:0;right:-10px}.cart-tab.dark{background:#333}.cart-tab.dark a.cart-parent,.cart-tab.dark .widget{box-shadow:0 2px 1em 0 rgba(0,0,0,0.2);-webkit-box-shadow:0 2px 1em 0 rgba(0,0,0,0.2);-moz-box-shadow:0 2px 1em 0 rgba(0,0,0,0.2);-o-box-shadow:0 2px 1em 0 rgba(0,0,0,0.2)}.cart-tab.dark a.cart-parent{background:#333}.cart-tab.dark a.cart-parent:after{content:"";display:block;width:10px;height:100%;background:#333;position:absolute;top:0;right:-10px}.cart-tab.right{right:-22em;-webkit-transition:right ease .5s;-moz-transition:right ease .5s;-o-transition:right ease .5s;transition:right ease .5s}.cart-tab.right a.cart-parent{left:-8.402328em;width:8.402328em;-webkit-transition:left ease .5s;-moz-transition:left ease .5s;-o-transition:left ease .5s;transition:left ease .5s;-webkit-border-top-left-radius:3px;-webkit-border-bottom-left-radius:3px;-moz-border-radius-topleft:3px;-moz-border-radius-bottomleft:3px;border-top-left-radius:3px;border-bottom-left-radius:3px}.cart-tab.right a.cart-parent.hidden{left:0}.cart-tab.right a.cart-parent.visible{left:-8.402328em}.cart-tab.right:hover{right:0}.cart-tab.right .widget{-webkit-border-bottom-left-radius:3px;-webkit-border-bottom-right-radius:3px;-moz-border-radius-bottomleft:3px;-moz-border-radius-bottomright:3px;border-bottom-left-radius:3px;border-bottom-right-radius:3px;-webkit-border-top-right-radius:0;-webkit-border-bottom-right-radius:0;-moz-border-radius-topright:0;-moz-border-radius-bottomright:0;border-top-right-radius:0;border-bottom-right-radius:0}.cart-tab.left{left:-22em;-webkit-transition:left ease .5s;-moz-transition:left ease .5s;-o-transition:left ease .5s;transition:left ease .5s}.cart-tab.left a.cart-parent{right:-8.402328em;width:8.402328em;-webkit-transition:right ease .5s;-moz-transition:right ease .5s;-o-transition:right ease .5s;transition:right ease .5s;-webkit-border-top-right-radius:3px;-webkit-border-bottom-right-radius:3px;-moz-border-radius-topright:3px;-moz-border-radius-bottomright:3px;border-top-right-radius:3px;border-bottom-right-radius:3px}.cart-tab.left a.cart-parent.hidden{right:0}.cart-tab.left a.cart-parent.visible{right:-8.402328em}.cart-tab.left:hover{left:0}.cart-tab.left .widget{-webkit-border-bottom-left-radius:3px;-webkit-border-bottom-right-radius:3px;-moz-border-radius-bottomleft:3px;-moz-border-radius-bottomright:3px;border-bottom-left-radius:3px;border-bottom-right-radius:3px;-webkit-border-top-left-radius:0;-webkit-border-bottom-left-radius:0;-moz-border-radius-topleft:0;-moz-border-radius-bottomleft:0;border-top-left-radius:0;border-bottom-left-radius:0}.cart-tab.left.light a.cart-parent:after,.cart-tab.left.dark a.cart-parent:after{right:auto;left:-10px}.cart-tab.no-animation.right:hover{right:-22em}.cart-tab.no-animation.left:hover{left:-22em}@media only screen and (-webkit-min-device-pixel-ratio:2),only screen and (min--moz-device-pixel-ratio:2),only screen and (-o-min-device-pixel-ratio:2/
assets/css/style.less CHANGED
@@ -75,7 +75,14 @@
75
  a.cart-parent {
76
  left:-8.402328em;
77
  width:8.402328em;
 
78
  .border_radius_left(3px);
 
 
 
 
 
 
79
  }
80
  &:hover {
81
  right:0;
@@ -93,7 +100,14 @@
93
  a.cart-parent {
94
  right:-8.402328em;
95
  width:8.402328em;
 
96
  .border_radius_right(3px);
 
 
 
 
 
 
97
  }
98
  &:hover {
99
  left:0;
75
  a.cart-parent {
76
  left:-8.402328em;
77
  width:8.402328em;
78
+ .transition(left,ease,.5s);
79
  .border_radius_left(3px);
80
+ &.hidden {
81
+ left:0;
82
+ }
83
+ &.visible {
84
+ left:-8.402328em;
85
+ }
86
  }
87
  &:hover {
88
  right:0;
100
  a.cart-parent {
101
  right:-8.402328em;
102
  width:8.402328em;
103
+ .transition(right,ease,.5s);
104
  .border_radius_right(3px);
105
+ &.hidden {
106
+ right:0;
107
+ }
108
+ &.visible {
109
+ right:-8.402328em;
110
+ }
111
  }
112
  &:hover {
113
  left:0;
cart-tab.php CHANGED
@@ -2,10 +2,10 @@
2
  /*
3
  Plugin Name: WooCommerce Cart Tab
4
  Plugin URI: http://jameskoster.co.uk/tag/cart-tab/
5
- Version: 0.2
6
  Description: Displays a sitewide link to the cart which reveals the cart contents on hover.
7
  Author: jameskoster
8
- Tested up to: 3.6
9
  Author URI: http://jameskoster.co.uk
10
  Text Domain: woocommerce-cart-tab
11
  Domain Path: /languages/
@@ -135,11 +135,7 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
135
  $skin = get_option( 'wc_ct_skin' );
136
  $position = get_option( 'wc_ct_horizontal_position' );
137
  $widget = get_option( 'wc_ct_cart_widget' );
138
- $hide_widget = get_option( 'wc_ct_hide_empty_cart' );
139
 
140
- if ( sizeof( $woocommerce->cart->cart_contents ) == 0 && $hide_widget == 'yes' ) {
141
- // hide empty cart
142
- } else {
143
  if ( ! is_cart() && ! is_checkout() ) {
144
  if ( $widget == 'yes' ) {
145
  echo '<div class="' . $position . ' cart-tab ' . $skin . '">';
@@ -160,14 +156,21 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
160
  }
161
  }
162
  }
163
- }
164
 
165
 
166
  // Displays the cart total and number of items as a link
167
  function wcct_cart_button() {
168
  global $woocommerce;
 
 
 
 
 
 
 
 
169
  ?>
170
- <a href="<?php echo $woocommerce->cart->get_cart_url(); ?>" title="<?php _e( 'View your shopping cart', 'woocommerce-cart-tab' ); ?>" class="cart-parent">
171
  <?php
172
  echo $woocommerce->cart->get_cart_total();
173
  echo '<span class="contents">' . sprintf( _n( '%d item', '%d items', $woocommerce->cart->get_cart_contents_count(), 'woocommerce-cart-tab' ), $woocommerce->cart->get_cart_contents_count() ) . '</span>';
2
  /*
3
  Plugin Name: WooCommerce Cart Tab
4
  Plugin URI: http://jameskoster.co.uk/tag/cart-tab/
5
+ Version: 0.2.1
6
  Description: Displays a sitewide link to the cart which reveals the cart contents on hover.
7
  Author: jameskoster
8
+ Tested up to: 3.6.1
9
  Author URI: http://jameskoster.co.uk
10
  Text Domain: woocommerce-cart-tab
11
  Domain Path: /languages/
135
  $skin = get_option( 'wc_ct_skin' );
136
  $position = get_option( 'wc_ct_horizontal_position' );
137
  $widget = get_option( 'wc_ct_cart_widget' );
 
138
 
 
 
 
139
  if ( ! is_cart() && ! is_checkout() ) {
140
  if ( $widget == 'yes' ) {
141
  echo '<div class="' . $position . ' cart-tab ' . $skin . '">';
156
  }
157
  }
158
  }
 
159
 
160
 
161
  // Displays the cart total and number of items as a link
162
  function wcct_cart_button() {
163
  global $woocommerce;
164
+ $hide_widget = get_option( 'wc_ct_hide_empty_cart' );
165
+ if ( $woocommerce->cart->get_cart_contents_count() == 0 && $hide_widget == 'yes' ) {
166
+ // Hide empty cart
167
+ // Compatible with WP Super Cache as long as "late init" is enabled
168
+ $visibility = 'hidden';
169
+ } else {
170
+ $visibility = 'visible';
171
+ }
172
  ?>
173
+ <a href="<?php echo $woocommerce->cart->get_cart_url(); ?>" title="<?php _e( 'View your shopping cart', 'woocommerce-cart-tab' ); ?>" class="cart-parent <?php echo $visibility; ?>">
174
  <?php
175
  echo $woocommerce->cart->get_cart_total();
176
  echo '<span class="contents">' . sprintf( _n( '%d item', '%d items', $woocommerce->cart->get_cart_contents_count(), 'woocommerce-cart-tab' ), $woocommerce->cart->get_cart_contents_count() ) . '</span>';
languages/index.html CHANGED
File without changes
languages/woocommerce-cart-tab-de_DE.mo CHANGED
File without changes
languages/woocommerce-cart-tab-de_DE.po CHANGED
File without changes
languages/woocommerce-cart-tab.po CHANGED
File without changes
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: jameskoster
3
  Tags: woocommerce, ecommerce, cart
4
  Requires at least: 3.5
5
- Tested up to: 3.6
6
- Stable tag: 0.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -46,6 +46,9 @@ Thanks! Please fork the repo on <a href="https://github.com/jameskoster/woocomme
46
 
47
  == Changelog ==
48
 
 
 
 
49
  = 0.2 - 01/07/2013 =
50
  * Added option to hide cart tab if the cart is empty. Kudos azhkuro.
51
 
2
  Contributors: jameskoster
3
  Tags: woocommerce, ecommerce, cart
4
  Requires at least: 3.5
5
+ Tested up to: 3.6.1
6
+ Stable tag: 0.2.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
46
 
47
  == Changelog ==
48
 
49
+ = 0.2.1 - 16/09/2013 =
50
+ * Better way of hiding the cart. Compatible with WP Super Cache as long as "late init" is enabled. Kudos bigbrowncow.
51
+
52
  = 0.2 - 01/07/2013 =
53
  * Added option to hide cart tab if the cart is empty. Kudos azhkuro.
54
 
screenshot-1.png CHANGED
File without changes
screenshot-2.png CHANGED
File without changes
screenshot-3.png CHANGED
File without changes