コード例 #1
3
ファイル: config.php プロジェクト: fjbeteiligung/development
function zn_add_to_cart()
{
    ob_start();
    woocommerce_template_loop_add_to_cart();
    $output = ob_get_clean();
    echo '<div class="zn_add_to_cart">' . $output . '</div>';
}
コード例 #2
3
/**
 * Renders item-bar of products in the loop
 *
 * @global WC_Product $product
 */
function dokan_product_loop_price()
{
    global $product;
    ?>
    <span class="item-bar">

        <?php 
    woocommerce_template_loop_price();
    ?>

        <span class="item-button">
            <?php 
    woocommerce_template_loop_add_to_cart();
    ?>
            <?php 
    if (function_exists('dokan_add_to_wishlist_link')) {
        dokan_add_to_wishlist_link();
    }
    ?>
        </span>
    </span>
    <?php 
}
コード例 #3
2
ファイル: config.php プロジェクト: siiiiilvio/kadcnc
function waxom_woocommerce_loop_thumbnail()
{
    echo '<div class="product-thumbnail-wrap vntd-accent-bg-color">';
    woocommerce_template_loop_product_thumbnail();
    echo '<div class="product-overlay">';
    echo '<div class="product-overlay-inner">';
    woocommerce_template_loop_add_to_cart();
    echo '</div></div></div>';
    echo '<div class="product-details-wrap"><div class="product-category">' . waxom_product_categories() . '</div>';
}
コード例 #4
1
ファイル: config.php プロジェクト: jfbelisle/magexpress
function vntd_woocommerce_loop_thumbnail()
{
    echo '<div class="product-thumbnail-wrap">';
    woocommerce_template_loop_product_thumbnail();
    echo '<div class="product-overlay-add">';
    woocommerce_template_loop_add_to_cart();
    echo '</div></div>';
}
コード例 #5
1
ファイル: wc-loop-mainpage.php プロジェクト: qnk/lessaggs
                        <?php 
    if (has_post_thumbnail($loop->post->ID)) {
        echo get_the_post_thumbnail($loop->post->ID, 'shop_catalog');
    } else {
        echo '<img src="' . woocommerce_placeholder_img_src() . '" alt="Placeholder" width="300px" height="300px" />';
    }
    ?>

                        <h3><?php 
    the_title();
    ?>
</h3>

                        <span class="price"><?php 
    echo $product->get_price_html();
    ?>
</span>                    

                    </a>

                    <?php 
    woocommerce_template_loop_add_to_cart($loop->post, $product);
    ?>

                </li>



    <?php 
}
wp_reset_query();
function rd_add_cart_button()
{
    global $product, $rd_config;
    if ($product->product_type == 'bundle') {
        $product = new WC_Product_Bundle($product->id);
    }
    $extraClass = "";
    ob_start();
    woocommerce_template_loop_add_to_cart();
    $output = ob_get_clean();
    if (!empty($output)) {
        $pos = strpos($output, ">");
        if ($pos !== false) {
            $output = substr_replace($output, "> ", $pos, strlen(1));
        }
    }
    if ($product->product_type == 'variable' && empty($output)) {
        $output = '<a class="add_to_cart_button button product_type_variable" href="' . get_permalink($product->id) . '"> ' . __("Select options", "rd_framework") . '</a>';
    }
    if (in_array($product->product_type, array('subscription', 'simple', 'bundle'))) {
        $output .= '<a class="button show_details_button" href="' . get_permalink($product->id) . '">  ' . __("Show Details", "rd_framework") . '</a>';
    }
    if (!$product->is_in_stock()) {
        $output = '<a href="' . get_permalink() . '" rel="nofollow" class="button add_to_cart_button more_info_button out_stock_button"> ' . __("Out of Stock", "rd_framework") . '</a>';
    } else {
        $extraClass = "single_button";
    }
    if (empty($extraClass)) {
        $output .= " <span class='button-mini-delimiter'></span>";
    }
    if ($output && !post_password_required()) {
        echo "<div class='custom_cart_button {$extraClass}'>{$output}</div>";
    }
}
コード例 #7
0
ファイル: config.php プロジェクト: Jiersone/mac
function avia_add_cart_button()
{
    global $product, $avia_config;
    if ($product->product_type == 'bundle') {
        $product = new WC_Product_Bundle($product->id);
    }
    $extraClass = "";
    ob_start();
    woocommerce_template_loop_add_to_cart();
    $output = ob_get_clean();
    if (!empty($output)) {
        $pos = strpos($output, ">");
        if ($pos !== false) {
            $output = substr_replace($output, "><span " . av_icon_string('cart') . "></span> ", $pos, strlen(1));
        }
    }
    if ($product->product_type == 'variable' && empty($output)) {
        $output = '<a class="add_to_cart_button button product_type_variable" href="' . get_permalink($product->id) . '"><span ' . av_icon_string("details") . '></span> ' . __("Select options", "avia_framework") . '</a>';
    }
    if ($product->product_type == 'simple' || $product->product_type == 'subscription') {
        $output .= '<a class="button show_details_button" href="' . get_permalink($product->id) . '"><span ' . av_icon_string("details") . '></span>  ' . __("Show Details", "avia_framework") . '</a>';
    } else {
        $extraClass = "single_button";
    }
    if (empty($extraClass)) {
        $output .= " <span class='button-mini-delimiter'></span>";
    }
    if ($output && !post_password_required()) {
        echo "<div class='avia_cart_buttons {$extraClass}'>{$output}</div>";
    }
}
コード例 #8
0
ファイル: index.php プロジェクト: PNW3DEV/iesdb-v1
 function dt_woocommerce_shop_overview_extra_div_close()
 {
     global $product;
     $link = apply_filters('out_of_stock_add_to_cart_url', get_permalink($product->id));
     $out = "";
     ob_start();
     woocommerce_template_loop_price();
     $price = ob_get_clean();
     ob_start();
     woocommerce_template_loop_add_to_cart();
     $add_to_cart = ob_get_clean();
     if (!empty($add_to_cart)) {
         $add_to_cart = str_replace(' class="', ' class="dt-sc-button ', $add_to_cart);
     }
     $out .= '<!-- Product Details -->';
     $out .= "<div class='product-details'>";
     $out .= $price;
     $out .= $add_to_cart;
     $out .= '</div><!-- Product Details -->';
     $out .= '<div class="product-details-hover">';
     $out .= "<h3><a href='{$link}'>" . $product->get_title() . '</a></h3>';
     $rating = $product->get_rating_html();
     //get rating
     $rating = !empty($rating) ? $rating : "";
     $out .= $rating;
     $out .= $price;
     $out .= $add_to_cart;
     if (shortcode_exists('yith_wcwl_add_to_wishlist')) {
         $out .= do_shortcode('[yith_wcwl_add_to_wishlist]');
     }
     $out .= '</div><!-- Product Details Hover -->';
     $out .= "</div> </div> <!-- Product Wrapper End-->";
     echo $out;
 }
コード例 #9
0
ファイル: up-sells.php プロジェクト: shimion/sim-buller
" title="<?php 
        the_title();
        ?>
"><h3><?php 
        the_title();
        ?>
</h3></a>				
				</div>
				</div>	
					<div class="product-price-cart">						
						<div class="recentPrice"><span class="price"><?php 
        echo $product->get_price_html();
        ?>
</span></div>	
						<div class="recentCart"><?php 
        woocommerce_template_loop_add_to_cart($product);
        ?>
</div>
					</div>	
					
			</div>
		<?php 
        $count++;
        if ($countitem == 4) {
            $countitem = 0;
            ?>
			</li>
		<?php 
        }
        $countitem++;
        $countPost++;
コード例 #10
0
ファイル: woo.php プロジェクト: sniezekjp/prod-fs
 /**
  * 
  *   Product thumbnail for loop
  */
 function woo_loop_product_thumbnail()
 {
     if (has_post_thumbnail()) {
         echo '<figure class="featured-image img-preload img-hover">';
         echo '<a href="' . get_permalink() . '">';
         the_post_thumbnail('shop_catalog');
         echo '<div class="overlay"></div>';
         echo '</a>';
         woocommerce_template_loop_add_to_cart();
         woocommerce_show_product_loop_sale_flash();
         echo '</figure>';
     }
 }
