Advertisement
rafaelpires20

archive-product

Dec 6th, 2016
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.00 KB | None | 0 0
  1. <?php
  2. /**
  3.  * The Template for displaying product archives, including the main shop page which is a post type archive.
  4.  *
  5.  * Override this template by copying it to yourtheme/woocommerce/archive-product.php
  6.  *
  7.  * @author      WooThemes
  8.  * @package     WooCommerce/Templates
  9.  * @version     2.0.0
  10.  */
  11.  
  12. if (! defined('ABSPATH')) exit; // Exit if accessed directly
  13.  
  14. rossi_get_header(); ?>
  15. <?php
  16. global $rossi_options, $rossi_showcountdown, $rossi_productrows;
  17.  
  18. $rossi_showcountdown = false;
  19. $rossi_productrows = 1;
  20. ?>
  21. <div class="main-container page-shop">
  22.     <div class="page-content">
  23.         <div class="container">
  24.             <?php
  25.                 /**
  26.                  * woocommerce_before_main_content hook
  27.                  *
  28.                  * @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
  29.                  * @hooked woocommerce_breadcrumb - 20
  30.                  */
  31.                 do_action('woocommerce_before_main_content');
  32.             ?>
  33.             <div class="row">
  34.                 <?php if($rossi_options['sidebar_pos']=='left' || !isset($rossi_options['sidebar_pos'])) :?>
  35.                     <?php get_sidebar('category'); ?>
  36.                 <?php endif; ?>
  37.                
  38.                 <div id="archive-product" class="col-xs-12 col-md-<?php echo (is_active_sidebar( 'sidebar-category' )) ? 9 : 12 ; ?>">
  39.                     <div class="archive-border <?php if($rossi_options['sidebar_pos']=='right') { echo ' border-right';} ?>">
  40.                        
  41.                         <?php if (have_posts()) : ?>
  42.                            
  43.                             <?php
  44.                                 /**
  45.                                 * remove message from 'woocommerce_before_shop_loop' and show here
  46.                                 */
  47.                                 do_action('woocommerce_show_message');
  48.                             ?>
  49.                             <div class="shop_header">
  50.                             <?php
  51.                             if(is_shop()){
  52.                                 esc_html_e('Todas Categorias', 'rossi');
  53.                             } elseif (is_product_category()) {
  54.                                 echo single_cat_title('', false);
  55.                             }
  56.                             ?></div>
  57.                             <?php do_action('woocommerce_archive_description'); ?> 
  58.                             <?php if($rossi_options['cat_banner_img'] != '') { ?>
  59.                                 <div class="rossi-banner banner-category"><a href="<?php echo esc_url($rossi_options['cat_banner_link']); ?>"><img src="<?php echo esc_url($rossi_options['cat_banner_img']['url']); ?>" alt=""></a></div>
  60.                             <?php } ?>
  61.                             <div class="toolbar">
  62.                                 <div class="view-mode">
  63.                                     <a href="#" class="grid active" title="<?php echo esc_attr__('Grid', 'rossi'); ?>"><i class="fa fa-th-large"></i> <strong><?php echo esc_html__('Grade', 'rossi'); ?></strong></a>
  64.                                     <a href="#" class="list" title="<?php echo esc_attr__('List', 'rossi'); ?>"><i class="fa fa-th-list"></i> <strong><?php echo esc_html__('Lista', 'rossi'); ?></strong></a>
  65.                                 </div>
  66.                                 <?php
  67.                                     /**
  68.                                      * woocommerce_before_shop_loop hook
  69.                                      *
  70.                                      * @hooked woocommerce_result_count - 20
  71.                                      * @hooked woocommerce_catalog_ordering - 30
  72.                                      */
  73.                                     //do_action('woocommerce_after_shop_loop');
  74.                                     do_action('woocommerce_before_shop_loop');
  75.                                 ?>
  76.                                 <div class="clearfix"></div>
  77.                             </div>
  78.                         <?php endif; ?>            
  79.                        
  80.                         <?php if (have_posts()) : ?>   
  81.                        
  82.                             <?php woocommerce_product_subcategories(array('before' => '<div class="shop-category row">','after' => '</div>')); ?>
  83.                        
  84.                             <?php woocommerce_product_loop_start(); ?>
  85.  
  86.                                 <?php while (have_posts()) : the_post(); ?>
  87.  
  88.                                     <?php wc_get_template_part('content', 'product'); ?>
  89.  
  90.                                 <?php endwhile; // end of the loop. ?>
  91.  
  92.                             <?php woocommerce_product_loop_end(); ?>
  93.  
  94.                             <div class="toolbar tb-bottom">
  95.                                 <?php
  96.                                     /**
  97.                                      * woocommerce_before_shop_loop hook
  98.                                      *
  99.                                      * @hooked woocommerce_result_count - 20
  100.                                      * @hooked woocommerce_catalog_ordering - 30
  101.                                      */
  102.                                     do_action('woocommerce_after_shop_loop');
  103.                                     //do_action('woocommerce_before_shop_loop');
  104.                                 ?>
  105.                                 <div class="clearfix"></div>
  106.                             </div>
  107.                            
  108.                         <?php elseif (! woocommerce_product_subcategories(array('before' => woocommerce_product_loop_start(false), 'after' => woocommerce_product_loop_end(false)))) : ?>
  109.  
  110.                             <?php wc_get_template('loop/no-products-found.php'); ?>
  111.  
  112.                         <?php endif; ?>
  113.  
  114.                     <?php
  115.                         /**
  116.                          * woocommerce_after_main_content hook
  117.                          *
  118.                          * @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content)
  119.                          */
  120.                         do_action('woocommerce_after_main_content');
  121.                     ?>
  122.  
  123.                     <?php
  124.                         /**
  125.                          * woocommerce_sidebar hook
  126.                          *
  127.                          * @hooked woocommerce_get_sidebar - 10
  128.                          */
  129.                         //do_action('woocommerce_sidebar');
  130.                     ?>
  131.                     </div>
  132.                 </div>
  133.                
  134.                 <?php if($rossi_options['sidebar_pos']=='right') :?>
  135.                     <?php get_sidebar('category'); ?>
  136.                 <?php endif; ?>
  137.             </div>
  138.         </div>
  139.     </div>
  140. </div>
  141. <script>
  142.     (function($) {
  143.         "use strict";
  144.         jQuery(document).ready(function(){
  145.             jQuery('.view-mode').each(function(){
  146.             <?php if($rossi_options['layout_product']=='gridview') { ?>
  147.                 /* Grid View */                
  148.                 jQuery('#archive-product .view-mode').find('.grid').addClass('active');
  149.                 jQuery('#archive-product .view-mode').find('.list').removeClass('active');
  150.                
  151.                 jQuery('#archive-product .shop-products').removeClass('list-view');
  152.                 jQuery('#archive-product .shop-products').addClass('grid-view');
  153.                
  154.                 jQuery('#archive-product .list-col4').removeClass('col-xs-12 col-sm-6 col-lg-4');
  155.                 jQuery('#archive-product .list-col8').removeClass('col-xs-12 col-sm-6 col-lg-8');
  156.             <?php } ?>
  157.             <?php if($rossi_options['layout_product']=='listview') { ?>
  158.                 /* List View */                            
  159.                 jQuery('#archive-product .view-mode').find('.list').addClass('active');
  160.                 jQuery('#archive-product .view-mode').find('.grid').removeClass('active');
  161.                
  162.                 jQuery('#archive-product .shop-products').addClass('list-view');
  163.                 jQuery('#archive-product .shop-products').removeClass('grid-view');
  164.                
  165.                 jQuery('#archive-product .list-col4').addClass('col-xs-12 col-sm-6 col-lg-4');
  166.                 jQuery('#archive-product .list-col8').addClass('col-xs-12 col-sm-6 col-lg-8');
  167.             <?php } ?>
  168.             });
  169.         });
  170.     })(jQuery);
  171. </script>
  172. <?php get_footer('shop'); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement