Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/vendor/mageworx/module-htmlsitemap/Block/Sitemap/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/mageworx/module-htmlsitemap/Block/Sitemap/Products.php
<?php
/**
 * Copyright © 2015 MageWorx. All rights reserved.
 * See LICENSE.txt for license details.
 */

namespace MageWorx\HtmlSitemap\Block\Sitemap;

use \Magento\Framework\View\Element\Template\Context;
use \MageWorx\HtmlSitemap\Model\ResourceModel\Catalog\ProductFactory;

/**
 * Product block
 */
class Products extends \Magento\Framework\View\Element\Template
{
    /**
     * @var \MageWorx\HtmlSitemap\Model\ResourceModel\Catalog\ProductFactory
     */
    protected $productFactory;

    /**
     * @var int
     */
    protected $categoryId;

    /**
     * @param \Magento\Framework\View\Element\Template\Context $context
     * @param \MageWorx\HtmlSitemap\Model\ResourceModel\Catalog\ProductFactory $productFactory
     * @param array $data
     */
    public function __construct(
        Context $context,
        ProductFactory $productFactory,
        array $data = []
    ) {
        $this->productFactory = $productFactory;
        parent::__construct($context, $data);
    }

    /**
     *
     * @param int $id
     * @return this
     */
    public function setCategoryId($id)
    {
        $this->categoryId = $id;
        return $this;
    }

    /**
     * Retrieve array of product items (\Magento\Framework\Object) or false
     *
     * @return array|false
     * @see \MageWorx\HtmlSitemap\Model\ResourceModel\Catalog\Product
     */
    public function getProductCollection()
    {
        if (!$this->categoryId) {
            return [];
        }
        $this->getCategory();
        return $this->productFactory->create()->getCollection($this->categoryId, $this->_storeManager->getStore()->getId());
    }
}

Spamworldpro Mini