function pw_woo_ad_sesarch_quickview() { global $wpdb, $pw_woo_ad_main_class, $post, $woocommerce; $product_id = $_POST['post_id']; $id = $_POST['post_id']; $product = get_product($product_id); $title = $product->get_title(); $excerpt = $product->post->post_excerpt; $postd = get_post($id); // echo $excerpt.'<br/>'; // echo $id.'<br/>'; //print_r($post); // $postd->post_excerpt; // echo '<br/>'.$postd->post_excerpt; $thumbnail_id = $product->get_image_id(); $src_featured = wp_get_attachment_image($thumbnail_id, 'thumbnail'); //Featured Image with size $img = $product->get_image(); //Featured Image $permalink = $product->get_permalink(); $add_to_cart_url = $product->add_to_cart_url(); $regular_price = $product->get_regular_price(); $sale_price = $product->get_sale_price(); $price = $product->get_price_html(); //$rating = $product->get_rating_html(); $rating = pw_woo_ad_search_rating_grid($id); $cat = $product->get_categories(); $tag = $product->get_tags(); $sku = $product->get_sku(); $stock_status = $product->is_in_stock(); //1 : in ,0 :out $stock_quantity = $product->get_stock_quantity(); $featured = $product->is_featured(); $on_sale = $product->is_on_sale(); // 1:0 $thumb_index = 0; $product_thumb = $product_slide = ''; $img_url = array(); $img_url_default = ''; if ($product->get_image_id() != NULL) { $img_url = wp_get_attachment_image_src($product->get_image_id(), 'large'); $img_url_thumb = wp_get_attachment_image_src($product->get_image_id(), 'thumbnail'); $product_slide .= '<li><img src="' . $img_url[0] . '" ></li>'; $product_thumb .= '<a data-slide-index="' . $thumb_index++ . '" href=""><img src="' . $img_url_thumb[0] . '" /></a>'; } $this_product_gallery = $product->get_gallery_attachment_ids(); if ($this_product_gallery != NULL) { foreach ($this_product_gallery as $this_image) { $img_url = wp_get_attachment_image_src($this_image, 'large'); $img_url_thumb = wp_get_attachment_image_src($this_image, 'thumbnail'); $product_slide .= '<li><img src="' . $img_url[0] . '" ></li>'; $product_thumb .= '<a data-slide-index="' . $thumb_index++ . '" href=""><img src="' . $img_url_thumb[0] . '" /></a>'; } } if ($product->get_image_id() == NULL && $this_product_gallery == NULL) { $img_url_default = wc_placeholder_img_src(); } $add_to_cart_btn = ''; $add_to_cart_label = pw_woo_ad_search_add_to_cart_grid('label', $id); if ($product->is_type('simple')) { $add_to_cart_btn = "<div class='woo-addcard-btn back-btn'><a href='" . $product->add_to_cart_url() . "' data-quantity='1' data-product_sku='" . $product->get_sku() . "' data-product_id={$id} rel='nofollow' ><span>" . $add_to_cart_label . "</span></a></div>"; } else { $add_to_cart_btn = "<div class='woo-addcard-btn back-btn'><a href='" . $product->add_to_cart_url() . "' data-quantity='1' data-product_sku='" . $product->get_sku() . "' data-product_id={$id} rel='nofollow' ><span>" . $add_to_cart_label . "</span></a></div>"; } echo '<div class="woo-row">'; echo '<div class="woo-col-md-7 woo-quick-image-cnt"> <ul id="woo-quick-car" class="woo-quick-car woo-bxslider woo-single-car woo-carousel-layout">' . $product_slide . '</ul> <div id="woo-pager" class="woo-pager"> ' . $product_thumb . ' </div> </div>'; echo '<div class="woo-col-md-5"> <div class="woo-quick-detail-cnt">'; echo '<h3 class="woo-quick-title"><a href="' . $permalink . '" >' . $title . '</a></h3>'; echo '<div class="woo-quick-rating">' . $rating . '</div>'; echo '<div class="woo-quick-price"><span class="woo-quick-sale-price">' . $price . '</div>'; echo '<div class="woo-quick-excerpt">' . $excerpt . '</div>'; print_r('<div class="woo-quick-cat">' . $cat . '</div>'); print_r('<div class="woo-quick-tag">' . $tag . '</div>'); echo '<div class="woo-quick-add add_to_cart_button product_type_simple add-to-cart" data-product_id="' . $id . '" data-quantity="1">' . $add_to_cart_btn . '</div>'; echo ' </div> </div>'; echo '</div>'; exit(0); }
if ($my_query->have_posts()) { while ($my_query->have_posts()) { $title = $regular_price = $price = $add_to_cart = $sale_price = $stock_status = $cate = $tag = $sku = $featured = $src_featured = $image_gallery = $thumbnail_id = $price = ""; $my_query->the_post(); $id = $my_query->post->ID; $title = get_the_title(); // echo wc_get_template( 'loop/rating.php' ); // echo $product->get_rating_html($id); $product = get_product($id); $price = $product->get_price_html(); $add_to_cart_link = pw_woo_ad_search_add_to_cart_grid('link'); $add_to_cart_has_tag_a = false; if (strpos($add_to_cart_link, 'href=')) { $add_to_cart_has_tag_a = true; } $add_to_cart_label = pw_woo_ad_search_add_to_cart_grid('label'); $regular_price = get_post_meta(get_the_ID(), '_regular_price', true); $sale_price = get_post_meta(get_the_ID(), '_sale_price', true); $cat = get_the_term_list(get_the_ID(), 'product_cat', '', ' / ', ''); $tag = get_the_term_list(get_the_ID(), 'product_tag'); $sku = get_post_meta(get_the_ID(), '_sku', true); $featured = get_post_meta(get_the_ID(), '_featured', true); $thumbnail_id = get_post_meta(get_the_ID(), '_thumbnail_id', true); $src_featured = wp_get_attachment_image($thumbnail_id, 'thumbnail'); $stock_status = get_post_meta(get_the_ID(), '_stock_status', true); $arr_img = ""; $arr_img = explode(',', get_post_meta(get_the_ID(), '_product_image_gallery', true)); // $img=get_the_post_thumbnail( get_the_ID(), 'thumbnail' ); //Get Image's /* $args = array( 'post_type' => 'attachment',