コード例 #11
0
ファイル: wc_featured.php プロジェクト: Artgorae/wp-artgorae
function tpvc_wc_product_featured_shortcode($atts)
{
    if (!class_exists('woocommerce')) {
        return;
    }
    global $woocommerce_loop;
    extract(shortcode_atts(array('tpvc_wc_featured_title' => __('Featured Product', 'tokopress'), 'tpvc_wc_featured_title_color' => '', 'tpvc_wc_featured_title_bg' => '', 'tpvc_wc_featured_title_icon' => '', 'tpvc_wc_featured_title_icon_color' => '', 'tpvc_wc_featured_link' => __('see all', 'tokopress'), 'tpvc_wc_featured_link_color' => '', 'tpvc_wc_featured_number' => '6', 'tpvc_wc_featured_orderby' => 'date', 'tpvc_wc_featured_order' => 'desc', 'tpvc_wc_featured_hide_title' => '', 'tpvc_wc_featured_hide_prodprice' => '', 'tpvc_wc_featured_hide_prodtitle' => '', 'tpvc_wc_featured_hide_prodlink' => '', 'tpvc_wc_featured_hide_prodcart' => '', 'tpvc_wc_featured_hide_prodlink_text' => __('detail', 'tokopress'), 'tpvc_wc_featured_class' => ''), $atts));
    $tpvc_wc_featured_columns = 1;
    $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $tpvc_wc_featured_number, 'orderby' => $tpvc_wc_featured_orderby, 'order' => $tpvc_wc_featured_order, 'meta_query' => array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN'), array('key' => '_featured', 'value' => 'yes')));
    ob_start();
    $products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $args, $atts));
    $woocommerce_loop['columns'] = $tpvc_wc_featured_columns;
    if ($products->have_posts()) {
        ?>
	<div class="tpvc-featured-product woocommerce woocommerce-product-col-<?php 
        echo $tpvc_wc_featured_columns;
        ?>
 <?php 
        echo $tpvc_wc_featured_class;
        ?>
">

		<?php 
        if ("hide" != $tpvc_wc_featured_hide_title) {
            ?>
			<?php 
            if ($tpvc_wc_featured_link_color) {
                echo '<style>';
                echo '.tpvc-featured-product.woocommerce .tpvc-title a.button.alt { color:' . $tpvc_wc_featured_link_color . '; box-shadow: ' . $tpvc_wc_featured_link_color . ' 0 0px 0px 2px inset; }';
                echo '.tpvc-featured-product.woocommerce .tpvc-title a.button.alt:hover { color: #fff; box-shadow: ' . $tpvc_wc_featured_link_color . ' 0 0px 0px 40px inset; }';
                echo '</style>';
            }
            ?>

			<div class="tpvc-title" <?php 
            if ("" != $tpvc_wc_featured_title_bg) {
                echo 'style="background-color:' . $tpvc_wc_featured_title_bg . '"';
            }
            ?>
>
				<h2 <?php 
            if ("" != $tpvc_wc_featured_title_color) {
                echo 'style="color:' . $tpvc_wc_featured_title_color . '"';
            }
            ?>
>
					<?php 
            if ("" != $tpvc_wc_featured_title_icon) {
                echo '<i class="' . tpvc_icon($tpvc_wc_featured_title_icon) . '" ' . ($tpvc_wc_featured_title_icon_color ? 'style="color:' . $tpvc_wc_featured_title_icon_color . '"' : '') . '></i>';
            }
            ?>
					<?php 
            echo $tpvc_wc_featured_title;
            ?>
				</h2>
				<a href="<?php 
            echo get_permalink(wc_get_page_id('shop'));
            ?>
" class="button alt">
					<?php 
            if (!$tpvc_wc_featured_link) {
                $tpvc_wc_featured_link = __('see all', 'tokopress');
            }
            echo $tpvc_wc_featured_link;
            ?>
				</a>
			</div>
		<?php 
        }
        ?>

		<ul class="products owl-carousel">

			<?php 
        while ($products->have_posts()) {
            $products->the_post();
            ?>

				<li <?php 
            post_class();
            ?>
>
					<div class="featured-top">
						<?php 
            the_post_thumbnail('custom-woo-thumbnail');
            ?>
					</div>
					<?php 
            if ("yes" != $tpvc_wc_featured_hide_prodprice || "yes" != $tpvc_wc_featured_hide_prodtitle || "yes" != $tpvc_wc_featured_hide_prodlink || "yes" != $tpvc_wc_featured_hide_prodcart) {
                ?>
						<div class="featured-bottom">
							<?php 
                if ("yes" != $tpvc_wc_featured_hide_prodprice) {
                    ?>
								<div class="featured-price">
									<?php 
                    woocommerce_template_loop_price();
                    ?>
								</div>
							<?php 
                }
                ?>
							<?php 
                if ("yes" != $tpvc_wc_featured_hide_prodlink || "yes" != $tpvc_wc_featured_hide_prodcart) {
                    ?>
								<div class="featured-action">
									<?php 
                    if ("yes" != $tpvc_wc_featured_hide_prodlink) {
                        ?>
										<a href="<?php 
                        echo get_permalink();
                        ?>
" class="button detail_button_loop">
											<?php 
                        if (!$tpvc_wc_featured_hide_prodlink_text) {
                            $tpvc_wc_featured_hide_prodlink_text = __('detail', 'tokopress');
                        }
                        echo $tpvc_wc_featured_hide_prodlink_text;
                        ?>
										</a>
									<?php 
                    }
                    ?>
									<?php 
                    if ("yes" != $tpvc_wc_featured_hide_prodcart) {
                        ?>
										<?php 
                        woocommerce_template_loop_add_to_cart();
                        ?>
									<?php 
                    }
                    ?>
								</div>
							<?php 
                }
                ?>
							<?php 
                if ("yes" != $tpvc_wc_featured_hide_prodtitle) {
                    ?>
								<div class="featured-title">
									<h3><a href="<?php 
                    echo get_permalink();
                    ?>
"><?php 
                    the_title();
                    ?>
</a></h3>
								</div>
							<?php 
                }
                ?>
						</div>
					<?php 
            }
            ?>
				</li>

			<?php 
        }
        ?>

		</ul>

	</div>
	<?php 
    }
    wp_reset_postdata();
    $js_code = '$(\'.tpvc-featured-product ul.owl-carousel\').owlCarousel({
            items : 1,
            loop: true,
            nav : true,
            stopOnHover : true,     
            navText : [\'<i class="fa fa-chevron-left"></i>\', \'<i class="fa fa-chevron-right"></i>\'],
            lazyLoad: true,
            autoplay: true,
            dots: false
        });';
    wc_enqueue_js($js_code);
    return ob_get_clean();
}
コード例 #12
0
    /**
     * Display a single product price + cart button
     *
     * @access public
     * @param array $atts
     * @return string
     */
    public function product_add_to_cart($atts)
    {
        global $wpdb, $post, $woocommerce;
        if (empty($atts)) {
            return;
        }
        if (!isset($atts['style'])) {
            $atts['style'] = 'border:4px solid #ccc; padding: 12px;';
        }
        if (isset($atts['id'])) {
            $product_data = get_post($atts['id']);
        } elseif (isset($atts['sku'])) {
            $product_id = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key='_sku' AND meta_value='%s' LIMIT 1", $atts['sku']));
            $product_data = get_post($product_id);
        } else {
            return;
        }
        if ('product' == $product_data->post_type) {
            $product = $woocommerce->setup_product_data($product_data);
            ob_start();
            ?>
			<p class="product woocommerce" style="<?php 
            echo $atts['style'];
            ?>
">

				<?php 
            echo $product->get_price_html();
            ?>

				<?php 
            woocommerce_template_loop_add_to_cart();
            ?>

			</p><?php 
            // Restore Product global in case this is shown inside a product post
            $woocommerce->setup_product_data($post);
            return ob_get_clean();
        } elseif ('product_variation' == $product_data->post_type) {
            $product = get_product($product_data->post_parent);
            $GLOBALS['product'] = $product;
            $variation = get_product($product_data);
            ob_start();
            ?>
			<p class="product product-variation" style="<?php 
            echo $atts['style'];
            ?>
">

				<?php 
            echo $product->get_price_html();
            ?>

				<?php 
            $link = $product->add_to_cart_url();
            $label = apply_filters('add_to_cart_text', __('Add to cart', 'woocommerce'));
            $link = add_query_arg('variation_id', $variation->variation_id, $link);
            foreach ($variation->variation_data as $key => $data) {
                if ($data) {
                    $link = add_query_arg($key, $data, $link);
                }
            }
            printf('<a href="%s" rel="nofollow" data-product_id="%s" class="button add_to_cart_button product_type_%s">%s</a>', esc_url($link), $product->id, $product->product_type, $label);
            ?>

			</p><?php 
            wp_reset_postdata();
            return ob_get_clean();
        }
    }
