global $grid_products; ?> <div class="col-xs-12 col-sm-4 no-margin product"> <div class="product-item-wrap"> <div class="product-item"> <div class="product-item-inner"> <?php woocommerce_template_loop_product_thumbnail(); ?> <div class="product-body"> <h4 class="product-title"><a href="<?php the_permalink(); ?> "><?php echo apply_filters('product_title_one_product_6_1', get_the_title()); ?> </a></h4> <?php woocommerce_show_brand(); ?> </div> <?php wc_get_template('loop/price.php'); ?> <?php wc_get_template('loop/hover-area.php'); ?> </div><!-- /.product-item-inner --> </div><!-- /.product-item --> </div><!-- /.product-item-wrap --> </div><!-- /.product-item-holder -->
function woocommerce_products_live_search() { if (isset($_REQUEST['fn']) && 'get_ajax_search' == $_REQUEST['fn']) { $query_args = array('posts_per_page' => 10, 'no_found_rows' => true, 'post_type' => 'product'); if (isset($_REQUEST['terms'])) { $query_args['s'] = $_REQUEST['terms']; } $search_query = new WP_Query($query_args); $results = array(); if ($search_query->get_posts()) { foreach ($search_query->get_posts() as $the_post) { $title = get_the_title($the_post->ID); if (has_post_thumbnail($the_post->ID)) { $post_thumbnail_ID = get_post_thumbnail_id($the_post->ID); $post_thumbnail_src = wp_get_attachment_image_src($post_thumbnail_ID, 'thumbnail'); } else { $dimensions = wc_get_image_size('thumbnail'); $post_thumbnail_src = array(wc_placeholder_img_src(), esc_attr($dimensions['width']), esc_attr($dimensions['height'])); } $product = new WC_Product($the_post->ID); $price = $product->get_price_html(); $brand = woocommerce_show_brand($the_post->ID, true); $title = html_entity_decode($title, ENT_QUOTES, 'UTF-8'); $results[] = array('value' => $title, 'url' => get_permalink($the_post->ID), 'tokens' => explode(' ', $title), 'image' => $post_thumbnail_src[0], 'price' => $price, 'brand' => $brand); } } else { $results[] = __('Sorry. No results match your search.', 'media_center'); } wp_reset_postdata(); echo json_encode($results); } die; }
<?php if (!$_product->is_visible()) { echo apply_filters('woocommerce_cart_item_name', $_product->get_title(), $cart_item, $cart_item_key); } else { echo apply_filters('woocommerce_cart_item_name', sprintf('<a href="%s">%s</a>', $_product->get_permalink($cart_item), $_product->get_title()), $cart_item, $cart_item_key); } // Meta data echo WC()->cart->get_item_data($cart_item); // Backorder notification if ($_product->backorders_require_notification() && $_product->is_on_backorder($cart_item['quantity'])) { echo '<p class="backorder_notification">' . __('Available on backorder', 'media_center') . '</p>'; } ?> </div><!-- /.title --> <?php woocommerce_show_brand($_product->id); ?> <div class="price unit-price visible-xs"> <?php echo apply_filters('woocommerce_cart_item_price', WC()->cart->get_product_price($_product), $cart_item, $cart_item_key); ?> </div> </div> </div> </div> <div class="hidden-xs col-sm-2"> <div class="price unit-price"> <?php echo apply_filters('woocommerce_cart_item_price', WC()->cart->get_product_price($_product), $cart_item, $cart_item_key); ?>