<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

?>
<?php
/**
 * Category view template
 *
 * @var $block \Magento\Catalog\Block\Category\View
 */
?>

<?php 
	$themeSettingConfig = $this->helper('MGS\ThemeSettings\Helper\Config');
	$category = $this->getCurrentCategory();
?>
<?php if($category->getIsLanding()): ?>
	<?php 
		$landingType =$category->getCateLandingType();
	?>
	<div class="landing-categories">
		<?= $this->getLayout()->createBlock("MGS\ThemeSettings\Block\Category\Landing")->setCurrentCategory($category)->setThemeSettingConfig($themeSettingConfig)->setTemplate("MGS_ThemeSettings::category/landing/".$landingType.".phtml")->toHtml();?>
	</div>
<?php else: ?>
	<?php 
		$perRowDefault = $themeSettingConfig->getStoreConfig('themesettings/category/product_per_row');
		$perRowTablet = $themeSettingConfig->getStoreConfig('themesettings/category/product_per_row_tablet');
		$perRowMobile = $themeSettingConfig->getStoreConfig('themesettings/category/product_per_row_mobile');
		
		if($category->getPerRow()!=''){
			$perRowDefault = $category->getPerRow();
		}
		if($category->getPerRowTablet()!=''){
			$perRowTablet = $category->getPerRowTablet();
		}
		if($category->getPerRowMobile()!=''){
			$perRowMobile = $category->getPerRowMobile();
		}
	?>
	<?php if (!$block->isContentMode() || $block->isMixedMode()): ?>
		<div class="product-container category-product-container row-<?= $perRowDefault ?> row-tablet-<?= $perRowTablet ?> row-mobile-<?= $perRowMobile ?>" id="product-container" data-dimension-grid="<?= $category->getImageDimentionGrid() ?>" data-dimension-list="<?= $category->getImageDimentionList() ?>">
			<?= $block->getProductListHtml() ?>
		</div>
	<?php endif; ?>
<?php endif ?>