Exemplo n.º 1
0
    function shopping_cartdropdown()
    {
        if (class_exists('WooCommerce')) {
            global $woocommerce;
            ?>
            <div class="top-cart dropdown text-right">
                <i class="pull-right fa fa-shopping-cart"></i>
                <h3 class="cart">
                    <?php 
            echo __('Shopping Cart', TEXTDOMAIN);
            ?>
                </h3>
                <a class="dropdown-toggle cart-contents" href="#" data-toggle="dropdown" data-hover="dropdown" data-delay="0" title="<?php 
            _e('View your shopping cart', 'woothemes');
            ?>
">
                    <?php 
            echo sprintf(_n('%d item', '%d items', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count);
            ?>
 - <?php 
            echo $woocommerce->cart->get_cart_total();
            ?>
                </a>
                <div class="dropdown-menu">
                    <?php 
            woocommerce_mini_cart();
            ?>
                </div>
            </div>
        <?php 
        }
    }
Exemplo n.º 2
0
 /**
  * Get a refreshed cart fragment
  */
 public static function get_refreshed_fragments()
 {
     // Get mini cart
     ob_start();
     woocommerce_mini_cart();
     $mini_cart = ob_get_clean();
     // Fragments and mini cart are returned
     $data = array('fragments' => apply_filters('add_to_cart_fragments', array('div.widget_shopping_cart_content' => '<div class="widget_shopping_cart_content">' . $mini_cart . '</div>')), 'cart_hash' => WC()->cart->get_cart() ? md5(json_encode(WC()->cart->get_cart())) : '');
     wp_send_json($data);
 }
Exemplo n.º 3
0
function kt_get_refreshed_fragments($fragments)
{
    // Get mini cart
    ob_start();
    woocommerce_mini_cart();
    $mini_cart = ob_get_clean();
    // Fragments and mini cart are returned
    $fragments['div.kt-header-mini-cart-refreash'] = '<div class="kt-header-mini-cart-refreash">' . $mini_cart . '</div>';
    return $fragments;
}
Exemplo n.º 4
0
/**
 * woocommerce_get_refreshed_fragments function.
 *
 * @access public
 * @return void
 */
function woocommerce_get_refreshed_fragments()
{
    global $woocommerce;
    header('Content-Type: application/json; charset=utf-8');
    // Get mini cart
    ob_start();
    woocommerce_mini_cart();
    $mini_cart = ob_get_clean();
    // Fragments and mini cart are returned
    $data = array('fragments' => apply_filters('add_to_cart_fragments', array('div.widget_shopping_cart_content' => '<div class="widget_shopping_cart_content">' . $mini_cart . '</div>')), 'cart_hash' => $woocommerce->cart->get_cart() ? md5(json_encode($woocommerce->cart->get_cart())) : '');
    echo json_encode($data);
    die;
}
Exemplo n.º 5
0
function mtc_btn_show_cart()
{
    if (function_exists('woocommerce_mini_cart')) {
        ?>
<div class="button-user-cart">
	<a id="button-toggle-mini-cart" class="btn btn-success btn-block" href="#"><i class="icon-shopping-cart icon-large"></i> <span>Cart</span></a>
	<div id="data-cart" class="hide fast animated">
		<?php 
        woocommerce_mini_cart();
        ?>
	</div>
</div>
<?php 
    }
}
Exemplo n.º 6
0
    /**
     * Outputs the HTML for this widget.
     *
     * @param array $args     An array of standard parameters for widgets in this theme
     * @param array $instance An array of settings for this widget instance
     *
     * @return void Echoes it's output
     */
    public function widget($args, $instance)
    {
        if (!function_exists('is_woocommerce')) {
            return;
        }
        global $woocommerce;
        $instance = wp_parse_args($instance, $this->defaults);
        extract($args);
        if ($title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base)) {
            echo $before_title . esc_html($title) . $after_title;
        }
        echo $before_widget;
        ?>

		<div class="mini-cart">
			<a href="<?php 
        echo esc_url($woocommerce->cart->get_cart_url());
        ?>
" class="cart-contents" title="<?php 
        esc_attr_e('View your shopping cart', 'bigboom');
        ?>
">
				<i class="fa fa-shopping-cart"></i>
				<span class="mini-cart-counter"><?php 
        echo intval($woocommerce->cart->cart_contents_count);
        ?>
 <span><?php 
        _e('item(s)', 'bigboom');
        ?>
</span></span>
				- <?php 
        echo $woocommerce->cart->get_cart_total();
        ?>
				<span class="arrow"><i class="fa fa-arrow-right"></i></span>
			</a>

			<div id="mini-cart-content" class="mini-cart widget_shopping_cart_content"><?php 
        woocommerce_mini_cart();
        ?>
</div>
		</div>

		<?php 
        echo $after_widget;
    }
