<?php 
/**
 * Categories Style 2
 */
?>
<div id="<?php echo esc_attr($id); ?>" class="<?php echo esc_attr( $class ); ?>">
	<?php if( ! empty( $title ) ){ ?>
		<div class="section-heading">			
			<h2><?php echo esc_html( $title ); ?></h2>
			<?php if( $show_view_more_button ){ ?>
				<div class="view-all-btn">
					<a <?php echo implode(' ', $view_all_btn );?> ><?php echo esc_html( $view_more_button_text ); ?></a>
				</div>
			<?php } ?>
		</div>
	<?php } ?>
	<div class="section-content <?php echo esc_attr( $section_class ); ?>">
		<div class="products <?php echo esc_attr( $grid_class ); ?>" <?php if( ! empty( $slider_options ) ){ echo 'data-slider_options="'.esc_attr( $slider_options ).'"';  } ?> >
			<?php if ( $product_categories ) {
				$total_categories = count($product_categories);
				foreach ( $product_categories as $cat ) {
					$cate_link = get_term_link( $cat ); ?>
					<div class="product-category<?php echo esc_attr($column_class); ?>">
						<div class="pls-category-inner">
							<a href="<?php echo esc_url( $cate_link ); ?>">	
								<div class="pls-category-image">
									<?php $thumbnail_id = get_term_meta( $cat->term_id, 'thumbnail_id', true );
									$catalog_img = wp_get_attachment_image_src( $thumbnail_id, $image_size );
									if ( ! empty( $catalog_img ) ) {
										$attribute 			= array();
										$attribute['alt'] 	= esc_html($cat->name);
										echo pls_get_image_html( $thumbnail_id, $image_size, '', $attribute ); 
									}else{ ?>
										<img src="<?php echo esc_url(PLS_CORE_URL.'assets/images/product-placeholder.jpg'); ?>" alt="<?php esc_html($cat->name); ?>"/>
									<?php } ?>
								</div>
								<div class="pls-category-content">
									<h2 class="woocommerce-loop-category__title">
										<?php if( $show_count ) {
											echo sprintf(
												'<span class="product-count">%1$s</span>',
												sprintf( _n( '%s Product', '%s Products', $cat->count, 'modave-core' ), $cat->count )
											);
										} ?>								
										<?php echo esc_html( $cat->name ); ?>
									</h2>
								</div>
							</a>
						</div>
					</div>
					<?php 
				}
			} ?>
		</div>
	</div>
</div>