Esempio n. 1
0
    function sf_woo_header_add_to_cart_fragment($fragments)
    {
        global $woocommerce;
        ob_start();
        $cart_count = $woocommerce->cart->cart_contents_count;
        $cart_count_text = sf_product_items_text($cart_count);
        ?>
	
				
			<li class="parent shopping-bag-item">
				<a class="cart-contents" href="<?php 
        echo $woocommerce->cart->get_cart_url();
        ?>
" title="<?php 
        _e('View your shopping cart', 'swiftframework');
        ?>
"><i class="ss-cart"></i><?php 
        echo $woocommerce->cart->get_cart_total();
        ?>
</a>
			
				<ul class="sub-menu">     
					<li>                                      
						<div class="shopping-bag">
			 				
							<?php 
        if ($cart_count != "0") {
            ?>
							
								<div class="bag-header"><?php 
            echo $cart_count_text;
            ?>
 <?php 
            _e('in the shopping bag', 'swiftframework');
            ?>
</div>
								
								<div class="bag-contents">
									
									<?php 
            foreach ($woocommerce->cart->cart_contents as $cart_item_key => $cart_item) {
                ?>
								    	
								    	<?php 
                $bag_product = $cart_item['data'];
                $product_title = $bag_product->get_title();
                ?>
								                                          
								        <?php 
                if ($bag_product->exists() && $cart_item['quantity'] > 0) {
                    ?>
                                            
								        
								        	<div class="bag-product clearfix">   	
							            	
								            	<figure><a class="bag-product-img" href="<?php 
                    echo get_permalink($cart_item['product_id']);
                    ?>
"><?php 
                    echo $bag_product->get_image();
                    ?>
</a></figure>                   
									            
									            <div class="bag-product-details">
									           		<div class="bag-product-title">
									           			<a href="<?php 
                    echo get_permalink($cart_item['product_id']);
                    ?>
">
									           				<?php 
                    echo apply_filters('woocommerce_cart_widget_product_title', $product_title, $bag_product);
                    ?>
</a>
									           		</div>
									            	<div class="bag-product-price"><?php 
                    _e("Unit Price:", "swiftframework");
                    ?>
 <?php 
                    echo woocommerce_price($bag_product->get_price());
                    ?>
</div>
									            	<div class="bag-product-quantity"><?php 
                    _e('Quantity:', 'swiftframework');
                    ?>
 <?php 
                    echo $cart_item['quantity'];
                    ?>
</div>
									            </div>
									            	
									            <?php 
                    echo apply_filters('woocommerce_cart_item_remove_link', sprintf('<a href="%s" class="remove" title="%s">&times;</a>', esc_url($woocommerce->cart->get_remove_url($cart_item_key)), __('Remove this item', 'woocommerce')), $cart_item_key);
                    ?>
									            
									    	</div>
								    	
								    	<?php 
                }
                ?>
								    	
								    <?php 
            }
            ?>
							    
							    </div>
							    
							    <div class="bag-buttons">
							    
							    	<a class="sf-button standard sf-icon-reveal bag-button" href="<?php 
            echo esc_url($woocommerce->cart->get_cart_url());
            ?>
"><i class="ss-view"></i><span class="text"><?php 
            _e('View shopping bag', 'swiftframework');
            ?>
</span></a>
							    
							    	<a class="sf-button standard sf-icon-reveal checkout-button" href="<?php 
            echo esc_url($woocommerce->cart->get_checkout_url());
            ?>
"><i class="ss-creditcard"></i><span class="text"><?php 
            _e('Proceed to checkout', 'swiftframework');
            ?>
</span></a>
							                    
								</div>
				
							<?php 
        } else {
            ?>
									
								<div class="bag-header"><?php 
            _e("0 items in the shopping bag", "swiftframework");
            ?>
</div>
									
								<div class="bag-empty"><?php 
            _e('Unfortunately, your shopping bag is empty.', 'swiftframework');
            ?>
</div>                                   
														
								<div class="bag-buttons">
									
									<?php 
            $shop_page_url = "";
            if (version_compare(WOOCOMMERCE_VERSION, "2.1.0") >= 0) {
                $shop_page_url = get_permalink(wc_get_page_id('shop'));
            } else {
                $shop_page_url = get_permalink(woocommerce_get_page_id('shop'));
            }
            ?>
									
									<a class="sf-button standard sf-icon-reveal checkout-button" href="<?php 
            echo esc_url($shop_page_url);
            ?>
"><i class="ss-cart"></i><span class="text"><?php 
            _e('Go to the shop', 'swiftframework');
            ?>
</span></a>
																            	                
								</div>
									
							<?php 
        }
        ?>
				
							</div>
						</li>                                                                                                    
					</ul>                                                                                                          
				</li>
				
			<?php 
        $fragments['.shopping-bag-item'] = ob_get_clean();
        return $fragments;
    }
    function sf_woo_header_add_to_cart_fragment($fragments)
    {
        global $woocommerce, $sf_options;
        ob_start();
        $show_cart_count = false;
        if (isset($sf_options['show_cart_count'])) {
            $show_cart_count = $sf_options['show_cart_count'];
        }
        if (sf_theme_opts_name() == "sf_atelier_options") {
            $cart_total = '<span class="menu-item-title">' . __("Cart", "swiftframework") . '</span>';
        } else {
            $cart_total = WC()->cart->get_cart_total();
        }
        $cart_count = $woocommerce->cart->cart_contents_count;
        $cart_count_text = sf_product_items_text($cart_count);
        $cart_count_text_alt = sf_product_items_text($cart_count, true);
        $view_cart_icon = apply_filters('sf_view_cart_icon', '<i class="ss-view"></i>');
        $checkout_icon = apply_filters('sf_checkout_icon', '<i class="ss-creditcard"></i>');
        $go_to_shop_icon = apply_filters('sf_go_to_shop_icon', '<i class="ss-cart"></i>');
        $extra_class = "";
        if ($cart_count != "0") {
            $extra_class .= "cart-not-empty ";
        }
        ?>

            <li class="parent shopping-bag-item <?php 
        echo $extra_class;
        ?>
">

                <?php 
        if ($show_cart_count) {
            ?>

                    <a class="cart-contents" href="<?php 
            echo esc_url($woocommerce->cart->get_cart_url());
            ?>
"
                       title="<?php 
            _e('View your shopping cart', 'swiftframework');
            ?>
">
                       <?php 
            echo apply_filters('sf_header_cart_icon', '<i class="ss-cart"></i>');
            echo $cart_total;
            ?>
<span class="num-items cart-count-enabled"><?php 
            echo $cart_count_text_alt;
            ?>
</span></a>

                <?php 
        } else {
            ?>

                    <a class="cart-contents" href="<?php 
            echo esc_url($woocommerce->cart->get_cart_url());
            ?>
"
                       title="<?php 
            _e('View your shopping cart', 'swiftframework');
            ?>
"><?php 
            echo apply_filters('sf_header_cart_icon', '<i class="ss-cart"></i>');
            echo $cart_total;
            ?>
<span class="num-items"><?php 
            echo $cart_count_text_alt;
            ?>
</span></a>

                <?php 
        }
        ?>

                <ul class="sub-menu">
                    <li>

                        <div class="shopping-bag" data-empty-bag-txt="<?php 
        _e('Your cart is empty.', 'swiftframework');
        ?>
" data-singular-item-txt="<?php 
        _e('item in the cart', 'swiftframework');
        ?>
" data-multiple-item-txt="<?php 
        _e('items in the cart', 'swiftframework');
        ?>
">

                          <div class="loading-overlay"><i class="sf-icon-loader"></i></div>

                            <?php 
        if ($cart_count != "0") {
            ?>

                                <div
                                    class="bag-header"><?php 
            echo $cart_count_text;
            ?>
 <?php 
            _e('in the cart', 'swiftframework');
            ?>
</div>

                                <div class="bag-contents">

                                    <?php 
            foreach (WC()->cart->get_cart() as $cart_item_key => $cart_item) {
                ?>

                                        <?php 
                $_product = apply_filters('woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key);
                $product_title = $_product->get_title();
                $price = apply_filters('woocommerce_cart_item_price', $woocommerce->cart->get_product_price($_product), $cart_item, $cart_item_key);
                ?>

                                        <?php 
                $variation_id_class = '';
                if ($cart_item['variation_id'] > 0) {
                    $variation_id_class = ' product-var-id-' . $cart_item['variation_id'];
                }
                if ($_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters('woocommerce_cart_item_visible', true, $cart_item, $cart_item_key)) {
                    ?>

                                            	<div class="bag-product clearfix  product-id-<?php 
                    echo $cart_item['product_id'];
                    echo $variation_id_class;
                    ?>
">

                                                <figure><a class="bag-product-img"
                                                           href="<?php 
                    echo get_permalink($cart_item['product_id']);
                    ?>
"><?php 
                    echo $_product->get_image();
                    ?>
</a>
                                                </figure>

                                                <div class="bag-product-details">
                                                    <div class="bag-product-title">
                                                        <a href="<?php 
                    echo get_permalink($cart_item['product_id']);
                    ?>
">
                                                            <?php 
                    echo apply_filters('woocommerce_cart_widget_product_title', $product_title, $_product);
                    ?>
</a>
                                                    </div>
                                                    <div
                                                        class="bag-product-price"><?php 
                    _e("Unit Price:", "swiftframework");
                    ?>
 <?php 
                    echo $price;
                    ?>
</div>
                                                    <div
                                                        class="bag-product-quantity"><?php 
                    _e('Quantity:', 'swiftframework');
                    ?>
 <?php 
                    echo $cart_item['quantity'];
                    ?>
</div>
                                                </div>

												<a href="#" class="remove-product remove" data-ajaxurl="<?php 
                    echo admin_url('admin-ajax.php');
                    ?>
" data-product-id="<?php 
                    echo $cart_item['product_id'];
                    ?>
"   data-variation-id="<?php 
                    echo $cart_item['variation_id'];
                    ?>
"     data-product-qty="<?php 
                    echo $cart_item['quantity'];
                    ?>
" title="<?php 
                    echo __('Remove this item', 'swiftframework');
                    ?>
">&times;</a>
 
                                            </div>

                                        <?php 
                }
                ?>

                                    <?php 
            }
            ?>

                                </div>

                                <?php 
            if (sf_theme_opts_name() == "sf_atelier_options") {
                ?>

				                    <div class="bag-total">
				                    	<?php 
                if (class_exists('Woocommerce_German_Market')) {
                    ?>
					                    <span class="total-title"><?php 
                    _e("Total incl. tax", "swiftframework");
                    ?>
</span>
					                    <?php 
                } else {
                    ?>
					                    <span class="total-title"><?php 
                    _e("Total", "swiftframework");
                    ?>
</span>
					                    <?php 
                }
                ?>
										<span class="total-amount"><?php 
                echo WC()->cart->get_cart_total();
                ?>
</span>
				                    </div>

			                    <?php 
            }
            ?>

                                <div class="bag-buttons">

                                    <a class="sf-button standard sf-icon-reveal bag-button" href="<?php 
            echo esc_url($woocommerce->cart->get_cart_url());
            ?>
">
                                    	<?php 
            echo $view_cart_icon;
            ?>
                                   		<span class="text"><?php 
            _e('View cart', 'swiftframework');
            ?>
</span>
                                   	</a>

                                    <a class="sf-button standard sf-icon-reveal checkout-button" href="<?php 
            echo esc_url($woocommerce->cart->get_checkout_url());
            ?>
">
                                    	<?php 
            echo $checkout_icon;
            ?>
                                    	<span class="text"><?php 
            _e('Proceed to checkout', 'swiftframework');
            ?>
</span>
                                    </a>

                                </div>

                            <?php 
        } else {
            ?>

                                <div class="bag-empty"><?php 
            _e('Your cart is empty.', 'swiftframework');
            ?>
</div>

                            <?php 
        }
        ?>

                        </div>
                    </li>
                </ul>
            </li>

            <?php 
        $fragments['.shopping-bag-item'] = ob_get_clean();
        return $fragments;
    }
Esempio n. 3
0
 *
 * @author 		WooThemes
 * @package 	WooCommerce/Templates
 * @version     2.3.8
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
if (version_compare(WOOCOMMERCE_VERSION, "2.1.0") >= 0) {
    wc_print_notices();
}
?>

<?php 
$cart_count = sf_product_items_text(WC()->cart->cart_contents_count);
do_action('woocommerce_before_cart');
?>

<form action="<?php 
echo esc_url(WC()->cart->get_cart_url());
?>
" method="post">

	<div class="row">
		
		<div class="col-sm-9">
		
			<h3 class="bag-summary"><?php 
_e('Your selection', 'swiftframework');
?>
Esempio n. 4
0
    function sf_get_cart()
    {
        $cart_output = "";
        // Check if WooCommerce is active
        if (sf_woocommerce_activated()) {
            global $woocommerce, $sf_options;
            $show_cart_count = false;
            if (isset($sf_options['show_cart_count'])) {
                $show_cart_count = $sf_options['show_cart_count'];
            }
            if (sf_theme_opts_name() == "sf_atelier_options") {
                $cart_total = '<span class="menu-item-title">' . __("Cart", "swiftframework") . '</span>';
            } else {
                $cart_total = WC()->cart->get_cart_total();
            }
            $cart_count = $woocommerce->cart->cart_contents_count;
            $cart_count_text = sf_product_items_text($cart_count);
            $cart_count_text_alt = sf_product_items_text($cart_count, true);
            $view_cart_icon = apply_filters('sf_view_cart_icon', '<i class="ss-view"></i>');
            $checkout_icon = apply_filters('sf_checkout_icon', '<i class="ss-creditcard"></i>');
            $go_to_shop_icon = apply_filters('sf_go_to_shop_icon', '<i class="ss-cart"></i>');
            if ($show_cart_count) {
                $cart_output .= '<li class="parent shopping-bag-item"><a class="cart-contents" href="' . $woocommerce->cart->get_cart_url() . '" title="' . __("View your shopping cart", "swiftframework") . '">' . apply_filters('sf_header_cart_icon', '<i class="ss-cart"></i>') . '<span class="cart-text">' . __("Cart", "swiftframework") . '</span>' . $cart_total . '<span class="num-items cart-count-enabled">' . $cart_count_text_alt . '</span></a>';
            } else {
                $cart_output .= '<li class="parent shopping-bag-item"><a class="cart-contents" href="' . $woocommerce->cart->get_cart_url() . '" title="' . __("View your shopping cart", "swiftframework") . '">' . apply_filters('sf_header_cart_icon', '<i class="ss-cart"></i>') . '<span class="cart-text">' . __("Cart", "swiftframework") . '</span>' . $cart_total . '<span class="num-items">' . $cart_count_text_alt . '</span></a>';
            }
            $cart_output .= '<ul class="sub-menu">';
            $cart_output .= '<li>';
            $cart_output .= '<div class="shopping-bag" data-empty-bag-txt="' . __('Your cart is empty.', 'swiftframework') . '" data-singular-item-txt="' . __('item in the cart', 'swiftframework') . '" data-multiple-item-txt="' . __('items in the cart', 'swiftframework') . '">';
            $cart_output .= '<div class="loading-overlay"><i class="sf-icon-loader"></i></div>';
            if ($cart_count != "0") {
                $cart_output .= '<div class="bag-header">' . $cart_count_text . ' ' . __('in the cart', 'swiftframework') . '</div>';
                $cart_output .= '<div class="bag-contents">';
                foreach (WC()->cart->get_cart() as $cart_item_key => $cart_item) {
                    $_product = apply_filters('woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key);
                    $product_id = apply_filters('woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key);
                    if ($_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters('woocommerce_cart_item_visible', true, $cart_item, $cart_item_key)) {
                        $product_price = apply_filters('woocommerce_cart_item_price', WC()->cart->get_product_price($_product), $cart_item, $cart_item_key);
                        $product_title = $_product->get_title();
                        $product_short_title = strlen($product_title) > 25 ? substr($product_title, 0, 22) . '...' : $product_title;
                        $cart_output .= '<div class="bag-product clearfix product-id-' . $cart_item['product_id'] . '">';
                        $cart_output .= '<figure><a class="bag-product-img" href="' . get_permalink($cart_item['product_id']) . '">' . $_product->get_image() . '</a></figure>';
                        $cart_output .= '<div class="bag-product-details">';
                        $cart_output .= '<div class="bag-product-title"><a href="' . get_permalink($cart_item['product_id']) . '">' . apply_filters('woocommerce_cart_widget_product_title', $product_short_title, $_product) . '</a></div>';
                        $cart_output .= '<div class="bag-product-price">' . __("Unit Price:", 'swiftframework') . '
	                        ' . $product_price . '</div>';
                        $cart_output .= '<div class="bag-product-quantity">' . __('Quantity:', 'swiftframework') . ' ' . apply_filters('woocommerce_widget_cart_item_quantity', '<span class="quantity">' . sprintf('%s &times; %s', $cart_item['quantity'], $product_price) . '</span>', $cart_item, $cart_item_key) . '</div>';
                        $cart_output .= '</div>';
                        $cart_output .= apply_filters('woocommerce_cart_item_remove_link', sprintf('<a href="%s" class="remove remove-product" title="%s" data-ajaxurl="' . admin_url('admin-ajax.php') . '" data-product-qty="' . $cart_item['quantity'] . '"  data-product-id="%s" data-product_sku="%s">&times;</a>', esc_url(WC()->cart->get_remove_url($cart_item_key)), __('Remove this item', 'swiftframework'), esc_attr($product_id), esc_attr($_product->get_sku())), $cart_item_key);
                        $cart_output .= '</div>';
                    }
                }
                $cart_output .= '</div>';
                if (sf_theme_opts_name() == "sf_atelier_options" || sf_theme_opts_name() == "sf_uplift_options") {
                    $cart_output .= '<div class="bag-total">';
                    if (class_exists('Woocommerce_German_Market')) {
                        $cart_output .= '<span class="total-title">' . __("Total incl. tax", "swiftframework") . '</span>';
                    } else {
                        $cart_output .= '<span class="total-title">' . __("Total", "swiftframework") . '</span>';
                    }
                    $cart_output .= '<span class="total-amount">' . WC()->cart->get_cart_total() . '</span>';
                    $cart_output .= '</div>';
                }
                $cart_output .= '<div class="bag-buttons">';
                $cart_output .= '<a class="sf-button standard sf-icon-reveal bag-button" href="' . esc_url($woocommerce->cart->get_cart_url()) . '">' . $view_cart_icon . '<span class="text">' . __('View cart', 'swiftframework') . '</span></a>';
                $cart_output .= '<a class="sf-button standard sf-icon-reveal checkout-button" href="' . esc_url($woocommerce->cart->get_checkout_url()) . '">' . $checkout_icon . '<span class="text">' . __('Checkout', 'swiftframework') . '</span></a>';
                $cart_output .= '</div>';
            } else {
                $cart_output .= '<div class="bag-empty">' . __('Your cart is empty.', 'swiftframework') . '</div>';
            }
            $cart_output .= '</div>';
            $cart_output .= '</li>';
            $cart_output .= '</ul>';
            $cart_output .= '</li>';
        }
        return $cart_output;
    }
Esempio n. 5
0
    function sf_get_cart()
    {
        $cart_output = "";
        // Check if WooCommerce is active
        if (sf_woocommerce_activated()) {
            global $woocommerce;
            $cart_total = $woocommerce->cart->get_cart_total();
            $cart_count = $woocommerce->cart->cart_contents_count;
            $cart_count_text = sf_product_items_text($cart_count);
            $cart_output .= '<li class="parent shopping-bag-item"><a class="cart-contents" href="' . $woocommerce->cart->get_cart_url() . '" title="' . __("View your shopping cart", "swiftframework") . '"><i class="ss-cart"></i>' . $cart_total . '</a>';
            $cart_output .= '<ul class="sub-menu">';
            $cart_output .= '<li>';
            $cart_output .= '<div class="shopping-bag">';
            if ($cart_count != "0") {
                $cart_output .= '<div class="bag-header">' . $cart_count_text . ' ' . __('in the shopping bag', 'swiftframework') . '</div>';
                $cart_output .= '<div class="bag-contents">';
                foreach ($woocommerce->cart->cart_contents as $cart_item_key => $cart_item) {
                    $bag_product = $cart_item['data'];
                    $product_title = $bag_product->get_title();
                    $product_short_title = strlen($product_title) > 25 ? substr($product_title, 0, 22) . '...' : $product_title;
                    if ($bag_product->exists() && $cart_item['quantity'] > 0) {
                        $cart_output .= '<div class="bag-product clearfix">';
                        $cart_output .= '<figure><a class="bag-product-img" href="' . get_permalink($cart_item['product_id']) . '">' . $bag_product->get_image() . '</a></figure>';
                        $cart_output .= '<div class="bag-product-details">';
                        $cart_output .= '<div class="bag-product-title"><a href="' . get_permalink($cart_item['product_id']) . '">' . apply_filters('woocommerce_cart_widget_product_title', $product_short_title, $bag_product) . '</a></div>';
                        $cart_output .= '<div class="bag-product-price">' . __("Unit Price:", "swiftframework") . ' 
	                        ' . woocommerce_price($bag_product->get_price()) . '</div>';
                        $cart_output .= '<div class="bag-product-quantity">' . __('Quantity:', 'swiftframework') . ' ' . $cart_item['quantity'] . '</div>';
                        $cart_output .= '</div>';
                        $cart_output .= apply_filters('woocommerce_cart_item_remove_link', sprintf('<a href="%s" class="remove" title="%s">&times;</a>', esc_url($woocommerce->cart->get_remove_url($cart_item_key)), __('Remove this item', 'woocommerce')), $cart_item_key);
                        $cart_output .= '</div>';
                    }
                }
                $cart_output .= '</div>';
                $cart_output .= '<div class="bag-buttons">';
                if (version_compare(WOOCOMMERCE_VERSION, "2.1.0") >= 0) {
                    $cart_url = apply_filters('woocommerce_get_checkout_url', WC()->cart->get_cart_url());
                    $checkout_url = apply_filters('woocommerce_get_checkout_url', WC()->cart->get_checkout_url());
                    $cart_output .= '<a class="sf-button standard sf-icon-reveal bag-button" href="' . esc_url($cart_url) . '"><i class="ss-view"></i><span class="text">' . __('View shopping bag', 'swiftframework') . '</span></a>';
                    $cart_output .= '<a class="sf-button standard sf-icon-reveal checkout-button" href="' . esc_url($checkout_url) . '"><i class="ss-creditcard"></i><span class="text">' . __('Proceed to checkout', 'swiftframework') . '</span></a>';
                } else {
                    $cart_output .= '<a class="sf-button standard sf-icon-reveal bag-button" href="' . esc_url($woocommerce->cart->get_cart_url()) . '"><i class="ss-view"></i><span class="text">' . __('View shopping bag', 'swiftframework') . '</span></a>';
                    $cart_output .= '<a class="sf-button standard sf-icon-reveal checkout-button" href="' . esc_url($woocommerce->cart->get_checkout_url()) . '"><i class="ss-creditcard"></i><span class="text">' . __('Proceed to checkout', 'swiftframework') . '</span></a>';
                }
                $cart_output .= '</div>';
            } else {
                $cart_output .= '<div class="bag-header">' . __("0 items in the shopping bag", "swiftframework") . '</div>';
                $cart_output .= '<div class="bag-empty">' . __('Unfortunately, your shopping bag is empty.', 'swiftframework') . '</div>';
                $shop_page_url = "";
                if (version_compare(WOOCOMMERCE_VERSION, "2.1.0") >= 0) {
                    $shop_page_url = get_permalink(wc_get_page_id('shop'));
                } else {
                    $shop_page_url = get_permalink(woocommerce_get_page_id('shop'));
                }
                $cart_output .= '<div class="bag-buttons">';
                $cart_output .= '<a class="sf-button standard sf-icon-reveal shop-button" href="' . esc_url($shop_page_url) . '"><i class="ss-cart"></i><span class="text">' . __('Go to the shop', 'swiftframework') . '</span></a>';
                $cart_output .= '</div>';
            }
            $cart_output .= '</div>';
            $cart_output .= '</li>';
            $cart_output .= '</ul>';
            $cart_output .= '</li>';
        }
        return $cart_output;
    }
Esempio n. 6
0
    function sf_get_cart()
    {
        $cart_output = "";
        // Check if WooCommerce is active
        if (sf_woocommerce_activated()) {
            global $woocommerce, $sf_options;
            $show_cart_count = false;
            if (isset($sf_options['show_cart_count'])) {
                $show_cart_count = $sf_options['show_cart_count'];
            }
            $cart_total = "";
            if (sf_theme_opts_name() == "sf_atelier_options") {
                $cart_total = '<span class="menu-item-title">' . __("Cart", "swiftframework") . '</span>';
            }
            if ($woocommerce->tax_display_cart == 'excl') {
                $cart_total .= wc_price($woocommerce->cart->get_total());
            } else {
                $cart_total .= wc_price($woocommerce->cart->cart_contents_total + $woocommerce->cart->tax_total);
            }
            $cart_count = $woocommerce->cart->cart_contents_count;
            $cart_count_text = sf_product_items_text($cart_count);
            $cart_count_text_alt = sf_product_items_text($cart_count, true);
            $view_cart_icon = apply_filters('sf_view_cart_icon', '<i class="ss-view"></i>');
            $checkout_icon = apply_filters('sf_checkout_icon', '<i class="ss-creditcard"></i>');
            $go_to_shop_icon = apply_filters('sf_go_to_shop_icon', '<i class="ss-cart"></i>');
            if ($show_cart_count) {
                $cart_output .= '<li class="parent shopping-bag-item"><a class="cart-contents" href="' . $woocommerce->cart->get_cart_url() . '" title="' . __("View your shopping cart", "swiftframework") . '">' . apply_filters('sf_header_cart_icon', '<i class="ss-cart"></i>') . $cart_total . '<span class="num-items cart-count-enabled">' . $cart_count_text_alt . '</span></a>';
            } else {
                $cart_output .= '<li class="parent shopping-bag-item"><a class="cart-contents" href="' . $woocommerce->cart->get_cart_url() . '" title="' . __("View your shopping cart", "swiftframework") . '">' . apply_filters('sf_header_cart_icon', '<i class="ss-cart"></i>') . $cart_total . '<span class="num-items">' . $cart_count_text_alt . '</span></a>';
            }
            $cart_output .= '<ul class="sub-menu">';
            $cart_output .= '<li>';
            $cart_output .= '<div class="shopping-bag">';
            $cart_output .= '<div class="loading-overlay"><i class="sf-icon-loader"></i></div>';
            if ($cart_count != "0") {
                $cart_output .= '<div class="bag-header">' . $cart_count_text . ' ' . __('in the cart', 'swiftframework') . '</div>';
                $cart_output .= '<div class="bag-contents">';
                foreach ($woocommerce->cart->cart_contents as $cart_item_key => $cart_item) {
                    $_product = apply_filters('woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key);
                    $price = apply_filters('woocommerce_cart_item_price', $woocommerce->cart->get_product_price($_product), $cart_item, $cart_item_key);
                    $product_title = $_product->get_title();
                    $product_short_title = strlen($product_title) > 25 ? substr($product_title, 0, 22) . '...' : $product_title;
                    if ($_product->exists() && $cart_item['quantity'] > 0) {
                        $cart_output .= '<div class="bag-product clearfix">';
                        $cart_output .= '<figure><a class="bag-product-img" href="' . get_permalink($cart_item['product_id']) . '">' . $_product->get_image() . '</a></figure>';
                        $cart_output .= '<div class="bag-product-details">';
                        $cart_output .= '<div class="bag-product-title"><a href="' . get_permalink($cart_item['product_id']) . '">' . apply_filters('woocommerce_cart_widget_product_title', $product_short_title, $_product) . '</a></div>';
                        $cart_output .= '<div class="bag-product-price">' . __("Unit Price:", "swiftframework") . '
	                        ' . $price . '</div>';
                        $cart_output .= '<div class="bag-product-quantity">' . __('Quantity:', 'swiftframework') . ' ' . $cart_item['quantity'] . '</div>';
                        $cart_output .= '</div>';
                        $cart_output .= '<a href="#" class="remove remove-product" title="' . __('Remove this item', 'swiftframework') . '">&times;</a>';
                        $cart_output .= '</div>';
                    }
                }
                $cart_output .= '</div>';
                if (sf_theme_opts_name() == "sf_atelier_options") {
                    $cart_output .= '<div class="bag-total">';
                    $cart_output .= '<span class="total-title">' . __("Total", "swiftframework") . '</span>';
                    $cart_output .= '<span class="total-amount">' . $cart_total . '</span>';
                    $cart_output .= '</div>';
                }
                $cart_output .= '<div class="bag-buttons">';
                $cart_output .= '<a class="sf-button standard sf-icon-reveal bag-button" href="' . esc_url($woocommerce->cart->get_cart_url()) . '">' . $view_cart_icon . '<span class="text">' . __('View cart', 'swiftframework') . '</span></a>';
                $cart_output .= '<a class="sf-button standard sf-icon-reveal checkout-button" href="' . esc_url($woocommerce->cart->get_checkout_url()) . '">' . $checkout_icon . '<span class="text">' . __('Proceed to checkout', 'swiftframework') . '</span></a>';
                $cart_output .= '</div>';
            } else {
                $cart_output .= '<div class="bag-empty">' . __('Your cart is empty.', 'swiftframework') . '</div>';
            }
            $cart_output .= '</div>';
            $cart_output .= '</li>';
            $cart_output .= '</ul>';
            $cart_output .= '</li>';
        }
        return $cart_output;
    }
Esempio n. 7
0
	
		<?php 
    do_action('woocommerce_cart_collaterals');
    ?>
	
	</div>
	
	<?php 
    do_action('woocommerce_after_cart');
    ?>
	
<?php 
} else {
    global $woocommerce;
    $woocommerce->show_messages();
    $cart_count = sf_product_items_text($woocommerce->cart->cart_contents_count);
    global $sf_include_isotope, $sf_has_products;
    $sf_include_isotope = true;
    $sf_has_products = true;
    ?>
	
	<?php 
    do_action('woocommerce_before_cart');
    ?>
		
	<form action="<?php 
    echo esc_url($woocommerce->cart->get_cart_url());
    ?>
" method="post">
	
		<div class="row">