コード例 #13
0
function pmc_productBlock($title, $number_post, $rowsB, $categories, $port_text, $type, $product_ajax)
{
    wp_enqueue_script('pmc_bxSlider');
    $rand = rand(0, 99);
    global $pmc_data, $sitepress, $wpdb;
    if (isset($number_post)) {
        $showpost = $number_post;
    } else {
        $showpost = 8;
    }
    if (isset($rowsB)) {
        $rows = $rowsB;
    } else {
        $rows = 4;
    }
    if (isset($productShow)) {
        $rows = $productShow;
    }
    if ($type == 'recent') {
        $args = array('post_type' => 'product', 'posts_per_page' => $showpost, 'tax_query' => array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => $categories)));
        $pc = new WP_Query($args);
    }
    if ($type == 'feautured') {
        $args = array('post_type' => 'product', 'orderby' => 'rand', 'posts_per_page' => $showpost, 'meta_query' => array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN'), array('key' => '_featured', 'value' => 'yes')), 'tax_query' => array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => $categories)));
        $pc = new WP_Query($args);
    }
    ?>

	<script type="text/javascript">


		jQuery(document).ready(function(){	  


		// Slider
		var $slider = jQuery('#productR-<?php 
    echo $rand;
    ?>
').bxSlider({
					controls: true,
					displaySlideQty: 1,
					default: 1000,
					easing : 'easeInOutQuint',
					prevText : '',
					nextText : '',
					pager :false

					
				});
  

		 });
	</script>




		

<div class="homerecent <?php 
    echo $type;
    ?>
">
	<div class="wocategoryFull">

		<div class="productR <?php 
    echo $type;
    ?>
">
			<div class="homerecentInner">
			<div id = "showpost-<?php 
    echo $type;
    ?>
-<?php 
    echo $rand;
    ?>
">
				<div class="showpostload"><div class="loading"></div></div>
				<div class = "closehomeshow-<?php 
    echo $type;
    ?>
 product closeajax"><i class="icon-remove"></i></div>
				<div class="showpostpostcontent"></div>
			</div>	
			<div class="titlebordrtext"><h2 class="titleborderh2"><?php 
    echo $title;
    ?>
</h2></div>	
			<div class="titleborderOut"><div class="titleborder"></div></div>	
			<div class="homerecent productRH" >
		
				<ul id="productR-<?php 
    echo $rand;
    ?>
" class="productR">
					<?php 
    $average = 0;
    $currentindex = '';
    if ($pc->have_posts()) {
        $countPost = 1;
        $countitem = 1;
        ?>
					<?php 
        while ($pc->have_posts()) {
            $pc->the_post();
            global $product;
            if ($countitem == 1) {
                echo '<li>';
            }
            $postmeta = get_post_custom(get_the_id());
            if ($countPost != 4) {
                echo '<div class="one_fourth" >';
            } else {
                echo '<div class="one_fourth last" >';
                $countPost = 0;
            }
            if (has_post_thumbnail()) {
                $image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'shop', false);
                $image = $image[0];
            } else {
                $image = get_template_directory_uri() . '/images/placeholder-580.png';
            }
            ?>
								<?php 
            if ($product_ajax == 'true') {
                ?>
								<div class="click" id="<?php 
                echo $type;
                ?>
_<?php 
                echo get_the_id();
                ?>
_<?php 
                echo $rand;
                ?>
">
								<?php 
            }
            ?>
								<?php 
            if ($product_ajax != 'true') {
                ?>
								<a href="<?php 
                echo get_permalink(get_the_id());
                ?>
">
								<?php 
            }
            ?>
								<?php 
            if (isset($postmeta["video_active"][0]) && $postmeta["video_active"][0] == 1) {
                ?>
									<div class="recentimage">
										<div class="image">
											<div class="loading"></div>
											<?php 
                if ($postmeta["selectv"][0] == 'vimeo') {
                    echo '<iframe class = "productIframe full" src="http://player.vimeo.com/video/' . $postmeta["video_post_url"][0] . '" width="230" height="' . $pmc_data['catalog_img_height'] . '"  ></iframe>';
                } else {
                    if ($postmeta["selectv"][0] == 'youtube') {
                        echo '<iframe class = "productIframe full youtube"  width="230" height="' . $pmc_data['catalog_img_height'] . '" src="http://www.youtube.com/embed/' . $postmeta["video_post_url"][0] . '"  ></iframe>';
                    } else {
                        //echo 'Please select a Video Site via the WordPress Admin';
                    }
                }
                ?>
										</div>
									</div>								
									
									<?php 
            } else {
                ?>
									<div class="recentimage">
										
										<div class="image">
											<div class="loading"></div>
											<?php 
                if (has_post_thumbnail(get_the_ID())) {
                    echo '<img src = ' . $image . ' alt = "' . get_the_title() . '"  > ';
                } else {
                    echo '<img src="' . woocommerce_placeholder_img_src() . '" alt="Placeholder" width="230px" height="' . $pmc_data['catalog_img_height'] . 'px" />';
                }
                ?>
										</div>
									</div>	
								<?php 
                if ($product_ajax != 'true') {
                    ?>
								</a>
								<?php 
                }
                ?>
									
									<?php 
            }
            ?>
				
									<div class="recentdescription">
										<?php 
            woocommerce_show_product_sale_flash($product);
            ?>
										<?php 
            if ($product_ajax != 'true') {
                ?>
										<a href="<?php 
                echo get_permalink(get_the_id());
                ?>
">
										<?php 
            }
            ?>
										<h3><?php 
            the_title();
            ?>
</h3>	
										<?php 
            if ($product_ajax != 'true') {
                ?>
										</a>
										<?php 
            }
            ?>
										
									</div>
								<?php 
            if ($product_ajax == 'true') {
                ?>
	
								</div>	
								<?php 
            }
            ?>
									<div class="product-price-cart">						
										<div class="recentPrice"><span class="price"><?php 
            echo $product->get_price_html();
            ?>
</span></div>	
										<div class="recentCart"><?php 
            woocommerce_template_loop_add_to_cart($product);
            ?>
</div>
									</div>	
									
							</div>
					<?php 
            $countPost++;
            if ($countitem == $rows) {
                $countitem = 0;
                ?>
						</li>
					<?php 
            }
            $countitem++;
        }
    }
    wp_reset_query();
    ?>
				</ul>
			</div>
		</div>
	</div>
</div>
<?php 
}
コード例 #14
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 
    }
