RtThemesSupport

rttheme 9 product_detail.php

Jun 2nd, 2014
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 11.75 KB | None | 0 0
  1. <?php
  2.  
  3. //product fileds
  4. $product_temp="true";
  5. get_header();
  6. $this_is_product=true;
  7. if (get_option('rttheme_style')){
  8.     $which_theme=get_option('rttheme_style');
  9. }else{
  10.     $which_theme="1";      
  11. }
  12. ?>
  13.  
  14. <?php
  15.     //call sub page header
  16.     get_template_part( 'sub_page_header', 'sub_page_header_file' );
  17. ?> 
  18.  
  19.  
  20. <div class="content_con2">
  21.  
  22. <!-- left side content -->
  23. <div class="content sub product_left_side">
  24.  
  25.             <?php if (have_posts()): the_post();$current_post=$post->ID;?>
  26.                         <!-- product spot information  -->
  27.             <h3><?php the_title(); ?></h3>
  28.            
  29.             <!-- text-->
  30.             <p><?php echo get_post_meta($post->ID, 'rt_long_description', true)?></p>
  31.            
  32.             <!-- info -->
  33.             <ul class="nobullet">
  34.                <?php if(get_post_meta($post->ID, 'rt_product_price', true)):?> <li><strong><?php _e( 'Price:', 'rt_theme' );?></strong><?php echo get_post_meta($post->ID, 'rt_product_price', true);?></li><?php endif;?>
  35.                <?php if(get_post_meta($post->ID, 'rt_product_stock_code', true)):?> <li><strong><?php _e( 'Stock Code:', 'rt_theme' );?></strong> <?php echo get_post_meta($post->ID, 'rt_product_stock_code', true);?></li><?php endif;?>
  36.                <?php if(get_post_meta($post->ID, 'rt_product_shipping', true)):?> <li><strong><?php _e( 'Shipping Time:', 'rt_theme' );?></strong> <?php echo get_post_meta($post->ID, 'rt_product_shipping', true);?></li><?php endif;?>
  37.             </ul>
  38.            
  39.                        <!-- / product spot information  -->
  40.                
  41.  
  42.             <!-- product tabs-->
  43.                 <div id="tabs">
  44.                     <!-- tabs-->
  45.                     <ul class="tabnav">                    
  46.                         <?php if (!empty($post->post_content)):?>
  47.                             <li class="active" title="details"><a href="#details"><span><?php _e( 'Product Details', 'rt_theme' );?></span></a></li>
  48.                         <?php endif;?>
  49.  
  50.                         <?php if (trim(get_post_meta($post->ID, 'rt_other_images', true))):?>
  51.                             <li title="photos"><a href="#photos"><span><?php _e( 'Product Photos', 'rt_theme' );?></span></a></li>
  52.                         <?php endif;?>
  53.  
  54.                         <?php if (trim(get_post_meta($post->ID, 'rt_technical_details', true))):?>
  55.                             <li title="technical_details"><a href="#technical_details"><span><?php _e( 'Technical Details', 'rt_theme' );?></span></a></li>
  56.                         <?php endif;?>
  57.  
  58.                         <?php if (trim(get_post_meta($post->ID, 'rt_related_products', true))):?>
  59.                             <li title="technical_details"><a href="#related_products"><span><?php _e( 'Related Products', 'rt_theme' );?></span></a></li>
  60.                         <?php endif;?>
  61.                        
  62.                     </ul>
  63.                     <!-- tabs-->
  64.                     <div class="clear"></div>
  65.                    
  66.                     <!-- tab content-->
  67.                         <div class="box full">
  68.                              <img src="<?php echo get_template_directory_uri(); ?>/images/<?php echo $which_theme;?>/full_box_top.jpg" alt="" class="box_curv" />
  69.                            
  70.  
  71.                             <!-- tab content-->
  72.                             <div id="content">
  73.                                
  74.                                 <?php if (!empty($post->post_content)):?>
  75.                                 <!-- details-->
  76.                                 <div id="details" class="tabdiv ui-tabs-hide">
  77.                                     <?php the_content(); ?>
  78.                                 </div>
  79.                                 <!-- / details-->
  80.                                 <?php endif;?>
  81.                                
  82.                                 <?php if (trim(get_post_meta($post->ID, 'rt_other_images', true))):?>
  83.                                 <!-- photos -->
  84.                                 <div id="photos" class="tabdiv">   
  85.                                 <?php
  86.                                     //Other Product Photos
  87.                                     if (trim(get_post_meta($post->ID, 'rt_other_images', true))){
  88.                                     $product_photos=explode("\n",  get_post_meta($post->ID, 'rt_other_images', true));
  89.                                         foreach ($product_photos as $k => $photo_url) {
  90.                                             if (trim($photo_url)): 
  91.                                                 // Resize Image
  92.                                                 $imgURL = find_image_org_path(trim($photo_url));
  93.                                                 $crop   = true;
  94.                                                 $image_thumb = @vt_resize( '', $imgURL, 185, 0, ''.$crop.'' );
  95.                                                 $imageid = rt_get_attachment_id_from_src($imgURL);
  96.                                                 $alt="";
  97.                                                 $alt = get_post_meta($imageid, '_wp_attachment_image_alt', true);
  98.                                                 $attachment = get_post( $imageid );
  99.                                                 $caption = $attachment->post_excerpt;
  100.                                                 if ($caption=="" || empty($caption)) {
  101.                                                    $caption=get_the_title($post->ID);
  102.                                                   }
  103.                                                 ?>                                         
  104.                                             <a href="<?php echo $photo_url; ?>" title="<?php echo $alt; ?>" rel="prettyPhoto[gallery1]"><img src="<?php echo $image_thumb["url"];?>" alt="<?php echo $caption ?>" class="image product_image" /></a>
  105.                                 <?php endif;}}?>                                   
  106.                                 </div>
  107.                                 <!-- / photos -->
  108.                                 <?php endif;?>
  109.                                
  110.                                 <?php if (trim(get_post_meta($post->ID, 'rt_technical_details', true))):?>
  111.                                 <!-- technical details -->
  112.                                     <div id="technical_details">
  113.                                         <?php if (trim(get_post_meta($post->ID, 'rt_technical_details', true))):?>
  114.                                             <?php echo get_post_meta($post->ID, 'rt_technical_details', true);?>
  115.                                         <?php endif;?>
  116.                                     </div>
  117.                                 <!-- / technical details -->
  118.                                 <?php endif;?>
  119.  
  120.                                 <?php if (trim(get_post_meta($post->ID, 'rt_related_products', true))):?>
  121.                                 <!-- Related Products -->
  122.                                     <div id="related_products">
  123.                                     <?php
  124.                                     if (trim(get_post_meta($post->ID, 'rt_related_products', true))){
  125.                                     $product_ids=explode("\n",  get_post_meta($post->ID, 'rt_related_products', true));
  126.                                     $p_id_list = "";
  127.                                     foreach ($product_ids as $k => $product_id) {
  128.                                         if (trim($product_id)):
  129.                                         ?>
  130.                                     <?php $p_id_list.=$product_id.","; ?>
  131.                                     <?php endif;}}
  132.                                    
  133.                                     related_products($p_id_list);
  134.                                    
  135.                                     ?>
  136.                                     <div class="clear"></div>
  137.                                     </div>
  138.                                 <!-- / Related Products -->                            
  139.                                 <?php endif;?>
  140.                                
  141.                             </div>
  142.                              <img src="<?php echo get_template_directory_uri(); ?>/images/<?php echo $which_theme;?>/full_box_bottom.jpg" alt=""  class="box_curv" />
  143.                         </div>
  144.                     <!-- /tab content-->
  145.                 </div>
  146.             <!-- /product tabs-->              
  147.     <?php else: ?>
  148.         <p><?php _e( 'Sorry, no page found.', 'rt_theme' );?></p>
  149.     <?php endif; ?>
  150. </div>
  151. <!-- / product content left side -->
  152.  
  153.  
  154.        
  155. <!-- product content right side -->  
  156.        
  157.        
  158. <div class="product_right_side">
  159.    
  160.     <?php if(get_post_meta($post->ID, 'rt_product_image_url', true)):?>
  161.     <!-- box -->
  162.     <div class="box big_box">
  163.         <img src="<?php echo get_template_directory_uri(); ?>/images/<?php echo $which_theme;?>/big_box_top.jpg" alt="" class="p_image_top" />
  164.         <!-- portfolio image for images -->
  165.         <div class="imgarea magnifier">
  166.            
  167.            
  168.             <?php if(get_post_meta($post->ID, 'rt_product_image_url', true)):
  169.            
  170.                 // Resize Image
  171.                 $imgURL = find_image_org_path(trim(get_post_meta($post->ID, 'rt_product_image_url', true)));
  172.                 $crop   = true;
  173.                 $image_thumb = @vt_resize( '', $imgURL, 280, 0, ''.$crop.'' );                       
  174.                 $imageurl=get_post_meta($post->ID, 'rt_product_image_url', true);
  175.                 $imageid = rt_get_attachment_id_from_src(get_post_meta($post->ID, 'rt_product_image_url', true));
  176.                 $alt = get_post_meta($imageid, '_wp_attachment_image_alt', true);  
  177.             ?>
  178.             <a href="<?php echo get_post_meta($post->ID, 'rt_product_image_url', true); ?>" title="<?php echo $alt; ?>" alt="<?php the_title(); ?>" rel="prettyPhoto[gallery1]"><img src="<?php echo $image_thumb["url"];?>" alt="<?php the_title();?>" title="<?php the_title(); ?>" class="image portfolio" /></a>
  179.             <?php endif;?> 
  180.            
  181.         </div>
  182.         <img src="<?php echo get_template_directory_uri(); ?>/images/<?php echo $which_theme;?>/big_box_bottom.jpg" alt="" class="p_image_bottom" />
  183.     </div>
  184.     <!-- /box -->
  185.     <?php endif;?> 
  186.    
  187.     <?php if(get_post_meta($post->ID, 'rt_chart_file_url', true) || get_post_meta($post->ID, 'rt_excel_file_url', true) || get_post_meta($post->ID, 'rt_pdf_file_url', true) || get_post_meta($post->ID, 'rt_word_file_url', true) ):?>
  188.     <!-- box -->
  189.     <div class="box big_box">
  190.         <img src="<?php echo get_template_directory_uri(); ?>/images/<?php echo $which_theme;?>/big_box_top.jpg" alt="" class="p_image_top" />
  191.         <!-- document icons -->
  192.         <ul class="doc_icons">
  193.             <?php if(get_post_meta($post->ID, 'rt_chart_file_url', true)):?><li><a href="<?php echo get_post_meta($post->ID, 'rt_chart_file_url', true); ?>"><img src="<?php echo get_template_directory_uri(); ?>/images/icons/Chart_1.png" alt="<?php _e( 'Download Charts', 'rt_theme' );?>" class="png" /></a></li><?php endif;?>
  194.             <?php if(get_post_meta($post->ID, 'rt_excel_file_url', true)):?><li><a href="<?php echo get_post_meta($post->ID, 'rt_excel_file_url', true); ?>"><img src="<?php echo get_template_directory_uri(); ?>/images/icons/File_Excel.png" alt="<?php _e( 'Download Excel File', 'rt_theme' );?>" class="png" /></a></li><?php endif;?>
  195.             <?php if(get_post_meta($post->ID, 'rt_pdf_file_url', true)):?><li><a href="<?php echo get_post_meta($post->ID, 'rt_pdf_file_url', true); ?>"><img src="<?php echo get_template_directory_uri(); ?>/images/icons/File_Pdf.png" alt="<?php _e( 'Download PDF File', 'rt_theme' );?>" class="png" /></a></li><?php endif;?>
  196.             <?php if(get_post_meta($post->ID, 'rt_word_file_url', true)):?><li><a href="<?php echo get_post_meta($post->ID, 'rt_word_file_url', true); ?>"><img src="<?php echo get_template_directory_uri(); ?>/images/icons/Word.png" alt="<?php _e( 'Download Word File', 'rt_theme' );?>" class="png" /></a></li><?php endif;?>                
  197.         </ul>
  198.         <div class="clear"></div>  
  199.         <img src="<?php echo get_template_directory_uri(); ?>/images/<?php echo $which_theme;?>/big_box_bottom.jpg" alt="" class="p_image_bottom" />
  200.     </div>
  201.     <!-- /box -->
  202.     <?php endif;?> 
  203.  
  204.     <!-- sidebar navigation for product details -->
  205.    
  206.         <?php
  207.         //sidebar navigation for product details
  208.         if (get_option('rttheme_pdetail_side_pages[]'))
  209.             $footer_pages = get_pages(array('sort_column'=>'menu_order', 'include' =>get_option('rttheme_pdetail_side_pages[]') ,'child_of' => 0));
  210.             if ( isset( $footer_pages ) ):
  211.         ?>
  212.             <div class="box small">
  213.             <!-- sub link-->
  214.             <ul id="sub_menu">               
  215.             <?php $my_i="1";foreach ($footer_pages as $footer_page_list) { ?>
  216.                 <li><a  href="<?php echo get_permalink($footer_page_list->ID);?>" title="<?php echo $footer_page_list ->post_title?>"><?php echo ucwords(strtolower($footer_page_list ->post_title)) ?></a></li>
  217.             <?php $my_i++;}?>
  218.             </ul>          
  219.             <!-- /sub link-->
  220.             </div>                   
  221.             <?php endif;?>                                 
  222.  
  223.     <!-- / sidebar navigation for product details -->
  224.  
  225.    
  226.         <?php
  227.             if (function_exists('dynamic_sidebar') && dynamic_sidebar('Sidebar For Product Detail Page'));
  228.             rt_ud_sidebars('post',$current_post);
  229.         ?>
  230.        
  231. </div>
  232.  
  233. <div class="clear"></div>
  234. <!-- / product content right side -->          
  235.            
  236.    
  237.  
  238. </div>
  239. <!-- product content end -->
  240. <?php get_footer();
  241.  
  242.  
  243.  
  244.  
  245. // Related Products
  246. function related_products($p_id_list){
  247. $postslist = get_posts('numberposts=10&order=ASC&orderby=title&include='.$p_id_list.'');
  248. foreach ($postslist as $post) :
  249. setup_postdata($post);
  250. ?>
  251. <!-- box -->
  252.         <div class="box product">
  253.         <!-- product image -->
  254.         <?php if(get_post_meta($post->ID, 'rt_product_image_url', true)):?>
  255.              <a href="<?php echo get_permalink($post->ID);?>" title="<?php echo $post->post_title;?>">
  256.                 <?php
  257.                 // Resize Image
  258.                 $imgURL = find_image_org_path(trim(get_post_meta($post->ID, 'rt_product_image_url', true)));
  259.                 $crop   = true;
  260.                 $image_thumb = @vt_resize( '', $imgURL, 160, 0, ''.$crop.'' );                       
  261.                 ?>
  262.                                            
  263.                  <img src="<?php echo $image_thumb["url"];?>" class="image product_image preload" />
  264.             </a>
  265.         <?php endif;?>
  266.         <!-- / product image -->
  267.  
  268.         <div class="textarea">
  269.             <!-- box title-->
  270.             <h5> <a href="<?php echo get_permalink($post->ID);?>" title="><?php echo $post->post_title;?>"><?php echo $post->post_title;?></a></h5>
  271.             <!-- text-->
  272.         <?php echo get_post_meta($post->ID, 'rt_short_description', true);?>
  273.         <?php if(get_post_meta($post->ID, 'rt_product_price', true)):?>
  274.         <br />
  275.         <span class="price"><?php echo get_post_meta($post->ID, 'rt_product_price', true);?></span>
  276.         <?php endif;?>
  277.         </div>
  278.         </div>
  279. <!-- /box -->
  280. <?php endforeach; ?>
  281. <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment