<?php
/**
 * Magiccart 
 * @category 	Magiccart 
 * @copyright 	Copyright (c) 2014 Magiccart (http://www.magiccart.net/) 
 * @license 	http://www.magiccart.net/license-agreement.html
 * @Author: DOng NGuyen<nguyen@dvn.com>
 * @@Create Date: 2016-01-08 22:57:12
 * @@Modify Date: 2018-09-17 15:59:31
 * @@Function:
 */
 ?>
<?php if($this->getStatus() == 2) return; ?>
<?php $selector = 'alo-content-'.rand(0,999999999); ?>
<div class= "<?php /* @escapeNotVerified */ echo $selector?> magicproduct magiccategory">
<?php
$tabs = $this->getTabs();
$numTabs = count($tabs);
if($numTabs): ?>
    <div class="magic-category">
	    <div class="block-title-tabs clearfix">
		    <h3 class="title"><?php echo __($this->getTitle()); ?></h3>
		    <span class="toggle-tab mobile" style="display:none"><i class="fa fa-bars"></i></span>
			<ul class="magictabs toggle-content clearfix" data-ajax ='<?php /* @escapeNotVerified */ echo $this->getAjaxCfg() ?>'>
			<?php $activated = $this->getTabActivated();
				$limit = $this->getLimit();
				$single = ($numTabs ==1) ? 'single' : '';
				foreach ($tabs as $type => $name):
					$status  = (!$this->getAjax() || $activated ==$type) ? 'loaded' : '';
					$status .= ($type == $activated) ? " activated $single" : '';
					/* @escapeNotVerified */ echo '<li class="item '.$status.'" data-type ="'.$type.'"><span class ="title">'.__($name).'</span></li>';
				endforeach;
			?>
			</ul>
	    </div>
	</div>
<?php endif ?>
	<div class="ajax_loading" style="display:none" data-url="<?php /* @escapeNotVerified */ echo $this->getUrl('magicproduct/index/category', array('_type' => 'direct_link', '_secure'=>$this->getRequest()->isSecure()))?>"></div>
	<div class="box-product-content clearfix">
	    <?php if($image = $this->getData('image') ) : ?>
	    <?php $_category = $this->getCategory() ?>
	    <div class="box-product-adv">
			<div class="promotion">
				<a href="<?php echo $_category->getUrl() ?>"><img src="<?php /* @escapeNotVerified */ echo $this->getImage($image);?>"></a>
			</div>
	    </div> 
		<?php endif ?>
	    <div class="box-product">
			<div class="content-products" 
			<?php foreach ($this->getFrontendCfg() as $opt) :?>
				data-<?php /* @escapeNotVerified */ echo $opt ?>='<?php /* @escapeNotVerified */ echo $this->getData($opt) ?>'
			<?php endforeach;?>        
			>
			<?php 
				$timer = $this->getTimer();
				if($timer) echo $this->getContent('category/gridtimer.phtml');	
				else echo $this->getContent('category/grid.phtml');	
			?>
			</div>
		</div>
	</div>	
</div>

<script type="text/javascript">
	require([
		'jquery',
		'magiccart/slick',
		'magicproduct'
		], function($, slick, magicproduct){
			$(".<?php echo $selector?>").magicproduct({
				selector : ".<?php echo $selector?>", // Selector product grid
			});
		});
</script>