Exemplo n.º 7
0
function circleflip_wc_mini_cart($args = array())
{
    ?>
	<div id="cf-mini-cart" class="cart-dropdown <?php 
    echo sizeof(WC()->cart->get_cart()) > 0 ? 'cart-has-items' : 'cart-is-empty';
    ?>
">
		<div class="cart-dropdown-header">
			<span class="icon-basket-1"></span>
		</div>
		<div class="cart-dropdown-elements">
			<?php 
    woocommerce_mini_cart($args);
    ?>
		</div>
	</div>
	<?php 
}
 function thb_woo_cart()
 {
     global $woocommerce, $cart_class;
     if (thb_check_minicart_display() == false) {
         return;
     }
     echo "<div class='thb-mini-cart-icon " . $cart_class . "'>";
     echo "<span class='thb-product-numbers'>" . $woocommerce->cart->cart_contents_count . "</span>";
     echo "<a href='" . $woocommerce->cart->get_cart_url() . "' id='thb-cart-trigger'>a</a>";
     echo "<div class='thb_mini_cart_wrapper'>";
     echo "<div class='widget_shopping_cart_content'>";
     woocommerce_mini_cart();
     echo "</div>";
     echo "</div>";
     echo "</div>";
 }
Exemplo n.º 9
0
    function etheme_top_cart($load_cart = false)
    {
        global $woocommerce;
        ?>
		
			<div class="shopping-container" <?php 
        if (etheme_get_option('favicon_badge')) {
            echo 'data-fav-badge="enable"';
        }
        ?>
>
				<div class="shopping-cart-widget" id='basket'>
					<a href="<?php 
        echo esc_url($woocommerce->cart->get_cart_url());
        ?>
" class="cart-summ" data-items-count="<?php 
        echo $woocommerce->cart->cart_contents_count;
        ?>
">
					<div class="cart-bag">
						<i class='ico-sum'></i>
						<?php 
        et_cart_number();
        ?>
					</div>
					
					<?php 
        et_cart_total();
        ?>
						
					</a>
				</div>

				<div class="cart-popup-container">
					<div class="cart-popup">
						<?php 
        if ($load_cart) {
            woocommerce_mini_cart();
        } else {
            echo '<div class="widget_shopping_cart_content"></div>';
        }
        ?>
					</div>
				</div>
			</div>
			

    <?php 
    }
