예제 #1
0
function waxom_woocommerce_product_details()
{
    echo '<div class="vntd-product-excerpt">';
    echo waxom_excerpt(20, false);
    echo '</div>';
    echo '<div class="vntd-product-details btn btn-style-default btn-dark btn-icon accent-hover-bg"><i class="fa fa-file-text-o"></i>' . esc_html__('View Details', 'waxom') . '</div>';
    echo '<div class="vntd-product-price">';
    woocommerce_template_loop_price();
    echo '<div class="vntd-product-rating">';
    woocommerce_template_loop_rating();
    echo '</div>';
    echo '</div>';
    echo '</div>';
    // End details
}
예제 #2
0
do_action('woocommerce_before_shop_loop_item_title');
?>

		    <?php 
/**
 * woocommerce_after_shop_loop_item_title hook
 *
 * @hooked woocommerce_template_loop_price - 10
 */
do_action('woocommerce_after_shop_loop_item_title');
?>

	    </a>
        
        <?php 
woocommerce_template_loop_rating();
?>
        
        <div class="product-details">

            <?php 
if (version_compare($venedor_woo_version, '2.4', '<')) {
    ?>
                <a href="<?php 
    the_permalink();
    ?>
"><h3><?php 
    the_title();
    ?>
</h3></a>
            <?php 
 /**
  * Outputs WooCommerce product rating on product listing and loops.
  * Tested to work only on product listing and loops. Not meant for product pages.
  * @access public
  * @return void
  */
 public function wpv_woo_products_rating_on_listing_func()
 {
     global $post, $woocommerce;
     ob_start();
     if (is_object($woocommerce)) {
         //WooCommerce plugin activated
         //Check if this is a product listing page
         $product_listing_check = $this->wcviews_is_woocommerce_listing();
         if ($product_listing_check) {
             //Executable only on product listing pages with sensible $products
             $product = $this->wcviews_setup_product_data($post);
             if (isset($product)) {
                 if (function_exists('woocommerce_template_loop_rating')) {
                     //Call WooCommerce core public function on outputting product ratings on listing pages
                     woocommerce_template_loop_rating();
                 }
                 $listing_rating_output = ob_get_clean();
                 $listing_rating_output = trim($listing_rating_output);
                 return $listing_rating_output;
             }
         }
     }
 }
예제 #4
0
        function widget($args, $instance)
        {
            if (!ts_has_woocommerce()) {
                return;
            }
            extract($args);
            $title = apply_filters('widget_title', $instance['title']);
            $limit = $instance['limit'] != 0 ? absint($instance['limit']) : 8;
            $product_type = $instance['product_type'];
            $product_cats = $instance['product_cats'];
            $row = $instance['row'] != 0 ? absint($instance['row']) : 4;
            $show_thumbnail = empty($instance['show_thumbnail']) ? 0 : $instance['show_thumbnail'];
            $show_categories = empty($instance['show_categories']) ? 0 : $instance['show_categories'];
            $show_product_title = empty($instance['show_product_title']) ? 0 : $instance['show_product_title'];
            $show_price = empty($instance['show_price']) ? 0 : $instance['show_price'];
            $show_rating = empty($instance['show_rating']) ? 0 : $instance['show_rating'];
            $is_slider = empty($instance['is_slider']) ? 0 : $instance['is_slider'];
            $show_nav = empty($instance['show_nav']) ? 0 : $instance['show_nav'];
            $auto_play = empty($instance['auto_play']) ? 0 : $instance['auto_play'];
            if ($limit == $row) {
                $is_slider = false;
            }
            $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $limit, 'orderby' => 'date', 'order' => 'desc', 'meta_query' => array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN')));
            switch ($product_type) {
                case 'sale':
                    $args['meta_query'][] = array('key' => '_sale_price', 'value' => 0, 'compare' => '>', 'type' => 'NUMERIC');
                    break;
                case 'featured':
                    $args['meta_query'][] = array('key' => '_featured', 'value' => 'yes');
                    break;
                case 'best_selling':
                    $args['meta_key'] = 'total_sales';
                    $args['orderby'] = 'meta_value_num';
                    $args['order'] = 'desc';
                    break;
                case 'top_rated':
                    add_filter('posts_clauses', array(WC()->query, 'order_by_rating_post_clauses'));
                    break;
                default:
                    /* Recent */
                    $args['orderby'] = 'date';
                    $args['order'] = 'desc';
                    break;
            }
            if (is_array($product_cats) && count($product_cats) > 0) {
                $field_name = is_numeric($product_cats[0]) ? 'term_id' : 'slug';
                $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'terms' => $product_cats, 'field' => $field_name));
            }
            global $post, $product, $smof_data;
            $lazy_load = isset($smof_data['ts_prod_lazy_load']) && $smof_data['ts_prod_lazy_load'];
            $placeholder_img_src = isset($smof_data['ts_prod_placeholder_img']) ? $smof_data['ts_prod_placeholder_img'] : wc_placeholder_img_src();
            echo $before_widget;
            if ($title) {
                echo $before_title . $title . $after_title;
            }
            $products = new WP_Query($args);
            if ($products->have_posts()) {
                $count = 0;
                $num_posts = $products->post_count;
                if ($num_posts <= $row) {
                    $is_slider = false;
                }
                if (!$is_slider) {
                    $row = $num_posts;
                }
                $extra_class = '';
                $extra_class .= $is_slider ? 'ts-slider loading' : '';
                $extra_class .= $is_slider && $show_nav ? ' has-navi' : '';
                ?>
				
				<div class="ts-products-widget-wrapper woocommerce <?php 
                echo esc_attr($extra_class);
                ?>
" data-show_nav="<?php 
                echo esc_attr($show_nav);
                ?>
" data-auto_play="<?php 
                echo esc_attr($auto_play);
                ?>
">
					<?php 
                while ($products->have_posts()) {
                    $products->the_post();
                    $product = wc_get_product($post->ID);
                    ?>
						<?php 
                    if ($count % $row == 0) {
                        ?>
						<div class="per-slide">
							<ul class="product_list_widget">
						<?php 
                    }
                    ?>
							<li>
								<a class="ts-wg-thumbnail" href="<?php 
                    echo esc_url(get_permalink($product->id));
                    ?>
" title="<?php 
                    echo esc_attr($product->get_title());
                    ?>
">
									<?php 
                    if ($show_thumbnail) {
                        if (!$lazy_load) {
                            echo $product->get_image();
                        } else {
                            $image_size = 'shop_thumbnail';
                            $img_src = '';
                            $alt = '';
                            $dimensions = wc_get_image_size($image_size);
                            if (has_post_thumbnail($product->id)) {
                                $post_thumbnail_id = get_post_thumbnail_id($product->id);
                                $image_obj = wp_get_attachment_image_src($post_thumbnail_id, $image_size, 0);
                                if (isset($image_obj[0])) {
                                    $img_src = $image_obj[0];
                                }
                                $alt = trim(strip_tags(get_post_meta($post_thumbnail_id, '_wp_attachment_image_alt', true)));
                            } else {
                                if (wc_placeholder_img_src()) {
                                    $img_src = wc_placeholder_img_src();
                                }
                            }
                            echo '<img src="' . esc_url($placeholder_img_src) . '" data-src="' . esc_url($img_src) . '" alt="' . esc_attr($alt) . '" class="attachment-shop_thumbnail wp-post-image ts-lazy-load" width="' . $dimensions['width'] . '" height="' . $dimensions['height'] . '" />';
                        }
                    }
                    ?>
								</a>
								
								<div class="ts-wg-meta">
								
									<?php 
                    if ($show_categories) {
                        ts_template_loop_categories();
                    }
                    ?>
									
									<a href="<?php 
                    echo esc_url(get_permalink($product->id));
                    ?>
" title="<?php 
                    echo esc_attr($product->get_title());
                    ?>
">
										<?php 
                    if ($show_product_title) {
                        echo esc_html($product->get_title());
                    }
                    ?>
									</a>
									<?php 
                    if ($show_price) {
                        woocommerce_template_loop_price();
                    }
                    ?>
									<?php 
                    if ($show_rating) {
                        woocommerce_template_loop_rating();
                    }
                    ?>
								</div>
							</li>
						<?php 
                    if ($count % $row == $row - 1 || $count == $num_posts - 1) {
                        ?>
	
							</ul>
						</div>
						<?php 
                    }
                    ?>
					<?php 
                    $count++;
                }
                ?>
				</div>
				<?php 
            }
            echo $after_widget;
            if ($product_type == 'top_rated') {
                remove_filter('posts_clauses', array(WC()->query, 'order_by_rating_post_clauses'));
            }
            wp_reset_postdata();
        }
 function thb_single_product_mobile_header()
 {
     echo "<div class='thb_product_mobile_header'>";
     woocommerce_template_single_title();
     woocommerce_template_loop_rating();
     woocommerce_template_single_price();
     echo "</div>";
 }