コード例 #15
0
ファイル: banner-title.php プロジェクト: acamboy/kutetheme-wp
    protected function content($atts, $content = null)
    {
        $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('kt_banner', $atts) : $atts;
        $atts = shortcode_atts(array('banner_style' => '', 'title' => '', 'sub_title' => '', 'hide_bg' => 'style1', 'product_id' => '', 'banner_image' => '', 'link' => '#', 'enable_countdown' => 'off', 'countdown_text' => '', 'time' => '', 'el_class' => '', 'css' => ''), $atts);
        extract($atts);
        $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, ' ', $this->settings['base'], $atts), 'extra' => $this->getExtraClass($el_class), 'shortcode_custom' => vc_shortcode_custom_css_class($css, ' '));
        $elementClass = preg_replace(array('/\\s+/', '/^\\s|\\s$/'), array(' ', ''), implode(' ', $elementClass));
        $banner_url = "";
        if ($banner_image) {
            $banner = wp_get_attachment_image_src($banner_image, 'full');
            $banner_url = is_array($banner) ? esc_url($banner[0]) : '';
        }
        $time = strtotime($time);
        $y = date('Y', $time);
        $m = date('m', $time);
        $d = date('d', $time);
        $h = date('h', $time);
        $mi = date('i', $time);
        $s = date('s', $time);
        ob_start();
        if ($banner_style == 'style-1') {
            ?>
        <div class="featured-banner option11">
            <div class="banner-box banner-boder-zoom2">
                <?php 
            if ($banner_url) {
                ?>
                    <a href="<?php 
                echo esc_html($link);
                ?>
">
                        <img src="<?php 
                echo esc_url($banner_url);
                ?>
" alt="" />
                    </a>
                <?php 
            }
            ?>
                <?php 
            if ($enable_countdown == 'on' && $y > 1970) {
                ?>
                    <div class="box-countdown">
                        <?php 
                if ($countdown_text) {
                    ?>
                        <h2 class="box-title"><?php 
                    echo esc_html($countdown_text);
                    ?>
</h2>
                        <?php 
                }
                ?>
                        <div class="box-countdown-inner countdown-lastest" data-y="<?php 
                _e(esc_attr($y));
                ?>
" data-m="<?php 
                _e(esc_attr($m));
                ?>
" data-d="<?php 
                _e(esc_attr($d));
                ?>
" data-h="<?php 
                _e(esc_attr($h));
                ?>
" data-i="<?php 
                _e(esc_attr($mi));
                ?>
" data-s="<?php 
                _e(esc_attr($s));
                ?>
"></div>
                    </div>
                <?php 
            }
            ?>
            </div>
        </div>
        <?php 
        } elseif ($banner_style == 'style-2') {
            ?>
        <div class="featured-banner option11">
            <div class="banner-box">
                <div class="box-small-banner <?php 
            echo esc_attr($hide_bg);
            ?>
">
                    <?php 
            if ($banner_url) {
                ?>
                        <a class="banner" href="<?php 
                echo esc_html($link);
                ?>
">
                            <img src="<?php 
                echo esc_url($banner_url);
                ?>
" alt="" />
                        </a>
                    <?php 
            }
            ?>
                    <div class="text-content">
                        <div class="title">
                            <?php 
            echo apply_filters('kt_shortcode_banner_title', $title);
            ?>
                        </div>
                        <span class="sub-title">
                            <?php 
            echo esc_textarea($sub_title);
            ?>
                        </span>                        
                    </div>
                </div>
            </div>
        </div>
        <?php 
        } elseif ($banner_style == 'style-3') {
            $meta_query = WC()->query->get_meta_query();
            $ids = explode(',', $product_id);
            $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => 1, 'meta_query' => $meta_query, 'suppress_filter' => true);
            if (is_array($ids) && !empty($ids)) {
                $args['post__in'] = $ids;
                $args['orderby'] = 'post__in';
            }
            $products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $args, $atts));
            if ($products->have_posts()) {
                remove_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_rating');
                while ($products->have_posts()) {
                    $products->the_post();
                    ?>
                    <div class="featured-banner option11">
                        <div class="box-small-banner <?php 
                    echo esc_attr($hide_bg);
                    ?>
">
                            <?php 
                    if ($banner_url) {
                        ?>
                                <a class="banner" href="<?php 
                        echo esc_html($link);
                        ?>
">
                                    <img src="<?php 
                        echo esc_url($banner_url);
                        ?>
" alt="" />
                                </a>
                            <?php 
                    }
                    ?>
                            <div class="text-content">
                                <div class="title"><?php 
                    the_title();
                    ?>
</div>
                                <span class="sub-title">
                                    <?php 
                    /**
                     * woocommerce_after_shop_loop_item_title hook
                     * 
                     * @hooked woocommerce_template_loop_price - 5
                     * @hooked woocommerce_template_loop_rating - 10
                     */
                    do_action('kt_after_shop_loop_item_title');
                    ?>
                                </span>   
                            </div>
                            <div class="group-button">
                                <?php 
                    /**
                     * kt_loop_product_function hook
                     *
                     * @hooked kt_get_tool_quickview - 1
                     * @hooked woocommerce_template_loop_add_to_cart - 5
                     * @hooked kt_get_tool_compare - 10
                     */
                    do_action('kt_loop_product_cart_function');
                    ?>
                            </div>  
                        </div>
                    </div>
                <?php 
                }
                // end of the loop.
                wp_reset_query();
                wp_reset_postdata();
                add_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_rating');
            }
        } else {
            ?>
            <div class="section-block-deal option-14 <?php 
            if ($enable_countdown == 'on' && $y > 1970) {
                ?>
 has_countdown <?php 
            }
            ?>
" <?php 
            if ($banner_url) {
                ?>
style="background-image: url('<?php 
                echo esc_url($banner_url);
                ?>
');"<?php 
            }
            ?>
>
                <div class="container">
                    <div class="row">
                        <div class="col-sm-12 col-md-5 col-lg-4 col-sm-offset-0 col-md-offset-7 col-lg-offset-8">
                            <div class="block-deal">
                                <?php 
            if ($enable_countdown == 'on' && $y > 1970) {
                ?>
                                        <?php 
                if ($countdown_text) {
                    ?>
                                            <h3 class="title"><?php 
                    echo esc_html($countdown_text);
                    ?>
</h3>
                                        <?php 
                }
                ?>
                                        <span class="countdown-lastest" data-y="<?php 
                _e(esc_attr($y));
                ?>
" data-m="<?php 
                _e(esc_attr($m));
                ?>
" data-d="<?php 
                _e(esc_attr($d));
                ?>
" data-h="<?php 
                _e(esc_attr($h));
                ?>
" data-i="<?php 
                _e(esc_attr($mi));
                ?>
" data-s="<?php 
                _e(esc_attr($s));
                ?>
"></span>
                                <?php 
            }
            ?>
                                <?php 
            $meta_query = WC()->query->get_meta_query();
            $ids = explode(',', $product_id);
            $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => 1, 'meta_query' => $meta_query, 'suppress_filter' => true);
            if (is_array($ids) && !empty($ids)) {
                $args['post__in'] = $ids;
                $args['orderby'] = 'post__in';
            }
            $products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $args, $atts));
            if ($products->have_posts()) {
                remove_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_rating');
                while ($products->have_posts()) {
                    $products->the_post();
                    ?>
                                        <div class="product-info">
                                            <h4 class="product-name"><a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
"></a><?php 
                    the_title();
                    ?>
</h4>
                                            <div class="desc"><?php 
                    the_excerpt();
                    ?>
</div>
                                            <?php 
                    /**
                     * woocommerce_after_shop_loop_item_title hook
                     * 
                     * @hooked woocommerce_template_loop_price - 5
                     * @hooked woocommerce_template_loop_rating - 10
                     */
                    do_action('kt_after_shop_loop_item_title');
                    ?>
                                            <div class="group-button-control">
                                                <?php 
                    woocommerce_template_loop_add_to_cart();
                    ?>
                                                <?php 
                    kt_get_tool_wishlish();
                    ?>
                                            </div>
                                        </div>
                                <?php 
                }
                // end of the loop.
                wp_reset_query();
                wp_reset_postdata();
                add_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_rating');
            }
            ?>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        <?php 
        }
        return ob_get_clean();
    }
コード例 #16
0
 function thb_loop_product_end()
 {
     global $post, $product;
     $size = sizeof(get_the_terms($post->ID, 'product_cat'));
     echo $product->get_categories(', ', '<span class="posted_in">' . _n('', '', $size, 'woocommerce') . ' ', '</span>');
     woocommerce_template_loop_rating();
     echo '<div class="thb-add-to-cart-wrapper">';
     woocommerce_template_loop_price();
     woocommerce_template_loop_add_to_cart();
     echo "</div>";
     echo "</div>";
 }
コード例 #17
0
ファイル: functions.php プロジェクト: willowmagrini/dg
function replace_add_to_cart()
{
    global $product;
    if ($product->get_stock_quantity() == 0 && $product->get_type() != 'variable') {
        $link = $product->get_permalink();
        echo '<a data-prod-id="' . $product->get_id() . '" data-link="' . $link . '" data-nome="' . $product->get_title() . '"class="encomendarAdd button" href="#" class="button addtocartbutton">Esgotago</a>';
    } elseif ($product->get_type() == 'variable') {
        $filhas = $product->get_children();
        $estoque = 0;
        foreach ($filhas as $filha => $id) {
            $produto = get_product($id);
            if ($produto->get_stock_quantity() != 0) {
                $estoque = 1;
            }
            // 	echo '<prev>';
            // print_r($produto->get_stock_quantity());
            // echo '</prev>';
        }
        if ($estoque == 0) {
            $link = $product->get_permalink();
            echo '<a data-prod-id="' . $product->get_id() . '" data-link="' . $link . '" data-nome="' . $product->get_title() . '"class="encomendarAdd button" href="#" class="button addtocartbutton">Esgotago</a>';
        } else {
            woocommerce_template_loop_add_to_cart();
        }
    } else {
        woocommerce_template_loop_add_to_cart();
    }
}
コード例 #18
0
    function wd_best_selling_product_slider_function($atts, $content)
    {
        $_actived = apply_filters('active_plugins', get_option('active_plugins'));
        if (!in_array("woocommerce/woocommerce.php", $_actived)) {
            return;
        }
        global $woocommerce_loop, $woocommerce, $wd_data;
        extract(shortcode_atts(array('columns' => 4, 'row' => 1, 'big_product' => '', 'per_page' => 4, 'cat_slug' => '', 'product_tag' => '', 'title' => '', 'desc' => '', 'show_type' => 'grid', 'show_nav' => 1, 'show_icon_nav' => 0, 'autoplay' => 1, 'show_image' => 1, 'show_title' => 1, 'show_sku' => 0, 'show_price' => 1, 'show_rating' => 1, 'show_label' => 1, 'show_categories' => 1, 'show_add_to_cart' => 1, 'show_short_content' => 0), $atts));
        if ($columns > 6) {
            $columns = 6;
        }
        $extra_class_row = '';
        if ($row > 1) {
            $extra_class_row = "over-row";
        }
        if ($row > 4) {
            $columns = 4;
        }
        if ($per_page < 1) {
            $per_page = 6;
        }
        if ($columns < 1) {
            $columns = 2;
        }
        if ($columns > 6) {
            $columns = 6;
        }
        if ($row < 1) {
            $per_page = 2;
        }
        if ($row > 4) {
            $row = 4;
        }
        $options = array('show_image' => $show_image, 'show_categories' => $show_categories, 'show_title' => $show_title, 'show_rating' => $show_rating, 'show_sku' => $show_sku, 'show_short_content' => $show_short_content, 'show_price' => $show_price, 'show_label' => $show_label, 'show_add_to_cart' => $show_add_to_cart);
        wd_remove_function_from_product_hook($options);
        if (strlen(trim($big_product)) > 0) {
            $_big_prod = wd_product_by_id_function($big_product);
            if (isset($_big_prod) && $_big_prod->is_visible()) {
                $temp_add_to_cart_data = do_shortcode('[add_to_cart style="" show_price="false" id="' . $_big_prod->id . '"]');
            }
        }
        $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $per_page, 'order' => 'desc', 'meta_key' => 'total_sales', 'orderby' => 'meta_value_num', 'meta_query' => array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN')));
        if (isset($_big_prod) && $_big_prod->is_visible() && strlen(trim($_big_prod->id)) > 0) {
            $args['post__not_in'] = array($_big_prod->id);
        }
        if (trim($cat_slug) != '') {
            $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'terms' => array(esc_attr($cat_slug)), 'field' => 'slug', 'operator' => 'IN'));
        }
        if (strlen($product_tag) > 0 && strcmp('all-product-tags', $product_tag) != 0) {
            $args = array_merge($args, array('product_tag' => $product_tag));
        }
        ob_start();
        if (isset($wd_data['wd_prod_cat_column']) && absint($wd_data['wd_prod_cat_column']) > 0) {
            $_old_wd_prod_cat_column = $wd_data['wd_prod_cat_column'];
            $wd_data['wd_prod_cat_column'] = $columns;
        }
        $_old_woocommerce_loop_columns = $woocommerce_loop['columns'];
        $products = new WP_Query($args);
        $woocommerce_loop['columns'] = $columns;
        $extra_class = '';
        if ($products->have_posts()) {
            ?>
				<?php 
            $_random_id = 'recent_product_by_category_slider_wrapper_' . rand();
            ?>
				<div class="recent-product-sc shortcode-slider shortcode-product <?php 
            echo $show_type;
            ?>
 <?php 
            echo $extra_class_row;
            ?>
 <?php 
            echo strlen(trim($big_product)) > 0 ? 'big_product' : '';
            ?>
" id="<?php 
            echo $_random_id;
            ?>
">
					<?php 
            if (strlen(trim($title)) > 0 || strlen(trim($desc)) > 0) {
                ?>
					<header class="shortcode-title-wrapper"> 
						<?php 
                if (strlen(trim($title)) > 0) {
                    echo "<h3 class='heading-title slider-title'>" . esc_html($title) . "</h3>";
                }
                ?>
					</header>
					<?php 
                if (strlen(trim($desc)) > 0) {
                    echo "<p class='slider-desc-wrapper'>" . esc_html($desc) . "</p>";
                }
                ?>
					<?php 
            }
            ?>
					<?php 
            if (isset($_big_prod) && $_big_prod->is_visible()) {
                $_product = wc_get_product($_big_prod->id);
                $post = $_product->post;
                $extra_class = 'col-sm-12';
                $product = wc_setup_product_data($post);
                $image_title = esc_attr($_product->get_title());
                $product_link = esc_url($_product->get_permalink());
                $image = get_the_post_thumbnail($post->ID, apply_filters('single_product_large_thumbnail_size', 'shop_single'), array('alt' => $image_title, 'title' => $image_title));
                echo '<div class="wd-big-product product ' . $extra_class . '">';
                echo sprintf('<div class="wd_image product-thumbnail-wrapper"><a title="%s" href="%s">%s</a></div>', $image_title, $product_link, $image);
                echo '<div class="wd_meta product-meta-wrapper"><p class="price">' . $_product->get_price_html() . '</p>';
                woocommerce_template_loop_add_to_cart();
                //echo $temp_add_to_cart_data;
                echo '</div></div>';
                wc_setup_product_data($post);
            }
            ?>
	
					<div class="<?php 
            echo $show_type;
            ?>
 product-slider-wrapper ">	
						<div class="product-slider-inner loading">
							
							<?php 
            $current_row = 0;
            ?>
							
							<?php 
            woocommerce_product_loop_start();
            ?>
								
								<?php 
            $woocommerce_loop['columns'] = 1;
            ?>
								
								<?php 
            while ($products->have_posts()) {
                $products->the_post();
                ?>
									
									<?php 
                if ($row > 1 && $current_row % $row == 0) {
                    echo '<div class="products_group">';
                }
                ?>
									
									<?php 
                woocommerce_get_template_part('content', 'product');
                ?>
									
									<?php 
                if ($row > 1 && $current_row % $row + 1 == $row) {
                    echo '</div>';
                }
                $current_row++;
                ?>
									
								<?php 
            }
            // end of the loop.
            ?>
							<?php 
            woocommerce_product_loop_end();
            ?>
							
						</div>
					</div>	
					<div class="clear"></div>
				</div>
				<script type='text/javascript'>
				//<![CDATA[
					jQuery(document).ready(function() {
						"use strict";
						var temp_visible = <?php 
            echo esc_js($columns);
            ?>
;
						
						var row = <?php 
            echo esc_js($row);
            ?>
;

						var item_width = 180;
						
						var show_nav = <?php 
            if ($show_nav) {
                ?>
 true <?php 
            } else {
                ?>
 false <?php 
            }
            ?>
;

						var show_icon_nav = <?php 
            if ($show_icon_nav) {
                ?>
 true <?php 
            } else {
                ?>
 false <?php 
            }
            ?>
;
						
						var object_selector = "#<?php 
            echo $_random_id;
            ?>
  .products";
						
						var autoplay = <?php 
            if ($autoplay) {
                ?>
 true <?php 
            } else {
                ?>
 false <?php 
            }
            ?>
;
						
						var slider_data = {
								nav : show_nav
								,dots : show_icon_nav
								,autoplay : autoplay
								,responsive	: {
									0 : {
										items:1
									},
									300 : {
										items: 2
									},
									600 : {
										items: 3
									},
									900 : {
										items: 4
									},
									1160 : {
										items: <?php 
            echo esc_js($columns);
            ?>
									}
								}
						}
							
						generate_horizontal_slide(slider_data, row, object_selector);
					});
				//]]>	
				</script>
				
			<?php 
        }
        wp_reset_postdata();
        wd_restore_function_to_product_hook();
        $woocommerce_loop['columns'] = $_old_woocommerce_loop_columns;
        if (isset($_old_wd_prod_cat_column) && absint($_old_wd_prod_cat_column > 0)) {
            $wd_data['wd_prod_cat_column'] = $_old_wd_prod_cat_column;
        }
        return '<div class="woocommerce">' . ob_get_clean() . '</div>';
    }
