single-product.php 12.7 KB
<?php get_header();?>
<?php $get_lang = isset($wp_query->query_vars['prisna_translate_seo_request'])?urldecode($wp_query->query_vars['prisna_translate_seo_request']):''; ?>    	
 
		<nav class="path-bar">
              <ul class="path-nav">
             <li><?php if(function_exists('cmp_breadcrumbs')) cmp_breadcrumbs();?></li>
              </ul>
        </nav>
        <section class="photos-gallery"><b class="close-gallery"></b></section>
        <div class="gallery-body-mask"></div>
        <div id="loading"></div> 
            <section class="index-layout">
            <section class="layout">
    			 <!-- aside begin -->
<?php get_sidebar();?>
           <!--// aisde end -->
           
           <!-- main begin -->
           <section class="main" >
           	<section class="detail-wrap">
      
              <!-- product info -->
              <section class="product-intro">
              	 <h1 class="product-title"><?php wp_title(); ?></h1>
                 <div class="product-view">
				 
                    <div class="product-img jqzoom">
<!-- Piliang S-->
<?php $images = get_field('product_gallery');
if( $images ):  foreach( $images as $key=>$image ):   
			if(!is_array($images[$key])){
				$eric_id = $image;
				$eric_urcs = wp_get_attachment_image_src($eric_id, $size='full');
				$eric_urc = $eric_urcs[0];
				$image = array(
					'id' => $eric_id, 
					'url' => $eric_urc, 
					'sizes' => array('thumbnail' => $eric_urc, )
					);
				$images[$key] = $image;
			}
if (!$image['sizes']['thumbnail']) $image['sizes']['thumbnail'] = $srcs[0];  endforeach; endif; ?>
<!-- Piliang E-->
<?php if( $images ): for($x=0;$x<1; $x++){ ?>
<img id="bigImg" style="cursor:pointer" src="<?php echo $images[0]['url']; ?>" jqimg="<?php echo $images[0]['url']; ?>" alt="<?php wp_title(); ?>" />
<?php } endif; ?>
                    </div>
					
                     <!-- small img -->
                     <div class="small-img-wrap am-small-img-wrap">
                        <a href="javascript:" class="small-btn-prev"><b></b></a>
                        <div class="small-img-scroll am-small-img-scroll">
                <ul>
<?php  if( $images ): foreach( $images as $image ): ?>
                <li><a class="small-img-item" href="javascript:" target="_self"><img src="<?php echo $image['sizes']['thumbnail']; ?>" src_big="<?php echo $image['url']; ?>" src_mid="<?php echo $image['url']; ?>"></a></li>
<?php endforeach; endif; ?>
                </ul> 
                        </div>
                        <a href="javascript:" class="small-btn-next"><b></b></a>
                     </div>
                     <!--// small img end -->             
                   
              </div>
                 <section class="product-summary">
<h3>Short Description:</h3>
<p><?php the_field('short_description'); ?></p>
<br />
<?php if( get_field('是否调用通用属性') ){ ?>
<?php query_posts(array( 'post_type' => 'pro_shuxing','showposts' => 1,'orderby' => 'post_date','order'=> 'DESC') );  while (have_posts()) : the_post();?>
<?php if( have_rows('产品通用属性') ): ?>
	<?php while( have_rows('产品通用属性') ): the_row(); ?>
		 <li><em><?php echo get_sub_field('标题'); ?>: </em> <?php echo get_sub_field('内容'); ?></li>
	<?php endwhile; ?>
<?php endif; ?>
<?php endwhile; wp_reset_query(); ?>
<?php } ?>
<?php if( have_rows('当前产品属性') ): ?>
	<?php while( have_rows('当前产品属性') ): the_row(); ?>
		 <li><em><?php echo get_sub_field('标题'); ?>: </em> <?php echo get_sub_field('内容'); ?></li>
	<?php endwhile; ?>
<?php endif; ?>
<div class="product-btn-wrap"><a href="javascript:" onclick="showMsgPop();" class="email">Send email to us</a><a href="<?php echo home_url("/"); ?>wp-content/plugins/down-as-pdf/generate.php?id=<?php the_ID(); ?>" target="_blank" rel="external nofollow" class="pdf">Download as PDF</a></div>
<div class="share-this"><div class="addthis_sharing_toolbox"></div></div></section>
              </section>
<div class="mobile-detail-items"><div class="mobile-detail-item"></div><div class="mobile-detail-item"></div><div class="mobile-detail-item"></div><div class="mobile-detail-item"></div><div class="mobile-detail-item"></div></div> 
              <section class="product-detail">
                 <div class="detail-tabs">
                    <h2 class="tab current">Product Detail</h2>