예제 #6
0
 function oxy_woocommerce_template_loop_product_thumbnail()
 {
     global $product;
     $image_ids = $product->get_gallery_attachment_ids();
     $back_image = array_shift($image_ids);
     echo '<div class="product-image">';
     echo '<div class="product-image-front">' . woocommerce_get_product_thumbnail() . '</div>';
     if (null != $back_image) {
         $back_image = wp_get_attachment_image_src($back_image, 'shop_catalog');
         echo '<div class="product-image-back"><img src="' . $back_image[0] . '" alt=""/></div>';
     }
     echo '<div class="product-image-overlay">';
     echo '<h4>';
     echo __('View Details', 'lambda-td');
     echo '</h4>';
     echo woocommerce_template_loop_rating();
     echo '</div>';
     echo '</div>';
 }
예제 #7
0
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $product_cat = $instance['product_cat'];
        $product_total = $instance['product_total'];
        if (!is_numeric($product_total)) {
            $product_total = 12;
        }
        global $uni_carousel_id;
        echo $args['before_widget'] . "\n";
        if ($title) {
            echo $before_title . $title . $after_title . "\n";
        }
        ?>
		
		<?php 
        if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) {
            ?>
		<div id="woo-product-items" class="products grid-view list-carousel responsive">
			
			<ul id="<?php 
            echo "foo" . $uni_carousel_id;
            ?>
" class="products products-carousel">
				<script type="text/javascript">
					/*global jQuery:false */
					jQuery(document).ready(function($) {
						"use strict";
						// Products Carousel
						$('#foo<?php 
            echo $uni_carousel_id;
            ?>
').carouFredSel({
							responsive: true,
							auto: false,
							width: '100%',
							scroll: {
								items : 2,
								pauseOnHover    : true
							},
							prev: '#prev<?php 
            echo $uni_carousel_id;
            ?>
',
							next: '#next<?php 
            echo $uni_carousel_id;
            ?>
',
							pagination: "#pager<?php 
            echo $uni_carousel_id;
            ?>
",
							items: {
								width: 250,
								height: 'auto',
								visible: {
									min: 2,
									max: 4
								}
							}
						});
					});
				</script>
				<?php 
            $args = array('post_type' => 'product', 'product_cat' => "{$product_cat}", 'posts_per_page' => $product_total);
            $loop = new WP_Query($args);
            $products_available = $loop->found_posts;
            while ($loop->have_posts()) {
                $loop->the_post();
                global $product;
                global $woocommerce;
                $large_image_url = wp_get_attachment_image_src(get_post_thumbnail_id($loop->post->ID), apply_filters('single_product_large_thumbnail_size', 'shop_catalog'));
                $productlink = get_permalink($loop->post->ID);
                $content_excerpt = apply_filters('woocommerce_short_description', $loop->post->post_excerpt);
                ?>
<li class="product-grid-container">
					<div class="product-item">	
						<div class="title">
							<h3 class="title-container product-titles"><a href="<?php 
                echo $productlink;
                ?>
"><?php 
                the_title();
                ?>
</a></h3>
						</div>
						
						<div class="image mosaic-block bar">
							<?php 
                if ($content_excerpt != "") {
                    ?>
<a href="<?php 
                    echo $productlink;
                    ?>
" class="mosaic-overlay">
								<div class="details">
									<?php 
                    echo $content_excerpt;
                    ?>
								</div>
							</a><?php 
                }
                ?>
							<a href="<?php 
                echo $productlink;
                ?>
">
								<span class="price heading-style"><?php 
                echo $product->get_price_html();
                ?>
</span>
								<?php 
                woocommerce_show_product_sale_flash($loop->post, $product);
                ?>
								<?php 
                if (!$large_image_url == "") {
                    ?>
<img src="<?php 
                    echo $large_image_url[0];
                    ?>
" alt="" /><?php 
                } else {
                    ?>
<img src="<?php 
                    echo woocommerce_placeholder_img_src();
                    ?>
" width="240" height="160" alt="" /><?php 
                }
                ?>
							</a>
						</div>
						
						<div class="info">
							<div class="float-left">
								<?php 
                woocommerce_template_loop_rating($loop->post, $product);
                ?>
							</div>
							
							<div class="float-right">
								<?php 
                woocommerce_template_loop_add_to_cart($loop->post, $product);
                ?>
							</div>
						</div>
					</div>
				</li>
			<?php 
            }
            wp_reset_query();
            ?>
			</ul>
			
			<div id="pager<?php 
            echo $uni_carousel_id;
            $uni_carousel_id++;
            ?>
