<?php if (!empty($categories)): ?>
    <?php $catIndex = 1 ?>
    <?php foreach ($categories as $aMenuCategory): ?>
        <?php $catIndex += 1 ?>
        <?php if (!empty($menus[$aMenuCategory->id])): ?> 
            <div class="category-menus" id="categoryTab<?php echo $aMenuCategory->id ?>Content" tabindex="<?php echo $catIndex ?>">
                <div class="menu-content-category-head" onclick="showThisCategoryContent('<?php echo $aMenuCategory->id ?>')">
                    <div class="category-title">
                        <div style="width: 90%; float: left; text-transform: capitalize"> <?php echo $aMenuCategory->title ?></div>
                        <div style="width: 10%; float: right; text-align: right" class="item-derection-icon" ><i id="iconId-<?php echo $aMenuCategory->id ?>" class="icon icon-up-open-big"></i></div>
                        <br/>
                    </div>
                </div>
                <div class="category-menu-list hide-xs" id="categoryBlock-<?php echo $aMenuCategory->id ?>">
                    <div class="item-description category-description"><?php echo $aMenuCategory->content ?></div>
                    <?php if (!empty($menus[$aMenuCategory->id])): ?>
                        <?php foreach ($menus[$aMenuCategory->id] as $aMenu): ?>
                            <?php if (!empty($selections[$aMenuCategory->id][$aMenu->id])): ?>
                                <div class="block text-left row">
                                    <div class="block-item-part-left">
                                        <div class="item-title text-capitalize"><?php trim($aMenu->code) ? print '('. trim($aMenu->code) . ') ' : '' ?><?php echo $aMenu->title ?></div>
                                    </div>
                                    <div class="block-item-part-right">&nbsp;</div>
                                    <?php if (trim($aMenu->content)): ?>
                                        <div class="item-description menu-description"><?php echo $aMenu->content ?></div>
                                    <?php endif; ?>
                                </div>
                                <?php foreach ($selections[$aMenuCategory->id][$aMenu->id] as $aSelection): ?>
                                    <div class="block odd text-left row">
                                        <div class="block-item-part-left">
                                            <div class="item-title" id="selection">&nbsp;&nbsp;<span class="icon icon-right-open">&nbsp;<?php trim($aSelection->code) ? print'('. trim($aSelection->code) . ') ' : '' ?></span><?php echo $aSelection->title ?></div>
                                        </div>
                                        <div class="block-item-part-mid">
                                            <div class="loader loader<?php echo $aSelection->category . '_' . $aSelection->menu . '_' . $aSelection->id ?>" style="display: none; padding: 4px;">&nbsp;</div>
                                        </div>
                                        <div class="block-item-part-right">
                                            <span class="price"><?php echo getItemPrice($aSelection); ?>&nbsp;</span>
                                            <span class="btn-add-to-cart btn btn-sm btn-c getmetocart <?php $processOrder ? print'' : print 'disabled' ?>" data-c="<?php echo $aSelection->category ?>" data-m="<?php echo $aSelection->menu ?>" data-s="<?php echo $aSelection->id ?>" data-hasTop="<?php echo $aSelection->has_topping ?>" data-hasMod="<?php echo $aSelection->has_modifier ?>" data-dealType="<?php echo $aSelection->deal_type ?>" data-ctop="<?php echo $aSelection->ctop ?>" data-cmod="<?php echo $aSelection->cmod ?>" data-rule="no" >Add</span>
                                        </div>
                                        <?php if (trim($aSelection->content)): ?>
                                            <div class="item-description menu-description">&nbsp;&nbsp;<?php echo $aSelection->content ?></div>
                                        <?php endif; ?>
                                    </div>
                                <?php endforeach; ?>
                            <?php else: ?>
                                <div class="block text-left row">
                                    <div class="block-item-part-left">
                                        <div class="item-title"><?php trim($aMenu->code) ? print '(' . trim($aMenu->code) . ') ' : '' ?><?php echo $aMenu->title ?></div>
                                    </div>
                                    <div class="block-item-part-mid">
                                        <div class="loader loader<?php echo $aMenu->category . '_' . $aMenu->id . '_0' ?>" style="display: none;padding: 4px;">&nbsp;</div>
                                    </div>
                                    <div class="block-item-part-right">
                                        <span class="price"><?php echo getItemPrice($aMenu); ?>&nbsp;&nbsp;</span>
                                        <span class="btn-add-to-cart btn btn-sm btn-c loadmetocart getmetocart <?php $processOrder ? print'' : print 'disabled' ?>" data-c="<?php echo $aMenu->category ?>" data-m="<?php echo $aMenu->id ?>" data-s="0" data-hasTop="<?php echo $aMenu->has_topping ?>" data-hasMod="<?php echo $aMenu->has_modifier ?>" data-dealType="<?php echo $aMenu->deal_type ?>" data-ctop="<?php echo $aMenu->ctop ?>" data-cmod="<?php echo $aMenu->cmod ?>" data-rule="no">Add</span>
                                    </div>
                                    <div class="item-description menu-description"><?php echo $aMenu->content ?></div>
                                </div>
                            <?php endif; ?>
                        <?php endforeach; ?>
                    <?php endif; ?>
                </div>
            </div>
        <?php endif; ?>
    <?php endforeach; ?>
<?php endif; ?>