<?php query_posts(array( 'post_type' => 'pro_detail','showposts' => 1,'orderby' => 'post_date','order'=> 'DESC') );  while (have_posts()) : the_post();?>
<?php if( have_rows('pro_detail') ): ?>
	<?php while( have_rows('pro_detail') ): the_row(); ?>
		<h2 class="tab"><?php echo get_sub_field('title'); ?></h2>
	<?php endwhile; ?>
<?php endif; ?>
<?php endwhile; wp_reset_query(); ?>
                    <h2 class="tab">Product Tags</h2>
<?php if( in_category('623') ) : ?>
                    <h2 class="tab">Related Video</h2>
                    <h2 class="tab">Feedback (2)</h2>
<?php endif; ?>
					</div>
                                  <section class="entry detail-panel">
				 
<?php if( in_category('623') ) : ?>			 
<?php echo do_shortcode( '[rand_pre]' ); ?> <?php echo do_shortcode( '[rand_keywords]' ); ?>, <?php echo do_shortcode( '[rand_keywords]' ); ?>, <?php echo do_shortcode( '[rand_keywords]' ); ?>, <?php echo do_shortcode( '[rand_suffix]' ); ?>
<hr>
<?php wp_title(); ?> Detail: <br/><br/>
<?php endif; ?>				
<?php while ( have_posts() ) : the_post(); ?>
<?php the_content(); ?> 
<?php endwhile; ?>
<div class="clear"></div>
<?php if( in_category('623') ) : ?>		
<hr>	 
Product detail pictures:<br/><br/>
<?php 
if( $images ): ?>
        <?php foreach( $images as $image ): ?>
		<center><a class="lightbox" href="<?php echo $image['url']; ?>"><img src="<?php echo $image['url']; ?>" alt="<?php wp_title(); ?> detail pictures"></a></center><br />
        <?php endforeach; ?>
<?php endif; ?>
<hr>
Related Product Guide:<br/>
<?php query_posts(array( 'post_type' => 'guide','showposts' => 2,'orderby' => 'rand') ); while (have_posts()) : the_post();?>
<a href="<?php the_permalink() ?>"><?php echo mb_strimwidth(strip_tags(apply_filters('the_title',$post->post_title)), 0, 500,"..."); ?></a><br/>
<?php endwhile; wp_reset_query();?>
<hr>
<?php echo do_shortcode( '[rand_pre]' ); ?> <?php wp_title(); ?>, The product will supply to all over the world, such as: <?php echo do_shortcode( '[rand_country]' ); ?>, <?php echo do_shortcode( '[rand_country]' ); ?>, <?php echo do_shortcode( '[rand_country]' ); ?>, <?php echo do_shortcode( '[rand_l_suffix]' ); ?>
<?php endif; ?>	
<?php if( get_field('yes_products_img') ){ ?>
<hr>
<?php 
if( $images ): ?>
        <?php foreach( $images as $image ): ?>
		<center><a class="lightbox" href="<?php echo $image['url']; ?>"><img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>"></a></center><br />
        <?php endforeach; ?>
<?php endif; ?>
<?php } ?>
<?php if( in_category('623') ) { ?>	<?php } else { ?>
<hr>
<li><b>Previous:</b> <?php previous_post_link("%link") ?></li>
<li><b>Next:</b> <?php next_post_link("%link") ?></li>
<hr><?php } ?>	
                 </section>
				 
				 
<?php query_posts(array( 'post_type' => 'pro_detail','showposts' => 1,'orderby' => 'post_date','order'=> 'DESC') );  while (have_posts()) : the_post();?>
<?php if( have_rows('pro_detail') ): ?>
	<?php while( have_rows('pro_detail') ): the_row(); ?>
				 <section class="entry detail-panel disabled"><?php echo get_sub_field('text'); ?></section>
	<?php endwhile; ?>
<?php endif; ?>
<?php endwhile; wp_reset_query(); ?>
				 <section class="entry detail-panel disabled"><?php the_tags(); ?></section>
<?php if( in_category('623') ) : ?>
				 <section class="entry detail-panel disabled">
				 <?php query_posts(array( 'post_type' => 'vs','showposts' => 2,'orderby' => 'rand') ); while (have_posts()) : the_post();?>
				 <?php echo apply_filters('the_content', $post->post_content); ?>
                 <?php endwhile; wp_reset_query();?> 
				 </section>
				 <section class="entry detail-panel disabled">
				 <?php echo do_shortcode( '[rand_feedback]' ); ?>
				 <br /><img src="<?php echo home_url("/"); ?>admin/img/star-icon.png" alt="5 Stars"> <span style="color:#cccccc">By <?php echo do_shortcode( '[rand_feedback_name]' ); ?> from <?php echo do_shortcode( '[rand_country]' ); ?> - <?php echo do_shortcode( '[rand_feedback_time]' ); ?></span>
				 <hr>
				 <?php echo do_shortcode( '[rand_feedback]' ); ?>
				 <br /><img src="<?php echo home_url("/"); ?>admin/img/star-icon.png" alt="5 Stars"> <span style="color:#cccccc">By <?php echo do_shortcode( '[rand_feedback_name]' ); ?> from <?php echo do_shortcode( '[rand_country]' ); ?> - <?php echo do_shortcode( '[rand_feedback_time]' ); ?></span>
				 <hr>
				 </section>
<?php endif; ?>
             
</section>
<section id="send-email" class="inquiry-form-wrap ct-inquiry-form"><script type="text/javascript" src="//www.globalso.site/form.js"></script></section>
<section class="goods-may-like">
 
                 <div class="goods-tbar">
                    <h2 class="title">Related Products</h2>
                 </div>
                 <section class="goods-items-wrap">
                 	<section class="goods-items">
<?php $post_objects = get_field('related_products'); if( $post_objects ): ?>
    <?php foreach( $post_objects as $post): ?>
        <?php setup_postdata($post);
$images = get_field('product_gallery');
if( $images ):  foreach( $images as $key=>$image ): 
			if(!is_array($images[$key])){
				$eric_id = $image;
				$eric_urcs = wp_get_attachment_image_src($eric_id, $size='full');
				$eric_urc = $eric_urcs[0];
				$image = array(
					'id' => $eric_id, 
					'url' => $eric_urc, 
					'sizes' => array('thumbnail' => $eric_urc, )
					);
				$images[$key] = $image;
			}
			if (!$image['sizes']['thumbnail']) $image['sizes']['thumbnail'] = $srcs[0];
endforeach;  endif;?>
		
	                      <div class="product-item">
	                        <div class="item-wrap">
          	                   <div class="pd-img">
							        <a href="<?php the_permalink() ?>"><img src="<?php  if( $images ): for($x=0;$x<1; $x++){ ?><?php echo $images[0]['sizes']['thumbnail']; ?><?php } endif; ?>" alt="<?php echo mb_strimwidth(strip_tags(apply_filters('the_title',$post->post_title)), 0, 200,"..."); ?>"></a><a class="pd-shadow" href="<?php the_permalink() ?>"><div class="icon-more"></div></a>
                               </div>
                               <div class="pd-info">
            	                    <h3 class="pd-name"><a href="<?php the_permalink() ?>"><?php echo mb_strimwidth(strip_tags(apply_filters('the_title',$post->post_title)), 0, 50,"..."); ?></a></h3>
                               </div>
                            </div>
						 </div>  
			   
        <?php endforeach; ?>
    <?php wp_reset_postdata(); ?>
	
	
	<?php else: ?>
	
	
<?php
global $post;
$cats = wp_get_post_categories($post->ID);
if ($cats) {
    $args = array(
          'category__in' => array( $cats[0] ),
          'post__not_in' => array( $post->ID ),
          'orderby' => 'rand', 
          'showposts' => 6,
          'caller_get_posts' => 1
      );
  query_posts($args);
  if (have_posts()) {
    while (have_posts()) {
      the_post(); update_post_caches($posts); 			
$images = get_field('product_gallery');
if( $images ):  foreach( $images as $key=>$image ): 
			if(!is_array($images[$key])){
				$eric_id = $image;
				$eric_urcs = wp_get_attachment_image_src($eric_id, $size='full');
				$eric_urc = $eric_urcs[0];
				$image = array(
					'id' => $eric_id, 
					'url' => $eric_urc, 
					'sizes' => array('thumbnail' => $eric_urc, )
					);
				$images[$key] = $image;
			}
			if (!$image['sizes']['thumbnail']) $image['sizes']['thumbnail'] = $srcs[0];
endforeach;  endif;?>	
		
	                      <div class="product-item">
	                        <div class="item-wrap">
          	                   <div class="pd-img">
							        <a href="<?php the_permalink() ?>"><img src="<?php  if( $images ): for($x=0;$x<1; $x++){ ?><?php echo $images[0]['sizes']['thumbnail']; ?><?php } endif; ?>" alt="<?php echo mb_strimwidth(strip_tags(apply_filters('the_title',$post->post_title)), 0, 200,"..."); ?>"></a><a class="pd-shadow" href="<?php the_permalink() ?>"><div class="icon-more"></div></a>
                               </div>
                               <div class="pd-info">
            	                    <h3 class="pd-name"><a href="<?php the_permalink() ?>"><?php echo mb_strimwidth(strip_tags(apply_filters('the_title',$post->post_title)), 0, 50,"..."); ?></a></h3>
                               </div>
                            </div>
						 </div>  
<?php } } wp_reset_query(); } ?>
<?php endif;?>		
       </section>
         </section>   
              </section>   
           </section>  
           </section>
           <!--// main end -->
           <div class="clear"></div>
           </section>
           </section>
<?php get_footer();?>