Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!--product dropdown-->
- <?php
- //$hd_var=$_POST['hidden_prod'];
- $dpwn = array(
- 'post_type' => 'product',
- 'paged' => $paged,
- 'orderby'=>'title','posts_per_page'=> -1,
- 'order'=>'ASC', 'tax_query' => array(
- array(
- 'taxonomy' => 'product_cat',
- 'field' => 'slug',
- 'terms' => 'products'
- )
- )
- );
- $search_drpdwn=new WP_Query($dpwn);
- ?>
- <?php wp_reset_postdata();?>
- <div class="styled-select">
- <form method="post" action="" id="prod_form">
- <select id="product_post" name="product_post">
- <!--onchange="window.location.replace(this.options[this.selectedIndex].value)"-->
- <option>Select Product</option>
- <?php while($search_drpdwn->have_posts()): $search_drpdwn->the_post();?>
- <option value="<?php echo $post->ID;?>" ><?php the_title();?></option>
- <?php endwhile;?>
- </select>
- <input type="hidden" name="hidden_prod" id="hidden_prod" value="">
- </form>
- </div></div>
- <?php
- if(isset($_POST['product_post']))
- {
- $hd_var=$_POST['hidden_prod'];
- $drpwn = array(
- 'post_type' => 'products',
- 'paged' => $paged,
- 'orderby'=>'title',
- 'order'=>'ASC',
- 'p'=>$hd_var
- );
- $s_drpdwn=new WP_Query($drpwn);
- ?>
- <!--<form method="post" action="">-->
- <?php
- if($s_drpdwn->have_posts()) :
- while($s_drpdwn->have_posts()): $s_drpdwn->the_post();?>
- <div class="prd-sec">
- <?php $tet= get_post_meta( get_the_ID(), 'wpcf-game-instructions', true );
- if($tet == '')
- {
- ?>
- <a href="#" class="product-thump-img"><?php the_post_thumbnail('blog-small');?></a>
- <?php
- echo "<b>".the_title()."</b> : No Instruction PDF Found";
- }
- else
- {
- ?>
- <a href="<?php echo get_post_meta( get_the_ID(), 'wpcf-game-instructions', true ) ?>" class="product-thump-img"><?php the_post_thumbnail('blog-small');?></a>
- <a href="<?php echo get_post_meta( get_the_ID(), 'wpcf-game-instructions', true ) ?>"><?php the_title();?> Instructions</a>
- <?php
- }
- ?>
- </div>
- <?php endwhile;
- else:
- ?>
- <p style="color:red">No Instructions Found</p>
- <?php
- endif;
- ?>
- <?php } ?>
- <!--</form>-->
- <!-- Product Search-->
- <?php
- if(is_front_page()) {
- $paged = (get_query_var('page')) ? get_query_var('page') : 1;
- } else {
- $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
- }
- if(isset($_POST['submit']))
- {
- //global $wpdb;
- $keywd=$_POST['user'];
- if(is_numeric($keywd))
- {
- /*$str="select p.* from $wpdb->posts p,$wpdb->postmeta pm where p.ID = pm.post_id and
- //p.ID IN (SELECT post_id FROM wp_postmeta WHERE meta_key = 'Item' AND meta_value = $keywd)";*/
- $str="select m.post_id from $wpdb->postmeta m where (m.meta_key='wpcf-item' and m.meta_value LIKE $keywd) OR (m.meta_key='wpcf-ean-upc-number' and m.meta_value LIKE $keywd) OR (m.meta_key='EAN-UPC Number' and m.meta_value LIKE $keywd)";
- $result = $wpdb->get_results($str,OBJECT);
- //echo $str;
- //print_r($result);
- foreach($result as $post)
- {
- $postid = $post->post_id;
- $ret=get_post_meta( $postid, 'wpcf-game-instructions', true );
- if($ret == '')
- {
- ?>
- <a href="#" class="product-thump-img"><?php echo get_the_post_thumbnail($postid, 'blog-small');?></a>
- <?php
- echo "<b>".get_the_title($postid)."</b> : No Instruction PDF Found";
- }
- else
- {
- ?>
- <a href="<?php echo get_post_meta( $postid, 'wpcf-game-instructions', true ) ?>" class="product-thump-img"><?php echo get_the_post_thumbnail($postid, 'blog-small');?></a>
- <a href="<?php echo get_post_meta( $postid, 'wpcf-game-instructions', true ) ?>"><?php echo get_the_title($postid);?> Instructions</a>
- <?php
- }
- }
- }
- else
- {
- $args = array(
- 'post_type' => 'product',
- 'paged' => $paged,
- 's'=>$keywd,
- 'tax_query' => array(
- array(
- 'taxonomy' => 'product_cat',
- 'field' => 'slug',
- 'terms' => 'products'
- )
- )
- );
- $gallery = new WP_Query($args);
- //print_r($gallery);
- ?>
- <?php wp_reset_postdata();?>
- <?php
- if($gallery->have_posts()) :
- while($gallery->have_posts()): $gallery->the_post();?>
- <div class="prd-sec">
- <?php $ret=get_post_meta( get_the_ID(), 'wpcf-game-instructions', true );
- if($ret == '')
- {
- ?>
- <a href="#" class="product-thump-img"><?php the_post_thumbnail('blog-small');?></a>
- <?php
- echo "<b>".the_title()."</b> : No Instruction PDF Found";
- }
- else
- {
- ?>
- <a href="<?php echo get_post_meta( get_the_ID(), 'wpcf-game-instructions', true ) ?>" class="product-thump-img"><?php the_post_thumbnail('blog-small');?></a>
- <a href="<?php echo get_post_meta( get_the_ID(), 'wpcf-game-instructions', true ) ?>"><?php the_title();?> Instructions</a>
- <?php
- }
- ?>
- </div>
- <?php endwhile;
- else:
- ?>
- <p style="color:red">No Search Found</p>
- <?php
- endif;
- }
- ?>
- <?php
- }
- ?>
- </div>
- <div class="serviceright"><?php get_sidebar('servicesright'); ?>
- </div>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement