patrickt

related.php

Nov 11th, 2013
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.46 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Related Products
  4.  *
  5.  * @author    WooThemes
  6.  * @package   WooCommerce/Templates
  7.  * @version     1.6.4
  8.  */
  9.  
  10. global $product, $woocommerce_loop, $data, $post, $wp_query;
  11. $permlink = get_permalink($post->ID);
  12.  
  13. if (($term_id = get_brands_term_by_product_id($product->id)) > 0):
  14.   ?>
  15.   <!-- Starts at line 13 -->
  16.   <div class="right-sm-manufacturer-logo visible-desktop">
  17.     <div class="product-manufacturer-logo-block">
  18.       <?php
  19.       $attach_id = wcm_sds_brands_thumbnail_id($term_id);
  20.       $image = wp_get_attachment_url($attach_id);
  21.       $term = get_term($term_id,'brands');
  22.       ?>
  23.       <a href="<?php echo get_term_link($term_id,'brands');?>"><img title="<?php echo $term->name?>" src="<?php echo $image?>"></a>
  24.     </div><!-- End product-manufacturer-logo-block -->
  25.   </div><!-- End right-sm-manufacturer-logo -->
  26.  
  27.   <?php
  28. endif;
  29.  
  30.  
  31. if ($data['sellya_cblcok_status'] != '0'):
  32.   ?>
  33.   <!-- Starts at line 31 -->
  34.   <div class="right-sm-custom-tab visible-desktop">
  35.     <div class="right-sm-custom-tab-content">
  36.       <?php echo $data['sellya_custom_block'];?>
  37.     </div><!-- End right-sm-custom-tab-content -->
  38.   </div><!-- End right-sm-custom-tab -->
  39.   <?php
  40. endif;
  41.  
  42.  
  43. $related = $product->get_related();
  44.  
  45. if ( sizeof($related) == 0 || $data['sellya_related_pro'] == 0):
  46.   if ($data['sellya_product_share']):
  47.     ?>
  48.     <!-- Starts at line 46 -->
  49.     <div class="right-sm-share hidden-phone">
  50.       <div class="product-share">
  51.         <div class="share">
  52.           <!-- AddThis Button BEGIN -->
  53.           <div class="addthis_toolbox addthis_default_style ">
  54.             <a href="<?php echo $permlink?>" class="addthis_button_preferred_1"></a>
  55.             <a href="<?php echo $permlink?>" class="addthis_button_preferred_2"></a>
  56.             <a href="<?php echo $permlink?>" class="addthis_button_preferred_3"></a>
  57.             <a href="<?php echo $permlink?>" class="addthis_button_preferred_4"></a>
  58.             <a href="<?php echo $permlink?>" class="addthis_button_preferred_5"></a>
  59.             <a href="<?php echo $permlink?>" class="addthis_button_preferred_6"></a><br />
  60.  
  61.             <div>
  62.               <a href="<?php echo $permlink?>" class="addthis_counter addthis_pill_style"></a>
  63.             </div>
  64.           </div>
  65.           <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js"></script>
  66.           <!-- AddThis Button END -->
  67.         </div><!-- End share -->    
  68.       </div><!-- End product-share -->
  69.     </div><!-- End right-sm-share -->
  70.     <?php
  71.   endif;
  72.  
  73. else:
  74.   if ($data['sellya_related_product_pos'] == 'right'):
  75.     $args = apply_filters('woocommerce_related_products_args', array(
  76.       'post_type'       => 'product',
  77.       'ignore_sticky_posts' => 1,
  78.       'no_found_rows'     => 1,
  79.       'posts_per_page'    => $posts_per_page,
  80.       'orderby'         => $orderby,
  81.       'post__in'        => $related,
  82.       'post__not_in'      => array($product->id)
  83.     ));
  84.    
  85.     $products = new WP_Query( $args );
  86.     $woocommerce_loop['columns']  = $columns;
  87.    
  88.     if ( $products->have_posts() ):
  89.       ?>
  90.       <!-- Starts at line 88 -->
  91.       <div class="right-sm-related visible-desktop">
  92.         <div class="product-related">
  93.      
  94.           <h5><?php _e('Related Products', 'woocommerce'); ?></h5>
  95.           <script type="text/javascript">
  96.           (function($){
  97.             $(function(){
  98.               $('#slider1').bxSlider();
  99.             });
  100.           }(jQuery))
  101.           </script>
  102.  
  103.           <!-- Begin UL Slider1 -->
  104.           <ul id="slider1" >
  105.             <?php
  106.             while ( $products->have_posts() ) :
  107.               $products->the_post();
  108.               ?>
  109.               <!-- Begin LI -->
  110.               <li>
  111.                 <?php do_action( 'woocommerce_before_shop_loop_item' ); ?>
  112.              
  113.                 <div class="image">
  114.                   <a href="<?php the_permalink(); ?>">
  115.                     <?php
  116.                     /**
  117.                      * woocommerce_before_shop_loop_item_title hook
  118.                      *
  119.                      * @hooked woocommerce_show_product_loop_sale_flash - 10
  120.                      * @hooked woocommerce_template_loop_product_thumbnail - 10
  121.                      */
  122.                     do_action( 'woocommerce_before_shop_loop_item_title' );
  123.                     ?>
  124.                   </a>
  125.                 </div><!-- End image -->
  126.                
  127.                 <?php
  128.                 global $post;
  129.                 echo "<!-- About to check post_excerpt -->";
  130.                
  131.                 /**
  132.                  * This is where I replaced the return statement with an inverse if statement that wraps the HTML you
  133.                  * want to conditionally output.
  134.                  *
  135.                  * @author: Patrick Thurmond
  136.                  */
  137.                 if ( $post->post_excerpt ):
  138.                   echo "<!-- Inside the post_excerpt -->";
  139.                   #return; //<-- This is bad, this is really bad. It breaks the HTML of the entire page when this happens because HTML closing tags don't get output to the browser.
  140.                  ?>
  141.                   <div class="description-r hidden-phone hidden-tablet">
  142.                     <?php //echo apply_filters( 'woocommerce_short_description', $post->post_excerpt ) ?>
  143.                   </div><!-- End description-r hidden-phone hidden-tablet -->
  144.                   <?php
  145.                 endif;
  146.                 ?>
  147.                  
  148.                 <div class="name"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div>
  149.                 <div class="price">
  150.                   <?php
  151.                   /**
  152.                    * woocommerce_after_shop_loop_item_title hook
  153.                    *
  154.                    * @hooked woocommerce_template_loop_price - 10
  155.                    */
  156.                   do_action( 'woocommerce_after_shop_loop_item_title' );
  157.                   ?>
  158.                 </div><!-- End price -->
  159.               </li><!-- End LI -->
  160.               <?php
  161.             endwhile; // end of the loop.
  162.             ?>
  163.           </ul><!-- End UL slider1 -->
  164.      
  165.         </div><!-- End product-related -->
  166.       </div><!-- End right-sm-related visible-desktop -->
  167.       <?php
  168.     endif;
  169.    
  170.     wp_reset_postdata();
  171.  
  172.   endif;
  173.  
  174.  
  175.   if ($data['sellya_product_share']):
  176.  
  177.     ?>
  178.     <div class="right-sm-share hidden-phone">
  179.       <div class="product-share">
  180.         <div class="share">
  181.           <!-- AddThis Button BEGIN -->
  182.           <div class="addthis_toolbox addthis_default_style ">
  183.             <a href="<?php echo $permlink?>" class="addthis_button_preferred_1"></a>
  184.             <a href="<?php echo $permlink?>" class="addthis_button_preferred_2"></a>
  185.             <a href="<?php echo $permlink?>" class="addthis_button_preferred_3"></a>
  186.             <a href="<?php echo $permlink?>" class="addthis_button_preferred_4"></a>
  187.             <a href="<?php echo $permlink?>" class="addthis_button_preferred_5"></a>
  188.             <a href="<?php echo $permlink?>" class="addthis_button_preferred_6"></a><br />
  189.             <div>
  190.               <a class="addthis_counter addthis_pill_style"></a>
  191.             </div>
  192.           </div>
  193.           <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js"></script>
  194.           <!-- AddThis Button END -->
  195.         </div><!-- End share -->
  196.       </div><!-- End product-share -->
  197.     </div><!-- End right-sm-share hidden-phone -->
  198.     <?php
  199.   endif;
  200. endif;  
  201. ?>
Advertisement
Add Comment
Please, Sign In to add comment