コード例 #19
0
ファイル: config.php プロジェクト: bluedrone/plugins
function avia_add_cart_button()
{
    global $product, $avia_config;
    if ($product->product_type == 'bundle') {
        $product = new WC_Product_Bundle($product->id);
    }
    $extraClass = "";
    ob_start();
    woocommerce_template_loop_add_to_cart();
    $output = ob_get_clean();
    if (!empty($output)) {
        $pos = strpos($output, ">");
        if ($pos !== false) {
            $output = substr_replace($output, "><span class='avia-font-entypo-fontello'>" . $avia_config['font_icons']['cart'] . "</span> ", $pos, strlen(1));
        }
    }
    if ($product->product_type == 'variable' && empty($output)) {
        $output = "<a class='add_to_cart_button button product_type_variable' href='" . get_permalink($product->id) . "'><span class='avia-font-entypo-fontello'>" . $avia_config['font_icons']['details'] . "</span> " . __('Select options', 'avia_framework') . "</a>";
    }
    if ($product->product_type == 'simple') {
        $output .= "<a class='button show_details_button' href='" . get_permalink($product->id) . "'><span class='avia-font-entypo-fontello'>" . $avia_config['font_icons']['details'] . "</span> " . __('Show Details', 'avia_framework') . "</a>";
    } else {
        $extraClass = "single_button";
    }
    if (empty($extraClass)) {
        $output .= " <span class='button-mini-delimiter'></span>";
    }
    if ($output && !post_password_required()) {
        echo "<div class='avia_cart_buttons {$extraClass}'>{$output}</div>";
    }
}
コード例 #20
0
    function wd_hot_product($atts, $content = null)
    {
        extract(shortcode_atts(array('title' => '', 'number' => '4'), $atts));
        $post_type = "product";
        $thumbnail_width = 60;
        $thumbnail_height = 60;
        wp_reset_query();
        $popular = new wp_query(array('post_type' => 'product', 'posts_per_page' => $number, 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'order' => 'DESC'));
        global $post, $product;
        ?>
		<?php 
        if ($popular->post_count > 0) {
            $i = 0;
            $id_widget = 'hot_product-' . rand(0, 1000) . time();
            $count = 1;
            ob_start();
            ?>
		<div class="wd_hot_product wd_hot_loading">
			<div class="wd_heading">
				<h5>hot products</h5>
				<div class="wd_number_real"><span>1/<?php 
            echo $popular->post_count;
            ?>
</span></div>
			</div>
			<ul class="products popular-post-list<?php 
            echo $id_widget;
            ?>
">
				<?php 
            while ($popular->have_posts()) {
                $popular->the_post();
                ?>
				<li class="post-<?php 
                echo $post->ID;
                ?>
 product type-product status-publish henry">
					<div class="wd_number"><span><?php 
                echo $count;
                ?>
/<?php 
                echo $popular->post_count;
                ?>
</span></div>
					<div class="wd_product_wrapper">
						<div class="product_thumbnail_wrapper image image-style">
							<a class="thumbnail" href="<?php 
                echo get_permalink($post->ID);
                ?>
">
								<?php 
                if (has_post_thumbnail()) {
                    the_post_thumbnail('wd_hot_product', array('title' => esc_attr(get_the_title()), 'alt' => esc_attr(get_the_title())));
                }
                ?>
							</a>		
							<span class="shadow"></span>
							<?php 
                global $wd_data;
                if (!isset($wd_data['wd_catelog_mod']) || isset($wd_data['wd_catelog_mod']) && $wd_data['wd_catelog_mod'] == 1) {
                    ?>
							<div class='list_add_to_cart'>
							<?php 
                    woocommerce_template_loop_add_to_cart();
                    ?>
							</div>
							<?php 
                }
                ?>
						</div><!-- .image -->
						<?php 
                $product = get_product($popular->post);
                ?>
						<div class="product-meta-wrapper detail">
							<p class="hot_pr_sku"><?php 
                echo $product->get_sku();
                ?>
</p>
							<p class="title"><a  href="<?php 
                echo get_permalink($post->ID);
                ?>
"><?php 
                echo esc_attr(get_the_title($post->ID));
                ?>
</a></p>
							<?php 
                //the_excerpt();
                ?>
							<?php 
                woocommerce_template_loop_price();
                ?>
						</div>
						<input type='hidden' value='<?php 
                echo $product->id;
                ?>
' class='hidden_product_id product_hidden_<?php 
                echo $product->id;
                ?>
'>
					</div>	
				</li>
				<?php 
                $count++;
                ?>
				<?php 
            }
            ?>
			</ul>
			<?php 
            echo '<div class="clearfix"></div>';
            echo '<div class="wd_hot_control"><a class="prev" title="prev" id="wd_hot_product_prev_' . $id_widget . '" href="#">&lt;</a>';
            echo '<a class="next" title="next" id="wd_hot_product_next_' . $id_widget . '" href="#" >&gt;</a> </div>';
        }
        ?>
		</div>
		<script type="text/javascript" language="javascript">
	//<![CDATA[
		jQuery(document).ready(function() {
			jQuery('.wd_hot_product').removeClass('wd_hot_loading');
			var li_widget = jQuery('.popular-post-list<?php 
        echo $id_widget;
        ?>
').parent().parent('li');
			var temp_class = '';
			if(li_widget.hasClass('first')){ 
				temp_class = '.first';
			}
			
			_slider_datas = {				
				responsive: true
				,width	: 240
				,height	: 'auto'
				,scroll  : {
					items	: 1,
				}
				,debug	 : true
				,auto    : false
				,swipe	: { onMouse: true, onTouch: true }	
				,items   : { 
					width		: 240
					,height		: 'auto'
					,visible	: {
						min		: 1
						,max	: 1
					}						
				}	
				,scroll	: 	{
							items	: 1
							,onAfter : function( data ) {
								var temp = jQuery('.wd_hot_product .wd_number').html();
								jQuery('.wd_hot_product .wd_number_real').html(temp);
							}
				}
			};
			jQuery('.wd_hot_product').each(function( i, value ) {
				if(jQuery(value).find('ul.popular-post-list<?php 
        echo $id_widget;
        ?>
').parent('.caroufredsel_wrapper').length > 0 )
					return;
				
				jQuery(value).find('ul.popular-post-list<?php 
        echo $id_widget;
        ?>
').siblings('.wd_hot_control').addClass('control_' + i);
				jQuery(value).find('ul.popular-post-list<?php 
        echo $id_widget;
        ?>
').siblings('.wd_hot_control').addClass('control_' + i);
				
				_slider_datas.prev    = '.control_' + i +' #wd_hot_product_prev_<?php 
        echo $id_widget;
        ?>
';
				_slider_datas.next    = '.control_' + i+' #wd_hot_product_next_<?php 
        echo $id_widget;
        ?>
';
				
				jQuery(value).find('ul.popular-post-list<?php 
        echo $id_widget;
        ?>
').carouFredSel(_slider_datas);
				
			});
			
			
			jQuery('window').bind('resize',jQuery.debounce( 250, function(){
				jQuery('.wd_hot_product').each(function( i, value ) {
					jQuery(value).find('ul.popular-post-list<?php 
        echo $id_widget;
        ?>
').trigger('configuration ',["items.width", 300, true]);
					jQuery(value).find('ul.popular-post-list<?php 
        echo $id_widget;
        ?>
').trigger('destroy',true);
					jQuery(value).find('ul.popular-post-list<?php 
        echo $id_widget;
        ?>
').carouFredSel(_slider_datas);
				});
			}));				
			
		});	
	//]]>	
	</script>
	<?php 
        $ret_html = ob_get_contents();
        ob_end_clean();
        ?>
	
		<?php 
        wp_reset_query();
        ?>
	
<?php 
        return $ret_html;
    }
コード例 #21
0
 function wclsc_woocommerce_quickview_loop_add_to_cart()
 {
     global $post, $product, $woocommerce;
     if (has_term($this->no_shipping_categories, 'product_cat', $post->ID)) {
         echo '<a href="' . get_permalink($product->id) . '" rel="nofollow" data-product_id="' . $product->ID . '" class="button add_to_cart_button product_type_simple">Product Details</a>';
     } else {
         woocommerce_template_loop_add_to_cart();
     }
 }
 public function set_grouped_add_to_cart()
 {
     global $product, $post;
     $grouped_product = $product;
     $grouped_products = $product->get_children();
     $quantites_required = false;
     $parent_product_post = $post;
     do_action('woocommerce_before_add_to_cart_form');
     echo "<form class='cart paywhatyouwant' method='post' enctype='multipart/form-data'>";
     echo '    <table cellspacing="0" class="group_table pwyw_table">';
     // START DOOP
     echo '      <tbody>';
     foreach ($grouped_products as $product_id) {
         $product = get_product($product_id);
         $post = $product->post;
         setup_postdata($post);
         echo '          <tr>';
         echo '              <td>';
         if ($product->is_sold_individually() || !$product->is_purchasable()) {
             woocommerce_template_loop_add_to_cart();
         } else {
             $quantites_required = true;
             woocommerce_quantity_input(array('input_name' => 'quantity[' . $product_id . ']', 'input_value' => '0'));
         }
         echo '              </td>';
         /*
         echo '              <td class="label paywhatyouwant">';
         echo '                  <label class="paywhatyouwant" for="product-' . $product_id . '">';
         								        echo $product->is_visible() ? '<a href="' . get_permalink() . '">' . get_the_title() . '</a>' : get_the_title();
         echo '                  </label>';
         echo '              </td>';
         do_action ( 'woocommerce_grouped_product_list_before_price', $product );
         echo '              <td class="price">';
                             echo $product->get_price_html();
                             if ( ( $availability = $product->get_availability() ) && $availability['availability'] ) {
                                 echo apply_filters( 'woocommerce_stock_html', '<p class="stock ' . esc_attr( $availability['class'] ) . '">' . esc_html( $availability['availability'] ) . '</p>', $availability['availability'] );
                             }
         echo '              </td>';
         */
         echo '              <td>';
         echo '              <table class="pwyw_inner_table">';
         echo '                  <tr>';
         echo '                      <td>';
         echo '                      <label class="paywhatyouwant" for="product-' . $product_id . '">';
         echo $product->is_visible() ? '<a href="' . get_permalink() . '">' . get_the_title() . '</a>' : get_the_title();
         echo '                      </label>';
         echo '                      </td>';
         echo '                  </tr>';
         do_action('woocommerce_grouped_product_list_before_price', $product);
         echo '                  <tr>';
         echo '                      <td>';
         echo $product->get_price_html();
         if (($availability = $product->get_availability()) && $availability['availability']) {
             echo apply_filters('woocommerce_stock_html', '<p class="stock ' . esc_attr($availability['class']) . '">' . esc_html($availability['availability']) . '</p>', $availability['availability']);
         }
         echo '                      </td>';
         echo '                  </tr>';
         echo '              </table>';
         echo '              </td>';
         echo '          </tr>';
     }
     // Reset to parent grouped product
     $post = $parent_product_post;
     $product = get_product($parent_product_post->ID);
     setup_postdata($parent_product_post);
     echo '      </tbody>';
     // END DOOP
     echo '  </table>';
     echo '  <input id="pwyw-add-to-cart-grouped" type="hidden" name="add-to-cart-grouped" value="true" />';
     echo '  <input type="hidden" name="add-to-cart" value="' . esc_attr($product->id) . '" />';
     if ($quantites_required) {
         do_action('woocommerce_before_add_to_cart_button');
         echo '  <button type="submit" class="single_add_to_cart_button button alt pwyw_price_input pwyw_grouped">' . $product->single_add_to_cart_text() . '</button>';
         do_action('woocommerce_after_add_to_cart_button');
     }
     echo "</form>";
     do_action('woocommerce_after_add_to_cart_form');
     self::set_product_meta();
 }
コード例 #23
0
 public function wpv_woo_buy_or_select_func($atts)
 {
     /*Add to cart in loops	  
      */
     global $post, $wpdb, $woocommerce;
     if ('product' == $post->post_type) {
         //Run only on page with products
         $product = $this->wcviews_setup_product_data($post);
         if (isset($atts['add_to_cart_text'])) {
             //User is setting add to cart text customized
             if (!empty($atts['add_to_cart_text'])) {
                 $add_to_cart_text_product_listing = trim($atts['add_to_cart_text']);
                 //START support for string translation
                 if (function_exists('icl_register_string')) {
                     //Register add to cart text product listing for translation
                     icl_register_string('woocommerce_views', 'add_to_cart_text', $add_to_cart_text_product_listing);
                 }
                 global $add_to_cart_text_product_listing_translated;
                 if (!function_exists('icl_t')) {
                     //String translation plugin not available use original text
                     $add_to_cart_text_product_listing_translated = $add_to_cart_text_product_listing;
                 } else {
                     //String translation plugin available return translation
                     $add_to_cart_text_product_listing_translated = icl_t('woocommerce_views', 'add_to_cart_text', $add_to_cart_text_product_listing);
                 }
                 $is_using_revised_wc_simple = $this->wcviews_using_woocommerce_two_point_one_above();
                 if ($is_using_revised_wc_simple) {
                     //Updated WC
                     add_filter('woocommerce_product_add_to_cart_text', array(&$this, 'add_to_cart_buy_or_select_closures'), 10, 2);
                 } else {
                     //Old WC
                     add_filter('add_to_cart_text', array(&$this, 'add_to_cart_buy_or_select_closures'));
                 }
             }
         }
         if (isset($atts['link_to_product_text'])) {
             //User is setting link to product text customized
             if (!empty($atts['link_to_product_text'])) {
                 $link_product_listing = trim($atts['link_to_product_text']);
                 //START support for string translation
                 if (function_exists('icl_register_string')) {
                     //Register add to cart text product listing for translation
                     icl_register_string('woocommerce_views', 'link_to_product_text', $link_product_listing);
                 }
                 global $link_product_listing_translated;
                 if (!function_exists('icl_t')) {
                     //String translation plugin not available use original text
                     $link_product_listing_translated = $link_product_listing;
                 } else {
                     //String translation plugin available return translation
                     $link_product_listing_translated = icl_t('woocommerce_views', 'link_to_product_text', $link_product_listing);
                 }
                 //END support for string translation
                 $is_using_revised_wc = $this->wcviews_using_woocommerce_two_point_one_above();
                 if ($is_using_revised_wc) {
                     add_filter('woocommerce_product_add_to_cart_text', array(&$this, 'add_to_cart_buy_or_select_closures_listing'), 10, 2);
                 } else {
                     add_filter('variable_add_to_cart_text', array(&$this, 'add_to_cart_buy_or_select_closures_listing'));
                 }
             }
         }
         //Let's check the rendering template based on quantity field parameter
         //https://icanlocalize.basecamphq.com/projects/11629195-toolset-peripheral-work/todo_items/193031409/comments
         if (isset($atts['show_quantity_in_button'])) {
             $show_quantity = $atts['show_quantity_in_button'];
             $show_quantity = strtolower($show_quantity);
             if ('yes' == $show_quantity) {
                 //User wants to display quantities next to add to cart button in Loops
                 add_filter('wc_get_template', array(&$this, 'custom_add_to_cart_template_with_qty'), 15, 5);
             } else {
                 remove_filter('wc_get_template', array(&$this, 'custom_add_to_cart_template_with_qty'), 15, 5);
             }
         } else {
             remove_filter('wc_get_template', array(&$this, 'custom_add_to_cart_template_with_qty'), 15, 5);
         }
         if (isset($product)) {
             ob_start();
             if (isset($atts['show_variation_options'])) {
                 //Variation option is set
                 $show_variation_options = trim($atts['show_variation_options']);
                 $show_variation_options = strtolower($show_variation_options);
                 if ('yes' == $show_variation_options) {
                     //User wants to display variation options on listing pages
                     if ('variable' == $product->product_type) {
                         //This is a variable product, display.
                         do_action('woocommerce_variable_add_to_cart');
                     } else {
                         //Not variable product, ignore it just display the usual thing
                         woocommerce_template_loop_add_to_cart();
                     }
                 } else {
                     //Here user sets a different value for show variation options, its not 'yes', so just display the usual thing.
                     woocommerce_template_loop_add_to_cart();
                 }
             } else {
                 //Variation option is not yet, just display normally
                 woocommerce_template_loop_add_to_cart();
             }
             return ob_get_clean();
         } else {
             return '';
         }
     }
 }
コード例 #24
0
ファイル: index.php プロジェクト: namnguyen2312/spa
		function dt_woocommerce_shop_overview_extra_div_close() {
			global $product;

			$link = apply_filters( 'out_of_stock_add_to_cart_url', get_permalink( $product->id ) );
			
			ob_start();
			woocommerce_template_loop_price();
			$price = ob_get_clean();

			ob_start();
			woocommerce_template_loop_add_to_cart();
			$add_to_cart = ob_get_clean();

			if( !empty($add_to_cart) ) {
				$add_to_cart = str_replace(' class="',' class="small button ',$add_to_cart);
			}

			echo "		<div class='product-details'>";
			echo 		$price;
			echo "		<div class='product-buttons'>";
			echo 			$add_to_cart;
							if ( shortcode_exists( 'yith_wcwl_add_to_wishlist' ) )
							echo  do_shortcode('[yith_wcwl_add_to_wishlist]');	
			echo "		</div>";			
			echo "		</div>";
			echo '	</div>';
			echo '</div>';
		}
コード例 #25
0
    /**
     * Display a single product price + cart button
     *
     * @param array $atts
     * @return string
     */
    public static function product_add_to_cart($atts)
    {
        global $wpdb, $post;
        if (empty($atts)) {
            return '';
        }
        $atts = shortcode_atts(array('id' => '', 'class' => '', 'quantity' => '1', 'sku' => '', 'style' => 'border:4px solid #ccc; padding: 12px;', 'show_price' => 'true'), $atts);
        if (!empty($atts['id'])) {
            $product_data = get_post($atts['id']);
        } elseif (!empty($atts['sku'])) {
            $product_id = wc_get_product_id_by_sku($atts['sku']);
            $product_data = get_post($product_id);
        } else {
            return '';
        }
        $product = wc_setup_product_data($product_data);
        if (!$product) {
            return '';
        }
        ob_start();
        ?>
		<p class="product woocommerce add_to_cart_inline <?php 
        echo $atts['class'];
        ?>
" style="<?php 
        echo $atts['style'];
        ?>
">

			<?php 
        if ('true' == $atts['show_price']) {
            ?>
				<?php 
            echo $product->get_price_html();
            ?>
			<?php 
        }
        ?>

			<?php 
        woocommerce_template_loop_add_to_cart(array('quantity' => $atts['quantity']));
        ?>

		</p><?php 
        // Restore Product global in case this is shown inside a product post
        wc_setup_product_data($post);
        return ob_get_clean();
    }
コード例 #26
0
ファイル: config.php プロジェクト: eddiewilson/new-ke
function avia_woocommerce_thumbnail()
{
    //circumvent the missing post and product parameter in the loop_shop template
    global $post;
    $product =& new WC_Product($post->ID);
    //$rating = $product->get_rating_html(); //rating is removed for now since the current implementation requires wordpress to do 2 queries for each post which is not that cool on overview pages
    ob_start();
    if ($product->product_type != 'external') {
        woocommerce_template_loop_add_to_cart($post, $product);
    }
    $link = ob_get_clean();
    $extraClass = empty($link) ? "single_button" : "";
    echo "<div class='thumbnail_container'>";
    echo "<div class='thumbnail_container_inner'>";
    echo get_the_post_thumbnail(get_the_ID(), 'shop_catalog');
    echo $link;
    echo "<a class='button show_details_button {$extraClass}' href='" . get_permalink($post->ID) . "'>" . __('Show Details', 'avia_framework') . "</a>";
    if (!empty($rating)) {
        echo "<span class='rating_container'>" . $rating . "</span>";
    }
    echo "</div>";
    echo "</div>";
}
コード例 #27
0
/**
 * Display a single prodcut price + cart button
 **/
function woocommerce_product_add_to_cart($atts)
{
    if (empty($atts)) {
        return;
    }
    global $wpdb, $woocommerce;
    if (!isset($atts['style'])) {
        $atts['style'] = 'border:4px solid #ccc; padding: 12px;';
    }
    if ($atts['id']) {
        $product_data = get_post($atts['id']);
    } elseif ($atts['sku']) {
        $product_id = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key='_sku' AND meta_value='%s' LIMIT 1", $atts['sku']));
        $product_data = get_post($product_id);
    } else {
        return;
    }
    if ($product_data->post_type == 'product') {
        $product = $woocommerce->setup_product_data($product_data);
        if (!$product->is_visible()) {
            continue;
        }
        ob_start();
        ?>
		<p class="product" style="<?php 
        echo $atts['style'];
        ?>
">
		
			<?php 
        echo $product->get_price_html();
        ?>
			
			<?php 
        woocommerce_template_loop_add_to_cart();
        ?>
						
		</p><?php 
        return ob_get_clean();
    } elseif ($product_data->post_type == 'product_variation') {
        $product = new WC_Product($product_data->post_parent);
        $GLOBALS['product'] = $product;
        $variation = new WC_Product_Variation($product_data->ID);
        if (!$product->is_visible()) {
            continue;
        }
        ob_start();
        ?>
		<p class="product product-variation" style="<?php 
        echo $atts['style'];
        ?>
">
		
			<?php 
        echo $product->get_price_html();
        ?>
			
			<?php 
        $link = $product->add_to_cart_url();
        $label = apply_filters('add_to_cart_text', __('Add to cart', 'woocommerce'));
        $link = add_query_arg('variation_id', $variation->variation_id, $link);
        foreach ($variation->variation_data as $key => $data) {
            if ($data) {
                $link = add_query_arg($key, $data, $link);
            }
        }
        echo sprintf('<a href="%s" data-product_id="%s" class="button add_to_cart_button product_type_%s">%s</a>', esc_url($link), $product->id, $product->product_type, $label);
        ?>
						
		</p><?php 
        return ob_get_clean();
    }
}
コード例 #28
0
 public static function get_product_addtocart($product_id, $show_addtocart = true)
 {
     $product_addtocart_output = '';
     global $product;
     if ($show_addtocart) {
         $current_db_version = get_option('woocommerce_db_version', null);
         if (version_compare($current_db_version, '2.0', '<') && null !== $current_db_version) {
             $current_product = new WC_Product($product_id);
         } elseif (version_compare(WC()->version, '2.2.0', '<')) {
             $current_product = get_product($product_id);
         } else {
             $current_product = wc_get_product($product_id);
         }
         $product = $current_product;
         ob_start();
         if (function_exists('woocommerce_template_loop_add_to_cart')) {
             woocommerce_template_loop_add_to_cart();
         }
         $product_addtocart_html = ob_get_clean();
         $product_addtocart_output = '<div class="rs_rs_addtocart">' . $product_addtocart_html . '</div>';
     }
     return $product_addtocart_output;
 }
コード例 #29
0
<form class="cart" method="post" enctype='multipart/form-data'>
	<table cellspacing="0" class="group_table">
		<tbody>
			<?php 
foreach ($grouped_products as $product_id) {
    $product = get_product($product_id);
    $post = $product->post;
    setup_postdata($post);
    ?>
					<tr>
						<td>
							<?php 
    if ($product->is_sold_individually() || !$product->is_purchasable()) {
        ?>
								<?php 
        woocommerce_template_loop_add_to_cart();
        ?>
							<?php 
    } else {
        ?>
								<?php 
        $quantites_required = true;
        woocommerce_quantity_input(array('input_name' => 'quantity[' . $product_id . ']', 'input_value' => '0'));
        ?>
							<?php 
    }
    ?>
						</td>

						<td class="label">
							<label for="product-<?php 
コード例 #30
0
    /**
     * Display a single product price + cart button
     *
     * @access public
     * @param array $atts
     * @return string
     */
    public static function product_add_to_cart($atts)
    {
        global $wpdb, $post;
        if (empty($atts)) {
            return '';
        }
        extract(shortcode_atts(array('id' => '', 'sku' => '', 'style' => 'border:4px solid #ccc; padding: 12px;', 'show_price' => 'true'), $atts));
        if (!empty($id)) {
            $product_data = get_post($id);
        } elseif (!empty($sku)) {
            $product_id = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key='_sku' AND meta_value='%s' LIMIT 1", $sku));
            $product_data = get_post($product_id);
        } else {
            return '';
        }
        $product = wc_setup_product_data($product_data);
        if (!$product) {
            return '';
        }
        ob_start();
        ?>
		<p class="product woocommerce" style="<?php 
        echo $style;
        ?>
">

			<?php 
        if ($show_price == 'true') {
            ?>
				<?php 
            echo $product->get_price_html();
            ?>
			<?php 
        }
        ?>

			<?php 
        woocommerce_template_loop_add_to_cart();
        ?>

		</p><?php 
        // Restore Product global in case this is shown inside a product post
        wc_setup_product_data($post);
        return ob_get_clean();
    }