示例#1
0
 /** @see WP_Widget::widget */
 function widget($args, $instance)
 {
     if (is_cart()) {
         return;
     }
     extract($args);
     if (!empty($instance['title'])) {
         $title = $instance['title'];
     } else {
         $title = __('Cart', 'jigoshop');
     }
     $title = apply_filters('widget_title', $title, $instance, $this->id_base);
     echo $before_widget;
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     echo '<ul class="cart_list">';
     if (sizeof(jigoshop_cart::$cart_contents) > 0) {
         foreach (jigoshop_cart::$cart_contents as $item_id => $values) {
             $_product = $values['data'];
             if ($_product->exists() && $values['quantity'] > 0) {
                 echo '<li><a href="' . get_permalink($item_id) . '">';
                 if (has_post_thumbnail($item_id)) {
                     echo get_the_post_thumbnail($item_id, 'shop_tiny');
                 } else {
                     echo '<img src="' . jigoshop::plugin_url() . '/assets/images/placeholder.png" alt="Placeholder" width="' . jigoshop::get_var('shop_tiny_w') . '" height="' . jigoshop::get_var('shop_tiny_h') . '" />';
                 }
                 echo apply_filters('jigoshop_cart_widget_product_title', $_product->get_title(), $_product) . '</a> ' . $values['quantity'] . ' &times; ' . jigoshop_price($_product->get_price()) . '</li>';
             }
         }
     } else {
         echo '<li class="empty">' . __('No products in the cart.', 'jigoshop') . '</li>';
     }
     echo '</ul>';
     if (sizeof(jigoshop_cart::$cart_contents) > 0) {
         echo '<p class="total"><strong>';
         if (get_option('js_prices_include_tax') == 'yes') {
             _e('Total', 'jigoshop');
         } else {
             _e('Subtotal', 'jigoshop');
         }
         echo ':</strong> ' . jigoshop_cart::get_cart_total();
         echo '</p>';
         do_action('jigoshop_widget_shopping_cart_before_buttons');
         echo '<p class="buttons"><a href="' . jigoshop_cart::get_cart_url() . '" class="button">' . __('View Cart &rarr;', 'jigoshop') . '</a> <a href="' . jigoshop_cart::get_checkout_url() . '" class="button checkout">' . __('Checkout &rarr;', 'jigoshop') . '</a></p>';
     }
     echo $after_widget;
 }
示例#2
0
 function st_header_extras()
 {
     $extras = "<div class=\"header_extras\">";
     $extras .= '<a href="' . jigoshop_cart::get_cart_url() . '" class="minicart">';
     $extras .= '<span>';
     $extras .= jigoshop_cart::$cart_contents_count . ' items';
     $extras .= '</span>';
     $extras .= jigoshop_cart::get_cart_total();
     $extras .= '</a>';
     $extras .= "</div>";
     echo apply_filters('child_header_extras', $extras);
 }
示例#3
0
    function jbst_cart_dropdown()
    {
        global $current_user;
        get_currentuserinfo();
        global $jigoshop;
        ?>
			  <div class="btn-group pull-right" id="nav-cart-dropdown">
			    <a class="btn dropdown-toggle <?php 
        jbst_nav_shop_button_class();
        ?>
" data-toggle="dropdown" href="#">
			      <i class="glyphicon glyphicon-shopping-cart"></i> <span class="cart-contents"><?php 
        echo sprintf(_n('%d item &ndash; ', '%d items &ndash; ', jigoshop_cart::$cart_contents_count, 'jigoshop'), jigoshop_cart::$cart_contents_count) . jigoshop_cart::get_cart_total();
        ?>
</span>
			      <span class="caret"></span>
			    </a>
			    <ul class="dropdown-menu">
			      <li><a href="<?php 
        echo jigoshop_cart::get_cart_url();
        ?>
">View Cart</a></li>
			      <li class="divider"></li>
			      <li><a href="<?php 
        echo jigoshop_cart::get_checkout_url();
        ?>
">Checkout</a></li>
			    </ul>
			  </div>
			<?php 
    }
示例#4
0
    function wallpress_jigo_minicart()
    {
        ?>
<div id="jigo_minicart">
	<a href="#" class="minicart"><i class="fa fa-shopping-cart"></i></a>
	<div class="cartlist">
		<div class="cat-inner">
		<?php 
        $cart_contents = class_exists('jigoshop_cart') ? jigoshop_cart::$cart_contents : '';
        ?>
		
        <?php 
        if (!empty($cart_contents)) {
            ?>

			<ul class="cart_list">
		
			<?php 
            foreach ($cart_contents as $key => $value) {
                ?>

			<?php 
                $_product = $value['data'];
                ?>

			<?php 
                if ($_product->exists() && $value['quantity'] > 0) {
                    ?>
                <li class="clearfix">
                    <a href="<?php 
                    echo esc_attr(get_permalink($_product->id));
                    ?>
" title="<?php 
                    echo esc_attr($_product->get_title());
                    ?>
">
                        <?php 
                    echo has_post_thumbnail($_product->id) ? get_the_post_thumbnail($_product->id, 'shop_tiny') : jigoshop_get_image_placeholder('shop_tiny');
                    ?>
                        <h4 class="js_widget_product_title"><?php 
                    echo $_product->get_title();
                    ?>
</h4>
                    </a>
                    <div class="js_widget_product_price">
                        <span class="price"><?php 
                    echo $_product->get_price_html();
                    ?>
</span>
                        <?php 
                    _e(' &middot; QTY', 'dw-wallpress');
                    echo $value['quantity'];
                    ?>
                    </div>
                </li>
			<?php 
                }
                ?>
			<?php 
            }
            ?>
			</ul>
			<p class="total">
				<strong><?php 
            _e(get_option('jigoshop_prices_include_tax') == 'yes' ? 'Total' : 'Subtotal', 'dw-wallpress');
            ?>
</strong>
				<span class="totalNum"><?php 
            echo jigoshop_cart::get_cart_total();
            ?>
</span>
			</p>
			<?php 
            do_action('jigoshop_widget_cart_before_buttons');
            ?>
			<p class="buttons clearfix">
				<a href="<?php 
            echo esc_attr(jigoshop_cart::get_cart_url());
            ?>
" class="button">
					<?php 
            _e('View Cart &rarr;', 'dw-wallpress');
            ?>
				</a>
				<a href="<?php 
            echo esc_attr(jigoshop_cart::get_checkout_url());
            ?>
" class="button checkout">
					<?php 
            _e('Checkout &rarr;', 'dw-wallpress');
            ?>
				</a>
			</p>
		<?php 
        } else {
            ?>
			<span class="empty"><?php 
            _e('No products in the cart.', 'dw-wallpress');
            ?>
</span>
		<?php 
        }
        ?>
		</div>
	</div>
</div>
<?php 
    }
示例#5
0
 /**
  * Widget
  *
  * Display the widget in the sidebar
  * Save output to the cache if empty
  *
  * @param	array	sidebar arguments
  * @param	array	instance
  */
 public function widget($args, $instance)
 {
     // Hide widget if page is the cart
     if (is_cart()) {
         return false;
     }
     extract($args);
     // Set the widget title
     $title = apply_filters('widget_title', $instance['title'] ? $instance['title'] : __('Cart', 'jigoshop'), $instance, $this->id_base);
     // Print the widget wrapper & title
     echo $before_widget;
     echo $before_title . $title . $after_title;
     // Get the contents of the cart
     $cart_contents = jigoshop_cart::$cart_contents;
     // If there are items in the cart print out a list of products
     if (!empty($cart_contents)) {
         // Open the list
         echo '<ul class="cart_list">';
         $i = 0;
         $cnt = count($cart_contents);
         foreach ($cart_contents as $key => $value) {
             $i++;
             if ($i == $cnt) {
                 $litm = ' class="last"';
             }
             // Get product instance
             $_product = $value['data'];
             if ($_product->exists() && $value['quantity'] > 0) {
                 echo '<li' . $litm . '>';
                 // Print the product image & title with a link to the permalink
                 echo '<a href="' . esc_url(jigoshop_cart::get_remove_url($key)) . '" class="remove">';
                 echo '&times;</a><div class="cart-extra">';
                 echo '<a href="' . esc_attr(get_permalink($_product->id)) . '" title="' . esc_attr($_product->get_title()) . '">';
                 echo '<span class="image-holder">';
                 // Print the product thumbnail image if exists else display placeholder
                 echo has_post_thumbnail($_product->id) ? get_the_post_thumbnail($_product->id, 'shop_tiny') : jigoshop_get_image_placeholder('shop_tiny');
                 echo '</span>';
                 // Print the product title
                 echo '<span class="js_widget_product_title">' . $_product->get_title() . '</span>';
                 echo '</a>';
                 // Print the quantity & price per product
                 echo '<span class="js_widget_product_price">' . $value['quantity'] . ' &times; ' . $_product->get_price_html() . '</span>';
                 echo '</span></li>';
             }
         }
         echo '</ul>';
         // Close the list
         // Print the cart total
         echo '<p class="total"><strong>';
         echo __($this->jigoshop_options->get_option('jigoshop_prices_include_tax') == 'yes' ? 'Total' : 'Subtotal', 'jigoshop');
         echo ':</strong> ' . jigoshop_cart::get_cart_total();
         echo '</p>';
         do_action('jigoshop_widget_cart_before_buttons');
         // Print view cart & checkout buttons
         $view_cart_button_label = isset($instance['view_cart_button']) ? $instance['view_cart_button'] : __('View Cart &rarr;', 'jigoshop');
         $checkout_button_label = isset($instance['checkout_button']) ? $instance['checkout_button'] : __('Checkout &rarr;', 'jigoshop');
         echo '<p class="buttons">';
         echo '<a href="' . esc_attr(jigoshop_cart::get_cart_url()) . '" class="button">' . __($view_cart_button_label, 'jigoshop') . '</a>';
         echo '<a href="' . esc_attr(jigoshop_cart::get_checkout_url()) . '" class="button checkout">' . __($checkout_button_label, 'jigoshop') . '</a>';
         echo '</p>';
     } else {
         echo '<span class="empty">' . __('No products in the cart.', 'jigoshop') . '</span>';
     }
     // Print closing widget wrapper
     echo $after_widget;
 }