balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

class-woocommerce-customize.php (6541B)


      1 <?php
      2 
      3 /**
      4  * Package Aapside
      5  * Author Ir Tech
      6  * @since 1.0.1
      7  * */
      8 
      9 if (!defined('ABSPATH')){
     10 	exit(); //exit if access directly
     11 }
     12 if (!class_exists('Aapside_Woocomerce_Customize')){
     13 	class Aapside_Woocomerce_Customize{
     14 		//$instance variable
     15 		private static $instance;
     16 		
     17 		public function __construct() {
     18 		    remove_action('woocommerce_archive_description','woocommerce_taxonomy_archive_description',10);
     19 		    remove_action('woocommerce_archive_description','woocommerce_product_archive_description',10);
     20             remove_action('woocommerce_single_product_summary','woocommerce_template_single_title',5);
     21 			add_filter('woocommerce_post_class',array($this,'wc_product_post_class'),20, 3);
     22 			add_filter( 'woocommerce_show_page_title', '__return_false' );
     23 			add_filter( 'woocommerce_enqueue_styles', '__return_false' );
     24 			add_filter( 'woocommerce_add_to_cart_fragments', array($this,'woocommerce_header_add_to_cart_fragment') );
     25 			add_action('woocommerce_before_shop_loop',array($this,'woocommerce_before_shop_header_wrap_start'),12);
     26 			add_action('woocommerce_before_shop_loop',array($this,'woocommerce_before_shop_header_wrap_end'),32);
     27             add_action('woocommerce_before_shop_loop_item_title',array($this,'woocommerce_before_shop_loop_item_thumbnail_wrap_start'),9);
     28             add_action('woocommerce_before_shop_loop_item_title',array($this,'woocommerce_before_shop_loop_item_thumbnail_wrap_end'),12);
     29             add_action('woocommerce_shop_loop_item_title',array($this,'woocommerce_shop_loop_item_content_wrap_start'),9);
     30             add_action('woocommerce_after_shop_loop_item',array($this,'woocommerce_shop_loop_item_content_wrap_end'),12);
     31             add_action('woocommerce_before_single_product_summary',array($this,'woocommerce_before_single_product_summary_wrapper_start'),9);
     32             add_action('woocommerce_before_single_product_summary',array($this,'woocommerce_before_single_product_thumbnail_wrapper_end'),22);
     33             add_action('woocommerce_after_single_product_summary',array($this,'woocommerce_before_single_product_summary_wrapper_end'),9);
     34             add_action('woocommerce_before_account_navigation',array($this,'woocommerce_before_account_navigation_wrapper_start'),10);
     35             add_action('woocommerce_account_content',array($this,'woocommerce_before_account_navigation_wrapper_end'),30);
     36 		}
     37 		/**
     38 		 * get Instance
     39 		 * @since 1.0.2
     40 		 * */
     41 		public static function getInstance(){
     42 			if (null == self::$instance){
     43 				self::$instance = new self();
     44 			}
     45 			return self::$instance;
     46 		}
     47 
     48 		/**
     49 		 * Show cart contents / total Ajax
     50          * @since 1.0.2
     51 		 */
     52 		function woocommerce_header_add_to_cart_fragment( $fragments ) {
     53 			global $woocommerce;
     54 			ob_start();
     55 			?>
     56 			<a class="aapside-header-cart" href="<?php echo wc_get_cart_url(); ?>"
     57 			   title="<?php esc_attr_e( 'View your shopping cart','aapside' ); ?>">
     58 				<i class="fa fa-shopping-basket" aria-hidden="true"></i>
     59 				<span class="cart-badge"><?php echo sprintf (  '%d', WC()->cart->get_cart_contents_count() ); ?></span>
     60 			</a>
     61 			<?php
     62 			$fragments['a.aapside-header-cart'] = ob_get_clean();
     63 			return $fragments;
     64 		}
     65 
     66 		/**
     67          * shop header wrap start
     68 		 * @since 1.0.2
     69 		 * */
     70         public function woocommerce_before_shop_header_wrap_start(){
     71             ?>
     72                 <div class="woocommerce-header-area-wrap">
     73             <?php
     74         }
     75         /**
     76          * shop header wrap end
     77 		 * @since 1.0.2
     78 		 * */
     79         public function woocommerce_before_shop_header_wrap_end(){
     80             ?>
     81                 </div>
     82             <?php
     83         }
     84 		/**
     85 		 * product class for archive and single page
     86 		 * @since 1.0.2
     87 		 * */
     88         public function wc_product_post_class($class){
     89         	$class[] = is_product() ? 'aapside-product-single-page-item' : 'aapside-single-product-item';
     90             return $class;
     91         }
     92         /**
     93          * add wrapper for thumbnail and sale attribute start
     94          * @sinsce 1.0.2
     95          * */
     96         public function woocommerce_before_shop_loop_item_thumbnail_wrap_start(){
     97             ?>
     98             <div class="woocommerce-thumbnail-wrap">
     99             <?php
    100         }
    101 
    102         /**
    103          * add wrapper for thumbnail and sale attribute end
    104          * @sinsce 1.0.2
    105          * */
    106         public function woocommerce_before_shop_loop_item_thumbnail_wrap_end(){
    107             ?>
    108             </div>
    109             <?php
    110         }
    111 
    112         /**
    113          * add wrapper for title, price and add to cart item
    114          * @sinsce 1.0.2
    115          * */
    116         public function woocommerce_shop_loop_item_content_wrap_start(){
    117             ?>
    118             <div class="product-contnent-wrap">
    119             <?php
    120         }
    121 
    122         /**
    123          * add wrapper for title, price and add to cart item
    124          * @sinsce 1.0.2
    125          * */
    126         public function woocommerce_shop_loop_item_content_wrap_end(){
    127             ?>
    128             </div>
    129             <?php
    130         }
    131         /**
    132          * add wrapper for title, price and add to cart item and product summery for single product page
    133          * @sinsce 1.0.2
    134          * */
    135         public function woocommerce_before_single_product_summary_wrapper_start(){
    136             ?>
    137             <div class="woocommmerce-product-single-page-top-content-wrap">
    138                 <div class="woocommerce-thumbnail-wrapper">
    139             <?php
    140         }
    141 
    142 		/**
    143 		 * add wrapper for title, price and add to cart item and product summery for single product page
    144 		 * @sinsce 1.0.2
    145 		 * */
    146         public function woocommerce_before_single_product_summary_wrapper_end(){
    147             ?>
    148             </div>
    149             <?php
    150         }
    151         /**
    152 		 * add wrapper for title, price and add to cart item . single product page thumbnail wrap
    153 		 * @sinsce 1.0.2
    154 		 * */
    155         public function woocommerce_before_single_product_thumbnail_wrapper_end(){
    156             ?>
    157             </div>
    158             <?php
    159         }
    160         /**
    161 		 * add wrapper for my account navigation and content
    162 		 * @sinsce 1.0.2
    163 		 * */
    164         public function woocommerce_before_account_navigation_wrapper_start(){
    165             ?>
    166             <div class="woocommerce-my-account-page-wrapper">
    167             <?php
    168         }
    169         /**
    170 		 * add wrapper for my account navigation and content
    171 		 * @sinsce 1.0.2
    172 		 * */
    173         public function woocommerce_before_account_navigation_wrapper_end(){
    174             ?>
    175             </div>
    176             <?php
    177         }
    178 	}//end class
    179 	if ( class_exists('Aapside_Woocomerce_Customize')){
    180 		Aapside_Woocomerce_Customize::getInstance();
    181 	}
    182 }