<?php 
/**
 * @author      Magetop Developer (Kien)
 * @package     Magento Multi Vendor Marketplace
 * @copyright   Copyright (c) Magetop (https://www.magetop.com)
 * @terms       https://www.magetop.com/terms
 * @license     https://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 **/
?>
<?php
/**
 * Copyright © 2020 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
// @codingStandardsIgnoreFile
/**  @var $block \Magento\Checkout\Block\Cart */
?>
<?php $mergedCells = ($this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices() ? 2 : 1); ?>
<?php echo $block->getChildHtml('form_before') ?>
<form action="<?php /* @escapeNotVerified */ echo $block->getUrl('checkout/cart/updatePost') ?>"
          method="post"
          id="form-validate"
          data-mage-init='{"validation":{}}'
          class="form form-cart">
    <?php echo $block->getBlockHtml('formkey'); ?>
    <div class="cart table-wrapper<?php echo $mergedCells == 2 ? ' detailed' : ''; ?>">
        <table id="shopping-cart-table"
               class="cart items data table"
               data-mage-init='{"shoppingCart":{"emptyCartButton": "action.clear",
               "updateCartActionContainer": "#update_cart_action_container"}}'>
            <caption role="heading" aria-level="2" class="table-caption"><?php /* @escapeNotVerified */ echo __('Shopping Cart Items') ?></caption>
            <thead>
                <tr>
                    <th class="col item" scope="col"><span><?php /* @escapeNotVerified */ echo __('Item') ?></span></th>
                    <th class="col price" scope="col"><span><?php /* @escapeNotVerified */ echo __('Price') ?></span></th>
                    <th class="col qty" scope="col"><span><?php /* @escapeNotVerified */ echo __('Qty') ?></span></th>
                    <th class="col subtotal" scope="col"><span><?php /* @escapeNotVerified */ echo __('Subtotal') ?></span></th>
                </tr>
            </thead>
            <?php foreach ($block->getItems() as $_item): ?>
                
                <tr>
                    <td>
                        <?php $mkSalesHelper = $this->helper('Magetop\Marketplace\Helper\MkSales'); ?>
                    	<?php if($mkSalesHelper->getSellerNameCheckoutCart($_item->getProductId())): ?>
                            <?php 
                                $seller = $mkSalesHelper->getSellerNameCheckoutCart($_item->getProductId());
                            ?>
                            	<div class="info-seller">
                            		<div class="info-seller-title">
                                		<strong><?php echo __('Seller: '); ?></strong> 
                                		<?php $helperMk = $this->helper(\Magetop\Marketplace\Helper\Collection::class); ?>
										<a href="<?php echo  $helperMk->getRewriteUrl('marketplace/seller/view/vendor/'.$seller->getStoreurl()); ?>" class="store-name">
                                            <?php echo $seller->getStoretitle() ?>
                                        </a>
                            		</div>
                            	</div>
                        <?php endif; ?>
                    </td>
                </tr>
                
                <?php echo $block->getItemHtml($_item) ?>
                
            <?php endforeach ?>
        </table>
    </div>
    <div class="cart main actions">
        <?php if ($block->getContinueShoppingUrl()): ?>
            <a class="action continue"
               href="<?php echo $block->escapeUrl($block->getContinueShoppingUrl()) ?>"
               title="<?php echo $block->escapeHtml(__('Continue Shopping')); ?>">
                <span><?php /* @escapeNotVerified */ echo __('Continue Shopping') ?></span>
            </a>
        <?php endif; ?>
        <button type="submit"
                name="update_cart_action"
                data-cart-empty=""
                value="empty_cart"
                title="<?php echo $block->escapeHtml(__('Clear Shopping Cart')); ?>"
                class="action clear" id="empty_cart_button">
            <span><?php /* @escapeNotVerified */ echo __('Clear Shopping Cart'); ?></span>
        </button>
        <button type="submit"
                name="update_cart_action"
                data-cart-item-update=""
                value="update_qty"
                title="<?php echo $block->escapeHtml(__('Update Shopping Cart')); ?>"
                class="action update">
            <span><?php /* @escapeNotVerified */ echo __('Update Shopping Cart'); ?></span>
        </button>
        <input type="hidden" value="" id="update_cart_action_container" data-cart-item-update=""/>
    </div>
</form>
<?php echo $block->getChildHtml('checkout.cart.order.actions') ?>
<?php echo $block->getChildHtml('shopping.cart.table.after'); ?>
