예제 #1
0
 /**
  * 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']) ? __('Cart', 'woocommerce') : $instance['title'], $instance, $this->id_base);
     $hide_if_empty = empty($instance['hide_if_empty']) ? 0 : 1;
     if ($hide_if_empty) {
         echo '<div class="hide_cart_widget_if_empty">';
     }
     echo $before_widget;
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     $_Twoot_Woo = new Twoot_Woo();
     $url = $_Twoot_Woo->shop_urls();
     $total_text = get_option('js_prices_include_tax') == 'yes' ? esc_attr__('Total', 'woocommerce') : esc_attr__('Subtotal', 'woocommerce');
     echo '<ul id="widget-woo-cart" class="cart-list clearfix">';
     if (sizeof($woocommerce->cart->cart_contents) > 0) {
         foreach ($woocommerce->cart->cart_contents as $cart_item_key => $cart_item) {
             $_product = $cart_item['data'];
             if ($_product->exists() && $cart_item['quantity'] > 0) {
                 echo '<li class="cart-item clearfix">';
                 echo '<div class="item-img"><a href="' . get_permalink($cart_item['product_id']) . '">' . $_product->get_image() . '</a></div>';
                 echo '<div class="item-info">';
                 echo '<a href="' . get_permalink($cart_item['product_id']) . '" class="title">' . apply_filters('woocommerce_cart_widget_product_title', $_product->get_title(), $_product) . '</a>';
                 echo '<span class="quantity">' . esc_attr__('Quantity:', 'woocommerce') . ' ' . $cart_item['quantity'] . '</span>';
                 echo '<span class="price">' . woocommerce_price($_product->get_price()) . '</span>';
                 echo '</div>';
                 echo '</li>';
             }
         }
         echo '<li class="total"><strong>' . $total_text . ': </strong>' . $woocommerce->cart->get_cart_total() . '</li>';
         echo '<li class="buttons">';
         echo '<a href="' . $url['cart'] . '" class="button button-dark button-medium">' . esc_attr__('View Cart', 'woocommerce') . '</a>';
         echo '<a href="' . $url['checkout'] . '" class="button button-dark button-medium checkout">' . esc_attr__('Checkout', 'woocommerce') . '</a>';
         echo '</li>';
     } else {
         echo '<li class="empty">' . esc_attr__('No products in the cart.', 'woocommerce') . '</li>';
     }
     echo '</ul>';
     echo $after_widget;
     if ($hide_if_empty) {
         echo '</div>';
     }
 }
예제 #2
0
 /**
  * 
  *  Woo Responsive  Mini Cart
  */
 function responsive_mini_cart()
 {
     global $woocommerce;
     $_Twoot_Woo = new Twoot_Woo();
     $url = $_Twoot_Woo->shop_urls();
     $html = '<a href="' . $url['cart'] . '" class="responsive-mini-cart"><i class="twoot-icon-shop"></i><em class="item-counts">' . $woocommerce->cart->cart_contents_count . '</em></a>';
     return $html;
 }
예제 #3
0
 /**
  * Include required core files used in admin and on the frontend.
  *
  * @since   1.0.0
  */
 function includes()
 {
     include_once TWOOT_PATH . '/theme/classes/class-frontend.php';
     include_once TWOOT_PATH . '/theme/classes/class-checked.php';
     include_once TWOOT_PATH . '/theme/classes/class-sidebar.php';
     $this->options();
     if (is_admin()) {
         $this->admin_includes();
     }
     if (!is_admin()) {
         $this->frontend_includes();
     }
     include_once TWOOT_PATH . '/theme/functions/function-common.php';
     include_once TWOOT_PATH . '/theme/functions/google-fonts.php';
     if (twoot_get_checked_func('woo_activated')) {
         require_once TWOOT_PATH . '/theme-woocommerce/woo.php';
         require_once TWOOT_PATH . '/theme-woocommerce/woo-generator.php';
         $_Twoot_Woo = new Twoot_Woo();
         $_Twoot_Woo->init();
     }
     if (twoot_get_checked_func('wpml_activated')) {
         require_once TWOOT_PATH . '/theme-wpml/wpml-generator.php';
     }
 }