Plugin Directory

Changeset 734599


Ignore:
Timestamp:
07/01/2013 11:38:32 AM (13 years ago)
Author:
jameskoster
Message:

releasing / tagging 0.2

Location:
woocommerce-cart-tab
Files:
17 added
2 edited

Legend:

Unmodified
Added
Removed
  • woocommerce-cart-tab/trunk/cart-tab.php

    r720420 r734599  
    33Plugin Name: WooCommerce Cart Tab
    44Plugin URI: http://jameskoster.co.uk/tag/cart-tab/
    5 Version: 0.1.1
     5Version: 0.2
    66Description: Displays a sitewide link to the cart which reveals the cart contents on hover.
    77Author: jameskoster
     
    4747                    array(
    4848                        'name'      => __( 'Cart Widget', 'woocommerce-cart-tab' ),
    49                         'desc'  => __( 'Display the cart widget on hover', 'woocommerce-cart-tab' ),
     49                        'desc'      => __( 'Display the cart widget on hover', 'woocommerce-cart-tab' ),
    5050                        'id'        => 'wc_ct_cart_widget',
    5151                        'type'      => 'checkbox'
     52                    ),
     53                    array(
     54                        'name'      => __( 'Hide Empty Cart', 'woocommerce-cart-tab' ),
     55                        'desc'      => __( 'Hide the cart tab if the cart is empty', 'woocommerce-cart-tab' ),
     56                        'id'        => 'wc_ct_hide_empty_cart',
     57                        'type'      => 'checkbox'
    5258                    ),
    5359                    array(
     
    7581                // Default options
    7682                add_option( 'wc_ct_cart_widget', 'yes' );
     83                add_option( 'wc_ct_hide_empty_cart', 'no' );
    7784                add_option( 'wc_ct_skin', 'light' );
    7885                add_option( 'wc_ct_horizontal_position', 'right' );
     
    126133            function woocommerce_cart_tab() {
    127134                global $woocommerce;
    128                 $skin = get_option( 'wc_ct_skin' );
    129                 $position = get_option( 'wc_ct_horizontal_position' );
    130                 $widget = get_option( 'wc_ct_cart_widget' );
    131                 if ( ! is_cart() && ! is_checkout() ) {
    132                     if ( $widget == 'yes' ) {
    133                         echo '<div class="' . $position . ' cart-tab ' . $skin . '">';
    134                     } else {
    135                         echo '<div class="' . $position . ' cart-tab no-animation ' . $skin . '">';
     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 . '">';
     146                        } else {
     147                            echo '<div class="' . $position . ' cart-tab no-animation ' . $skin . '">';
     148                        }
     149                            wcct_cart_button();
     150                            // Display the widget if specified
     151                            if ( $widget == 'yes' ) {
     152                                // Check for WooCommerce 2.0 and display the cart widget
     153                                if ( version_compare( WOOCOMMERCE_VERSION, "2.0.0" ) >= 0 ) {
     154                                    the_widget( 'WC_Widget_Cart', 'title=' );
     155                                } else {
     156                                    the_widget( 'WooCommerce_Widget_Cart', 'title=' );
     157                                }
     158                            }
     159                        echo '</div>';
    136160                    }
    137                         wcct_cart_button();
    138                         // Display the widget if specified
    139                         if ( $widget == 'yes' ) {
    140                             // Check for WooCommerce 2.0 and display the cart widget
    141                             if ( version_compare( WOOCOMMERCE_VERSION, "2.0.0" ) >= 0 ) {
    142                                 the_widget( 'WC_Widget_Cart', 'title=' );
    143                             } else {
    144                                 the_widget( 'WooCommerce_Widget_Cart', 'title=' );
    145                             }
    146                         }
    147                     echo '</div>';
    148161                }
    149162            }
  • woocommerce-cart-tab/trunk/readme.txt

    r720420 r734599  
    44Requires at least: 3.5
    55Tested up to: 3.6
    6 Stable tag: 0.1.1
     6Stable tag: 0.2
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4747== Changelog ==
    4848
     49= 0.2 - 01/07/2013 =
     50* Added option to hide cart tab if the cart is empty. Kudos azhkuro.
     51
    4952= 0.1.1 - 30/05/2013 =
    5053* Improved i18n
Note: See TracChangeset for help on using the changeset viewer.