" class="pager"></div>
			
			<div class="clear"></div>
		</div><?php 
        }
        ?>
</div>
		
		<?php 
    }
예제 #8
0
    function posts()
    {
        if (have_posts()) {
            ?>
        <?php 
            $count = 0;
            ?>
        
        <div class="featured-posts row woocommerce">
        	<div class="col-md-6">
        		<ul>
                <?php 
            while (have_posts()) {
                the_post();
                ?>
                <?php 
                if ($count % 2 == 0 && $count != 0) {
                    ?>
   					</ul></div><div class="col-md-6"><ul>
  					<?php 
                }
                ?>
                 <li>
                 
                    <div class="alignleft">
                        <a href="<?php 
                the_permalink();
                ?>
"><?php 
                the_post_thumbnail('160x180', array('class' => 'img-responsive img-thumbnail'));
                ?>
</a>
                    </div>
                    <h4><a title="<?php 
                the_title_attribute();
                ?>
" href="<?php 
                the_permalink();
                ?>
"><?php 
                the_title();
                ?>
</a></h4>
                    <div class="meta">
                            <?php 
                woocommerce_template_loop_rating();
                ?>
                    </div><!-- end meta -->
                <a class="readmore" href="<?php 
                the_permalink();
                ?>
" title=""><?php 
                _e('View Item', SH_NAME);
                ?>
</a>
           	 </li>
           <?php 
                $count++;
            }
            ?>
     
    
            </ul>
        </div>
    </div>
            
		<?php 
        }
    }
    function widget($args, $instance)
    {
        extract($args);
        $number = $instance['number'];
        $heading = $instance['title'];
        global $product;
        if (!is_singular("product")) {
            return;
        }
        $related = $product->get_related($number);
        $args = apply_filters('woocommerce_related_products_args', array('post_type' => 'product', 'ignore_sticky_posts' => 1, 'no_found_rows' => 1, 'posts_per_page' => $number, 'post__in' => $related, 'post__not_in' => array($product->id)));
        $products = new WP_Query($args);
        if ($products->have_posts()) {
            ?>
            <div class="widget widget-products">
                <h3 class="widget-title"><?php 
            echo esc_attr($heading);
            ?>
</h3>
                <ul class="products-list">
                <?php 
            while ($products->have_posts()) {
                $products->the_post();
                global $product;
                ?>
                        <li>
                            <figure>
                                <a href="<?php 
                echo get_the_permalink();
                ?>
" title="<?php 
                echo get_the_title();
                ?>
">
                                  <?php 
                echo $product->get_image('thumb_60', array("class" => "product-image"));
                ?>
                                </a>
                            </figure>
                            <h5 class="product-title"><a href="<?php 
                echo get_the_permalink();
                ?>
"
                             title="<?php 
                echo get_the_title();
                ?>
"><?php 
                echo get_the_title();
                ?>
</a>
                            </h5>
                            <div class="product-price-container">
                                <?php 
                echo $product->get_price_html();
                woocommerce_template_loop_rating();
                ?>
                            </div>
                        </li>
                <?php 
            }
            // end of the loop.
            ?>
                </ul>
            </div>

        <?php 
        }
        wp_reset_postdata();
        ?>
		</div><!-- End .widget -->
	<?php 
    }
/**
 * Function to add after shop loop item
 */
function grve_woo_after_shop_loop_item()
{
    ?>
			<div class="grve-product-options">
				<?php 
    woocommerce_template_loop_rating();
    ?>
				<?php 
    woocommerce_template_loop_add_to_cart();
    ?>
			</div>
		</div>
		<div class="grve-product-content">
			<span class="grve-product-name"><a href="<?php 
    the_permalink();
    ?>
"><?php 
    the_title();
    ?>
</a></span>
			<span class="grve-product-price"><?php 
    woocommerce_template_loop_price();
    ?>
</span>
		</div>
	</div>
<?php 
}