<?php
/**
 * FW Food menu 5.1.1
 * @copyright (C) 2020 Fastw3b
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 * @link http://www.fastw3b.net/ Official website
 **/

defined( '_JEXEC' ) or die( 'Restricted access' );

$view = $displayData['view'];
$col_qty = $displayData['col_qty'];
$qty = $displayData['qty'];
$cat = $displayData['cat'];

$num = 0;
$cols_displayed = 1;

$items_per_column = max(1, round($qty/$col_qty));
$shift = max(0, $qty - $items_per_column * $col_qty);
$view->prev_subcategory_id = 0;

foreach ($cat->_items as $row) {
    $view->row = $row;
    if (isset($row->type)) {
        $view->params = new JFParams($row->params, fwFoodMenuHelper::getParentCategories($row->parent));
        echo fwFoodMenuHelper::loadTemplate('menu.subcategoryitem', array('view'=>$view));
    } else {
?>
						<div class="fwfm-col">
<?php
        echo fwFoodMenuHelper::loadTemplate('menu.menuitem', array('view'=>$view));
?>
						</div>
<?php
    }
    $num++;
}