/** * 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_shop_installed() || yit_get_option('shop-enable') == 'no') { return; } ?> <div class="yit_cart_widget widget_shopping_cart"> <div class="cart_label"> <?php list($cart_items, $cart_subtotal, $cart_icon, $cart_currency) = yit_get_current_cart_info(); ?> <a href="<?php echo WC()->cart->get_cart_url(); ?> " class="cart-items" style="background: url(<?php echo $cart_icon; ?> ) no-repeat center"> <span class="yit-mini-cart-icon"> <span class="cart-items-number"><?php echo $cart_items; ?> </span> </span> </a> </div> <div class="cart_wrapper" style="display:none"> <div class="widget_shopping_cart_content group"> <ul class="cart_list product_list_widget"> <li class="empty"><?php _e('No products in the cart.', 'yit'); ?> </li> </ul> </div> </div> <script type="text/javascript"> jQuery(document).ready(function($){ "use strict"; $(document).on('mouseover', '.cart_label', function(){ $(this).next('.cart_wrapper').fadeIn(300); }).on('mouseleave', '.cart_label', function(){ $(this).next('.cart_wrapper').fadeOut(300); }); $(document) .on('mouseenter', '.cart_wrapper', function(){ $(this).stop(true,true).show() }) .on('mouseleave', '.cart_wrapper', function(){ $(this).fadeOut(300) }); }); </script> </div> <?php }
/** * 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_shop_installed()) { return; } ?> <div class="yit_cart_widget widget_shopping_cart"> <div class="cart_label"> <?php list($cart_items, $cart_subtotal, $cart_currency) = yit_get_current_cart_info(); ?> <a href="<?php echo $woocommerce->cart->get_cart_url(); ?> " class="cart-items"> <span class="cart-items-number"><?php echo $cart_items; ?> </span> <?php echo $cart_items != 1 ? __('', 'yit') : __(' ', 'yit'); ?> </a> </div> <div class="cart_wrapper" style="display:none"> <div class="widget_shopping_cart_content group"> <ul class="cart_list product_list_widget"> <li class="empty"><?php _e('Товары не добавлены', 'yit'); ?> </li> </ul> </div> </div> <script type="text/javascript"> jQuery(document).ready(function($){ $(document).on('mouseover', '.cart_label', function(){ $(this).next('.cart_wrapper').fadeIn(300); }).on('mouseleave', '.cart_label', function(){ $(this).next('.cart_wrapper').fadeOut(300); }); $(document) .on('mouseenter', '.cart_wrapper', function(){ $(this).stop(true,true).show() }) .on('mouseleave', '.cart_wrapper', function(){ $(this).fadeOut(300) }); }); </script> </div> <?php }
/** * widget function. * * @see WP_Widget * @access public * @param array $args * @param array $instance * @return void */ function widget( $args, $instance ) { global $woocommerce; extract( $args ); $active = (bool) !( empty( $_REQUEST['add-to-cart'] ) || ! is_numeric( $_REQUEST['add-to-cart'] ) ); /* fix yith catalog mode */ $ywctm_hide_cart_page = false; global $YITH_WC_Catalog_Mode; if ( isset( $YITH_WC_Catalog_Mode ) ) { $ywctm_hide_cart_page = method_exists( $YITH_WC_Catalog_Mode, 'check_hide_cart_checkout_pages' ) && $YITH_WC_Catalog_Mode->check_hide_cart_checkout_pages(); } if( !is_shop_installed() || yit_get_option('shop-enable' ) == 'no' || ! function_exists('yit_get_current_cart_info') || $ywctm_hide_cart_page) return; ?> <div class="yit_cart_widget widget_shopping_cart"> <div class="cart_label"> <?php list( $cart_items, $cart_icon, $cart_icon_dark ) = yit_get_current_cart_info(); ?> <a href="<?php echo WC()->cart->get_cart_url(); ?>" class="cart-items" > <span class="yit-mini-cart-icon" > <span class="cart-items-number"><?php echo $cart_items ?></span> </span> <span class="yit-mini-cart-background no-dark" style="background-image: url(<?php echo $cart_icon ?>)"></span> <span class="yit-mini-cart-background only-dark" style="background-image: url(<?php echo $cart_icon_dark ?>)"></span> </a> </div> <div class="cart_wrapper <?php echo $active ? ' active' : ''; ?>" style="display:<?php echo $active ? 'block' : 'none'; ?>"> <div class="widget_shopping_cart_content group"> <?php if ( $active ) : ?> <div class="blockUI blockOverlay" style="z-index: 1000; border: none; margin: 0px; padding: 0px; width: 100%; height: 100%; top: 0px; left: 0px; cursor: none; position: absolute; opacity: 1; background: url(<?php echo YIT_THEME_ASSETS_URL ?>/images/search.gif) 50% 50% no-repeat rgb(255, 255, 255);"></div> <div class="blockUI blockMsg blockElement" style="z-index: 1011; display: none; position: absolute; left: 129px; top: 239px;"></div> <?php else : ?> <ul class="cart_list product_list_widget"> <li class="empty"><?php _e( 'No products in the cart.', 'yit' ); ?></li> </ul> <?php endif; ?> </div> </div> </div> <?php }
function yit_add_to_cart_success_ajax($datas) { list($cart_items, $cart_subtotal, $cart_icon, $cart_currency) = yit_get_current_cart_info(); $datas['.yit_cart_widget .cart_label .cart-items .yit-mini-cart-icon'] = '<span class="yit-mini-cart-icon"><span class="cart-items-number">' . $cart_items . '</span></span>'; return $datas; }
function yit_add_to_cart_success_ajax($datas) { global $woocommerce; list($cart_items, $cart_subtotal, $cart_currency) = yit_get_current_cart_info(); $label = $cart_items == 1 ? __('Товар', 'yit') : __('Товара', 'yit'); $datas['.yit_cart_widget .cart_label .cart-items'] = '<a class="cart-items" href="' . $woocommerce->cart->get_cart_url() . '"><span class="cart-items-number">' . $cart_items . '</span> ' . $label; return $datas; }
function yit_add_to_cart_success_ajax($datas) { global $woocommerce; list($cart_items, $cart_subtotal, $cart_icon, $cart_currency) = yit_get_current_cart_info(); $datas['.yit_cart_widget .cart_label .cart-items .yit-mini-cart-icon'] = '<span class=".yit-mini-cart-icon"><span class="cart-items-number">' . $cart_items . '</span></span>'; // add to cart popup ob_start(); if (isset($_REQUEST['product_id'])) { ?> <p><i></i><?php _e('You added', 'yit'); ?> <strong>"<?php echo get_the_title($_REQUEST['product_id']); ?> "</strong> <?php _e('to your cart', 'yit'); ?> </p> <?php } else { ?> <p><i></i><?php _e('You added', 'yit'); ?> <?php _e('to your cart', 'yit'); ?> </p> <?php } ?> <div class="actions"> <a class="black-button continue-shopping" href="#"><?php _e('Continue shopping', 'yit'); ?> </a> <a class="red-button view-cart" href="<?php echo $woocommerce->cart->get_cart_url(); ?> "><?php _e('View cart', 'yit'); ?> </a> <!--<a class="button view-checkout" href="<?php echo $woocommerce->cart->get_checkout_url(); ?> "><?php _e('Checkout', 'yit'); ?> </a>--> </div> <?php $datas['#popupWrap .message'] = ob_get_clean(); return $datas; }
?> <div id="header-cart-search"> <?php if ($show_cart || $show_cart_widget) { ?> <div class="cart-row group<?php if (!$responsive_header_cart) { echo ' hidden-phone'; } ?> "> <?php if ($show_cart == '1') { ?> <?php list($cart_items, $cart_subtotal, $cart_currency) = yit_get_current_cart_info(); ?> <?php list($cart_integer, $cart_decimal) = yit_format_cart_subtotal($cart_subtotal); ?> <div class="cart-items cart-items-icon"> <span class="cart-items-number"><?php echo $cart_items; ?> </span> <span class="cart-items-label"><?php echo $cart_items != 1 ? __('Items', 'yit') : __('Item', 'yit'); ?> </span> </div>
function yit_add_to_cart_success_ajax( $datas ) { if( defined( 'DOING_AJAX' ) && DOING_AJAX ) { list( $cart_items, $cart_subtotal, $cart_currency ) = yit_get_current_cart_info(); wpml_cart_fix_sts( $datas ); list( $cart_integer, $cart_decimal ) = yit_format_cart_subtotal( $cart_subtotal ); $datas['#header-cart-search .cart-subtotal-integer'] = '<span class="cart-subtotal-integer">' . $cart_integer . '</span>'; $datas['#header-cart-search .cart-subtotal-decimal'] = '<span class="cart-subtotal-decimal">' . $cart_decimal . '</span>'; $datas['#header-cart-search .cart-subtotal-currency'] = '<span class="cart-subtotal-currency">' . $cart_currency . '</span>'; } return $datas; }
function yit_add_to_cart_success_ajax($datas) { list($cart_items, $cart_total) = yit_get_current_cart_info(); $datas['.yit_cart_widget .cart_label .yit-mini-cart-icon'] = '<span class="yit-mini-cart-icon"> <span class="cart-items-number">' . $cart_items . '</span> - <span class="cart-total">' . $cart_total . '</span> </span>'; // add to cart popup ob_start(); ?> <div class="added_to_cart"> <?php if (isset($_REQUEST['product_id'])) { ?> <div class="product-image"><?php echo get_the_post_thumbnail($_REQUEST['product_id'], 'shop_thumbnail'); ?> </div> <div class="product-info"> <h3 class="product-name"><?php echo get_the_title($_REQUEST['product_id']); ?> </h3> <span class="message"><?php _e('was added to your cart', 'yit'); ?> </span> </div> <?php } else { ?> <p><?php _e('You added', 'yit'); ?> <?php _e('to your cart', 'yit'); ?> </p> <?php } ?> <div class="actions"> <a class="btn btn-ghost" href="<?php echo WC()->cart->get_cart_url(); ?> "><?php _e('View cart', 'yit'); ?> </a> <a class="btn btn-flat-red continue-shopping" href="#"><?php _e('Continue to shop', 'yit'); ?> </a> </div> </div> <?php $datas['#popupWrap .message'] = ob_get_clean(); return $datas; }
/** * widget function. * * @see WP_Widget * @access public * @param array $args * @param array $instance * @return void */ function widget($args, $instance) { global $woocommerce; extract($args); $active = (bool) (!(empty($_REQUEST['add-to-cart']) || !is_numeric($_REQUEST['add-to-cart']))); $icon_cart = yit_image("echo=no&src=" . yit_get_option('shop-mini-cart-icon') . "&getimagesize=1&class=icon-bg&alt=" . __('Mini Cart', 'yit')); if (!is_shop_installed() || yit_get_option('shop-enable') == 'no' || !function_exists('yit_get_current_cart_info')) { return; } ?> <div class="yit_cart_widget widget_shopping_cart"> <?php list($cart_items, $cart_total) = yit_get_current_cart_info(); ?> <a class="cart_label cart-items" href="<?php echo WC()->cart->get_cart_url(); ?> "> <?php echo $icon_cart; ?> <span class="yit-mini-cart-icon"> <span class="cart-items-number"><?php echo $cart_items; ?> </span> - <span class="cart-total"><?php echo $cart_total; ?> </span> </span> </a> <div class="cart_wrapper <?php echo $active ? ' active' : ''; ?> "> <div class="widget_shopping_cart_content group"> <?php if ($active) { ?> <div class="blockUI blockOverlay" style="z-index: 1000; border: none; margin: 0px; padding: 0px; width: 100%; height: 100%; top: 0px; left: 0px; cursor: none; position: absolute; opacity: 1; background: url(<?php echo YIT_THEME_ASSETS_URL; ?> /images/search.gif) 50% 50% no-repeat rgb(255, 255, 255);"></div> <div class="blockUI blockMsg blockElement" style="z-index: 1011; display: none; position: absolute; left: 129px; top: 239px;"></div> <?php } else { ?> <ul class="cart_list product_list_widget"> <li class="empty"><?php _e('No products in the cart.', 'yit'); ?> </li> </ul> <?php } ?> </div> </div> </div> <?php }
function yit_add_to_cart_success_ajax($datas) { global $woocommerce; list($cart_items, $cart_subtotal, $cart_currency) = yit_get_current_cart_info(); $datas['#header-cart-search .cart-items-number'] = '<span class="cart-items-number">' . $cart_items . '</span>'; $datas['#header-cart-search .cart-items-label'] = '<span class="cart-items-label">' . ($cart_items != 1 ? __("Items", 'yit') : __('Item', 'yit')) . '</span>'; list($cart_integer, $cart_decimal) = yit_format_cart_subtotal($cart_subtotal); $datas['#header-cart-search .cart-subtotal-integer'] = '<span class="cart-subtotal-integer">' . $cart_integer . '</span>'; $datas['#header-cart-search .cart-subtotal-decimal'] = '<span class="cart-subtotal-decimal">' . $cart_decimal . '</span>'; $datas['#header-cart-search .cart-subtotal-currency'] = '<span class="cart-subtotal-currency">' . $cart_currency . '</span>'; return $datas; }