<?php
/**
 * Magetop Development
 *
 * @category  Magetop Extension
 * @package   Magetop_Marketplace
 * @author    Magetop
 * @copyright Copyright (c) Magetop (https://www.magetop.com)
 * @license   https://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php
$helper = $this->helper(\Magetop\Marketplace\Helper\Data::class);
$partner=$block->getProfileDetail();
if ($partner['storeurl']) {
    $_productCollection=$block->_getProductCollection();
    ?>
    <div class="mt-container">
            <div class="mt-col-left">
                <?php echo $block->getChildHtml('marketplace_sellercollectionleft'); ?>
            </div>
            <div class="mt-col-main">
                <div class="search-name-block">
                    <?php // echo $block->getChildHtml('seller_product_search'); ?>
                </div>
                <div class="page-products page-with-filter" <?php if ($_productCollection->count()) { echo 'style="padding: 0;"';}?>>
                    <?php
                    $_helper = $this->helper(\Magento\Catalog\Helper\Output::class);
                    ?>
                    <?php if (!$_productCollection->count()) : ?>
                        <div class="message info empty"><div><?= /* @escapeNotVerified */ $block->escapeHtml(__('We can\'t find products matching the selection.')) ?></div></div>
                    <?php else : ?>
                        <?= $block->getToolbarHtml() ?>
                        <?= $block->getAdditionalHtml() ?>
                        <?php
                        if ($block->getMode() == 'grid') {
                            $viewMode = 'grid';
                            $image = 'category_page_grid';
                            $showDescription = false;
                            $templateType = \Magento\Catalog\Block\Product\ReviewRendererInterface::SHORT_VIEW;
                        } else {
                            $viewMode = 'list';
                            $image = 'category_page_list';
                            $showDescription = true;
                            $templateType = \Magento\Catalog\Block\Product\ReviewRendererInterface::FULL_VIEW;
                        }
                        /**
                        * Position for actions regarding image size changing in vde if needed
                        */
                        $pos = $block->getPositioned();
                        ?>
                        <div class="list-3 products wrapper <?= /* @noEscape */ $viewMode; ?> products-<?= /* @noEscape */ $viewMode; ?>">
                            <?php $iterator = 1; ?>
                            <ol class="products list items product-items">
                                <?php /** @var $_product \Magento\Catalog\Model\Product */ ?>
                                <?php foreach ($_productCollection as $_product) : ?>
                                    <?= /* @escapeNotVerified */ ($iterator++ == 1) ? '<li class="item product product-item">' : '</li><li class="item product product-item">' ?>
                                    <div class="product-item-info" data-container="product-grid">
                                        <?php
                                        $productImage = $block->getImage($_product, $image);
                                        if ($pos != null) {
                                            $position = ' style="left:' . $productImage->getWidth() . 'px;'
                                                . 'top:' . $productImage->getHeight() . 'px;"';
                                        }
                                        ?>
                                        <?php // Product Image ?>
                                        <a href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" class="product photo product-item-photo" tabindex="-1">
                                            <?= $productImage->toHtml(); ?>
                                        </a>
                                        <div class="product details product-item-details">
                                            <?php
                                                $_productNameStripped = $block->stripTags($_product->getName(), null, true);
                                            ?>
                                            <strong class="product name product-item-name">
                                                <a class="product-item-link"
                                                href="<?= $block->escapeUrl($_product->getProductUrl()) ?>">
                                                    <?= /* @noEscape */ $_helper->productAttribute($_product, $_product->getName(), 'name'); ?>
                                                </a>
                                            </strong>
                                            <?= $block->getReviewsSummaryHtml($_product, $templateType); ?>
                                            <?= /* @noEscape */ $block->getProductPrice($_product) ?>
                                            <?= $block->getProductDetailsHtml($_product); ?>

                                            <div class="product-item-inner">
                                                <div class="product actions product-item-actions"<?= /* @noEscape */  @strpos($pos, $viewMode . '-actions') ? $position : ''; ?>>
                                                    <div class="actions-primary"<?= /* @noEscape */  @strpos($pos, $viewMode . '-primary') ? $position : ''; ?>>
                                                        <?php if ($_product->isSaleable()) : ?>
                                                            <?php $postParams = $block->getAddToCartPostParams($_product); ?>
                                                            <form data-role="tocart-form" action="<?= /* @noEscape */  $postParams['action']; ?>" method="post">
                                                                <input type="hidden" name="product" value="<?=/* @noEscape */  $postParams['data']['product']; ?>">
                                                                <input type="hidden" name="uenc" value="<?= /* @noEscape */ $postParams['data']['uenc']; ?>">
                                                                <?= $block->getBlockHtml('formkey')?>
                                                                <button type="submit"
                                                                        title="<?= $block->escapeHtml(__('Add to Cart')); ?>"
                                                                        class="action tocart primary">
                                                                    <span><?= $block->escapeHtml(__('Add to Cart')) ?></span>
                                                                </button>
                                                            </form>
                                                        <?php else : ?>
                                                            <?php if ($_product->getIsSalable()) : ?>
                                                                <div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div>
                                                            <?php else : ?>
                                                                <div class="stock unavailable"><span><?= $block->escapeHtml(__('Out of stock')) ?></span></div>
                                                            <?php endif; ?>
                                                        <?php endif; ?>
                                                    </div>
                                                    <div data-role="add-to-links" class="actions-secondary"<?= /* @noEscape */ @strpos($pos, $viewMode . '-secondary') ? $position : ''; ?>>
                                                        <?php if ($this->helper(\Magento\Wishlist\Helper\Data::class)->isAllow()) : ?>
                                                            <a href="#"
                                                            class="action towishlist"
                                                            title="<?= $block->escapeHtml(__('Add to Wish List')); ?>"
                                                            aria-label="<?= $block->escapeHtml(__('Add to Wish List')); ?>"
                                                            data-post='<?= /* @noEscape */ $block->getAddToWishlistParams($_product); ?>'
                                                            data-action="add-to-wishlist"
                                                            role="button">
                                                                <span><?= $block->escapeHtml(__('Add to Wish List')) ?></span>
                                                            </a>
                                                        <?php endif; ?>
                                                        <?php
                                                        $compareHelper = $this->helper(\Magento\Catalog\Helper\Product\Compare::class);
                                                        ?>
                                                        <a href="#"
                                                        class="action tocompare"
                                                        title="<?= $block->escapeHtml(__('Add to Compare')); ?>"
                                                        aria-label="<?= $block->escapeHtml(__('Add to Compare')); ?>"
                                                        data-post='<?= /* @noEscape */ $compareHelper->getPostDataParams($_product); ?>'
                                                        role="button">
                                                            <span><?= $block->escapeHtml(__('Add to Compare')) ?></span>
                                                        </a>
                                                    </div>
                                                </div>
                                                <?php if ($showDescription) :?>
                                                    <div class="product description product-item-description">
                                                        <?= /* @noEscape */ $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
                                                        <a href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" title="<?= /* @noEscape */ $_productNameStripped ?>"
                                                        class="action more"><?= $block->escapeHtml(__('Learn More')) ?></a>
                                                    </div>
                                                <?php endif; ?>
                                            </div>
                                        </div>
                                    </div>
                                    <?= ($iterator == count($_productCollection)+1) ? '</li>' : '' ?>
                                <?php endforeach; ?>
                            </ol>
                        </div>
                        <?= $block->getToolbarHtml() ?>
                        <?php if (!$block->isRedirectToCartEnabled()) : ?>
                            <script type="text/x-magento-init">
                            {
                                "[data-role=tocart-form], .form.map.checkout": {
                                    "catalogAddToCart": {}
                                }
                            }
                            </script>
                        <?php endif; ?>
                    <?php endif; ?>
                </div>
            </div>
    </div>
<?php }  ?>