Exemplo n.º 10
0
	
	<?php
		
	 /*
	Istället för att kundvagnen skall läggas till 
	som en widget så skrivs widgeten ut här automatiskt.
	(Förutsatt att WooCoomerce finns installerad)
	*/	
		
	if ( class_exists( 'WooCommerce' ) ) {
	?>
	<div class="sidebar-widget kundvagn-widget">
			<div id="woocommerce_widget_cart-3" class="woocommerce widget_shopping_cart">
				<h3>Your Cart</h3>
				<div class="hide_cart_widget_if_empty"><div class="widget_shopping_cart_content">
					<? woocommerce_mini_cart( $args );?>
				</div>
		</div></div>	
	</div>	
	<? } ?>
	
	<div class="sidebar-widget">
		<?php if(!function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebar-1')) ?>
	</div>
		
		<a href="http://www.seydel1847.de/"><img src="<?=get_template_directory_uri();?>/img/aside-seydel.jpg" alt="Seydel" class="sidebar-img"></a>
		<a href="http://www.seydel1847.de/"><img src="<?=get_template_directory_uri();?>/img/aside-1847.jpg" alt="1847" class="sidebar-img"></a>		
	
	<div class="sidebar-widget">
		<?php if(!function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebar-2')) ?>
	</div>
Exemplo n.º 11
0
function takeaway_show_mini_cart()
{
    return woocommerce_mini_cart();
    wp_die();
}
Exemplo n.º 12
0
    function wpo_cartdropdown()
    {
        if (WPO_WOOCOMMERCE_ACTIVED) {
            global $woocommerce;
            ?>
            <div id="cart" class="dropdown">
                <span class="text-skin cart-icon">
                    <i class="icon-cart2"></i>
                </span>
                <a class="dropdown-toggle mini-cart" data-toggle="dropdown" aria-expanded="true" role="button" aria-haspopup="true" data-delay="0" href="#" title="<?php 
            _e('View your shopping cart', 'woothemes');
            ?>
">
                    <span class="title-cart"><?php 
            _e('My Cart ', TEXTDOMAIN);
            ?>
</span>
                    <?php 
            echo sprintf(_n(' <span class="mini-cart-items"> %d item </span> ', ' <span class="mini-cart-items"> %d items - </span> ', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count);
            ?>
 <?php 
            echo trim($woocommerce->cart->get_cart_total());
            ?>
                </a>
                <div class="dropdown-menu">
                    <?php 
            woocommerce_mini_cart();
            ?>
                </div>
            </div>
        <?php 
        }
    }
Exemplo n.º 13
0
function flatsome_add_to_cart_dropdown($fragments)
{
    global $woocommerce;
    global $flatsome_opt;
    ob_start();
    ?>
	<div class="cart-inner">
	<a href="<?php 
    echo esc_url($woocommerce->cart->get_cart_url());
    ?>
" class="cart-link">
                    <strong class="cart-name hide-for-small"><?php 
    _e('Cart', 'woocommerce');
    ?>
</strong> 
					<span class="cart-price hide-for-small">/ <?php 
    echo $woocommerce->cart->get_cart_subtotal();
    ?>
</span> 
                        
					<!-- cart icon -->
					<div class="cart-icon">
                        <?php 
    if ($flatsome_opt['custom_cart_icon']) {
        ?>
 
                        <div class="custom-cart-inner">
                        <div class="custom-cart-count"><?php 
        echo $woocommerce->cart->cart_contents_count;
        ?>
</div>
                        <img class="custom-cart-icon" alt="<?php 
        _e('Cart', 'woocommerce');
        ?>
" src="<?php 
        echo $flatsome_opt['custom_cart_icon'];
        ?>
"/> 
                        </div><!-- .custom-cart-inner -->
                        <?php 
    } else {
        ?>
 

                         <strong><?php 
        echo $woocommerce->cart->cart_contents_count;
        ?>
</strong>
                         <span class="cart-icon-handle"></span>
                        <?php 
    }
    ?>
					</div><!-- end cart icon -->

					</a>
							<div  class="nav-dropdown">
                                <div id="mini-cart-content" class="nav-dropdown-inner widget_shopping_cart widget_shopping_cart_content">
                                <?php 
    if (sizeof($woocommerce->cart->cart_contents) > 0) {
        echo woocommerce_mini_cart();
    } else {
        echo '<p class="empty">' . __('No products in the cart.', 'woocommerce') . '</p>';
    }
    ?>
                                                                        
                            </div><!-- .nav-dropdown-inner -->
						</div><!-- .nav-dropdown -->
	</div><!-- .cart-inner -->

	<?php 
    $fragments['.cart-inner'] = ob_get_clean();
    return $fragments;
}
Exemplo n.º 14
0
 public function minicart_remove_item()
 {
     global $woocommerce;
     $response = array();
     if (!isset($_GET['item']) && !isset($_GET['_wpnonce'])) {
         exit;
     }
     $woocommerce->cart->set_quantity($_GET['item'], 0);
     $cart_total = $woocommerce->cart->get_cart_total();
     $cart_count = absint($woocommerce->cart->cart_contents_count);
     $response['minicart_text'] = $cart_count;
     $response['minicart'] = $this->_get_minicart(true);
     // widget cart update
     ob_start();
     woocommerce_mini_cart();
     $mini_cart = ob_get_clean();
     $response['widget'] = '<div class="widget_shopping_cart_content">' . $mini_cart . '</div>';
     echo json_encode($response);
     exit;
 }
Exemplo n.º 15
0
    function wpo_cartdropdown()
    {
        if (class_exists('WooCommerce')) {
            global $woocommerce;
            ?>
            <div class="dropdown cart-header">
                <h4>购物车</h4>
                <a class="dropdown-toggle cart-dropdown" data-toggle="dropdown" data-hover="dropdown" data-delay="0" href="#" title="<?php 
            _e('View your shopping cart', 'woothemes');
            ?>
">
                    <?php 
            echo sprintf(_n('%d item', '%d items', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count);
            ?>
 - <?php 
            echo $woocommerce->cart->get_cart_total();
            ?>
                </a>
                <div class="dropdown-menu">
                    <?php 
            woocommerce_mini_cart();
            ?>
                </div>
            </div>
        <?php 
        }
    }
Exemplo n.º 16
0
function wpo_cartdropdown()
{
    global $woocommerce;
    ?>
    <div class="dropdown">
        <!-- <h4>Shopping Cart</h4> -->
        <a class="dropdown-toggle mini-cart" data-toggle="dropdown" data-hover="dropdown" data-delay="0" href="#" title="<?php 
    _e('View your shopping cart', 'woothemes');
    ?>
">
            <i class="fa fa-shopping-cart"></i>
            <?php 
    echo sprintf(_n('%d item', '%d items', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count);
    ?>
 - <?php 
    echo $woocommerce->cart->get_cart_total();
    ?>
        </a>
        <div class="dropdown-menu">
            <?php 
    woocommerce_mini_cart();
    ?>
        </div>
    </div>
<?php 
}
    function widget($args, $instance)
    {
        $instance = wp_parse_args($instance, $this->default_values);
        if (empty($instance['show_on_checkout']) && (is_cart() || is_checkout())) {
            return;
        }
        $woocommerce = WC();
        $before_widget = $after_widget = $before_title = $after_title = '';
        extract($args, EXTR_OVERWRITE);
        $hide_if_empty = empty($instance['hide_if_empty']) ? 0 : 1;
        $popup_align = $instance['popup_align'] == 'left' ? 'left' : 'right';
        echo $before_widget;
        $title = apply_filters('widget_title', $instance['title']);
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        $cart_contents_count = $woocommerce->cart->get_cart_contents_count();
        ?>
        <div class="widget_shopping_mini_cart_content" id="<?php 
        echo $this->id;
        ?>
-content">
            <?php 
        if (!$hide_if_empty || $cart_contents_count > 0) {
            ?>
                <div class="dropdown-cart-button <?php 
            echo $hide_if_empty ? 'hide_dropdown_cart_widget_if_empty' : '';
            ?>
" style="<?php 
            echo $hide_if_empty && sizeof($woocommerce->cart->get_cart()) == 0 ? "display:none;" : "";
            ?>
">
                    <a href="#" class="dropdown-total"><?php 
            echo $cart_contents_count . '' . _n(__('x', 'woocommerce-ddc'), __('x', 'woocommerce-dc'), $cart_contents_count);
            ?>
 - <?php 
            echo $woocommerce->cart->get_cart_subtotal();
            ?>
</a>
                    <div class="dropdown dropdown-<?php 
            echo $popup_align;
            ?>
">
                        <?php 
            woocommerce_mini_cart();
            ?>
                        <div class="clear"></div>
                    </div>
                </div>
            <?php 
        } else {
            ?>
                <script type="text/javascript">
                    jQuery(function($){
                        $('#<?php 
            echo $this->id;
            ?>
').hide();
                    });
                </script>
            <?php 
        }
        ?>
        </div>
        <?php 
        echo $after_widget;
    }
Exemplo n.º 18
0
/**
 * Prints Top Bar content
 * @param type $type : Menu type
 * @param type $position : Right or Left
 */
function tt_bar_content($bar_content = 'text1', $footer = false)
{
    global $smof_data;
    $splitedValues = explode(',', trim($bar_content));
    foreach ($splitedValues as $value) {
        $type = trim($value);
        $pref = 'top_';
        if ($footer) {
            $pref = 'footer_';
        }
        if ($type == 'social') {
            ob_start();
            social_links_by_icon($footer);
            $result = ob_get_clean();
            echo '<div class="topbar-item">' . $result . '</div>';
        } elseif ($type == 'shop') {
            global $woocommerce;
            if (isset($woocommerce->cart)) {
                $cart = $woocommerce->cart;
                // Get mini cart
                ob_start();
                woocommerce_mini_cart();
                $mini_cart = ob_get_clean();
                echo '<div class="woocommerce-shcart woocommerce topbar-item hidden-sm hidden-xs">
                        <div class="shcart-display">
                            <i class="fa fa-shopping-cart"></i>' . __('Cart', 'themeton') . '
                            <span class="total-cart">' . $cart->cart_contents_count . '</span>
                        </div>
                        <div class="shcart-content">
                            <div class="widget_shopping_cart_content">' . $mini_cart . '</div>
                        </div>
                      </div>';
            } else {
                echo '<div class="topbar-item">' . __('Please install Woocommerce.', 'themeton') . '</div>';
            }
        } elseif ($type == 'lang') {
            global $wp_filter;
            if (isset($wp_filter['icl_language_selector'])) {
                ob_start();
                do_action('icl_language_selector');
                $result = ob_get_clean();
                echo '<div class="topbar-item">' . $result . '</div>';
            } else {
                echo '<div class="topbar-item">' . __('Please install WPML.', 'themeton') . '</div>';
            }
        } elseif ($type == 'menu') {
            ob_start();
            wp_nav_menu(array('theme_location' => $pref . 'bar-menu', 'fallback_cb' => '', 'depth' => 1, 'menu_class' => 'list-inline'));
            $result = ob_get_clean();
            echo '<div class="topbar-item">' . $result . '</div>';
        } elseif ($type == 'text1' || $type == 'text2') {
            if (isset($smof_data[$pref . 'bar_' . $type])) {
                $result = '<span class="bar-text">' . do_shortcode($smof_data[$pref . 'bar_' . $type]) . '</span>';
                echo '<div class="topbar-item">' . $result . '</div>';
            }
        } else {
            if ($type == 'login') {
                $link = get_edit_user_link();
                $text = __('Login / Register', 'themeton');
                if (function_exists('is_shop')) {
                    $link = get_permalink(get_option('woocommerce_myaccount_page_id'));
                } else {
                    if (!is_user_logged_in()) {
                        $link = wp_login_url();
                    }
                }
                if (is_user_logged_in()) {
                    $text = __('My Account', 'themeton');
                }
                $result = '<div class="topbar-item login-item">
                            <a href="' . $link . '">' . $text . '</a>
                       </div>';
                echo $result;
            }
        }
    }
}
Exemplo n.º 19
0
function ajax_get_mini_cart()
{
    woocommerce_mini_cart();
    exit;
}
Exemplo n.º 20
0
    ?>
                                <ul class="topmenu">
                                    <li><a href="#login" class="smallimg vbplogin"><span><?php 
    _e('LOGIN', 'vibe');
    ?>
</span></a></li>
                                    <?php 
    if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins'))) || function_exists('is_plugin_active_for_network') && is_plugin_active_for_network('woocommerce/woocommerce.php')) {
        global $woocommerce;
        ?>
                                    <li><a class="smallimg vbpcart"><span class="fa fa-shopping-cart"><?php 
        echo $woocommerce->cart->cart_contents_count ? '<em>' . $woocommerce->cart->cart_contents_count . '</em>' : '';
        ?>
</span></a>
                                    <div class="woocart"><?php 
        woocommerce_mini_cart();
        ?>
</div>
                                    </li>
                                    <?php 
    }
    ?>
                                </ul>
                            <?php 
}
?>
                        <?php 
$style = vibe_get_login_style();
if (empty($style)) {
    $style = 'default_login';
}
Exemplo n.º 21
0
function kleo_woo_remove_item()
{
    global $woocommerce;
    $response = array();
    if (!isset($_GET['kleo_item']) && !isset($_GET['_wpnonce'])) {
        exit;
    }
    WC()->cart->set_quantity($_GET['kleo_item'], 0);
    $cart_count = $woocommerce->cart->cart_contents_count;
    $response['count'] = $cart_count != 0 ? $cart_count : "";
    $response['cart'] = kleo_woo_get_mini_cart(true);
    //widget cart update
    ob_start();
    woocommerce_mini_cart();
    $mini_cart = ob_get_clean();
    $response['widget'] = '<div class="widget_shopping_cart_content">' . $mini_cart . '</div>';
    echo json_encode($response);
    exit;
}
    /**
     * widget function.
     *
     * @see WP_Widget
     * @access public
     * @param array $args
     * @param array $instance
     * @return void
     */
    function widget($args, $instance)
    {
        global $woocommerce;
        extract($args);
        if (is_cart() || is_checkout()) {
            return;
        }
        $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
        $hide_if_empty = empty($instance['hide_if_empty']) ? 0 : 1;
        echo $before_widget;
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        global $woocommerce;
        ?>
        <div class="widget_shopping_mini_cart_content">
            <?php 
        if (!$hide_if_empty || sizeof($woocommerce->cart->get_cart()) > 0) {
            ?>
                <div class="dropdown-cart-button <?php 
            echo $hide_if_empty ? 'hide_dropdown_cart_widget_if_empty' : '';
            ?>
" style="<?php 
            echo $hide_if_empty && sizeof($woocommerce->cart->get_cart()) == 0 ? "display:none;" : "";
            ?>
">
                    <a href="#" class="dropdown-total"><?php 
            echo sizeof($woocommerce->cart->get_cart());
            ?>
 <?php 
            _e('items(s)', 'woocommerce-ddc');
            ?>
 - <?php 
            echo $woocommerce->cart->get_cart_subtotal();
            ?>
</a>
                    <div class="dropdown">
                        <?php 
            woocommerce_mini_cart();
            ?>
                        <div class="clear"></div>
                    </div>
                </div>
            <?php 
        } else {
            ?>
                <script type="text/javascript">
                    jQuery(function($){
                        $('#<?php 
            echo $this->id;
            ?>
').hide();
                    });
                </script>
            <?php 
        }
        ?>
        </div>
        <?php 
        echo $after_widget;
    }
Exemplo n.º 23
0
 public function minicart_remove_item()
 {
     global $woocommerce;
     $response = array();
     if (!isset($_GET['item']) && !isset($_GET['_wpnonce'])) {
         exit;
     }
     $woocommerce->cart->set_quantity($_GET['item'], 0);
     $cart_total = $woocommerce->cart->get_cart_total();
     $cart_count = absint($woocommerce->cart->cart_contents_count);
     $response['minicart_text'] = dh_get_theme_option('header-style', 'below') === 'center' || dh_get_theme_option('site-style', 'default') == 'creative' ? $cart_count : $cart_total;
     $response['minicart'] = $this->_get_minicart(true);
     // widget cart update
     ob_start();
     woocommerce_mini_cart();
     $mini_cart = ob_get_clean();
     $response['widget'] = '<div class="widget_shopping_cart_content">' . $mini_cart . '</div>';
     echo json_encode($response);
     exit;
 }