/**
  * @param \Magento\Catalog\Block\Product\Context $context
  * @param \Magento\Catalog\Model\Product\Visibility $productVisibility
  * @param \Magento\Reports\Model\Product\Index\Factory $indexFactory
  * @param array $data
  */
 public function __construct(\Magento\Catalog\Block\Product\Context $context, \Magento\Catalog\Model\Product\Visibility $productVisibility, \Magento\Reports\Model\Product\Index\Factory $indexFactory, array $data = [])
 {
     parent::__construct($context, $data);
     $this->_productVisibility = $productVisibility;
     $this->_indexFactory = $indexFactory;
     $this->_isScopePrivate = true;
 }
Ejemplo n.º 2
0
 /**
  * @param \Magento\Catalog\Block\Product\Context $context
  * @param \Magento\Core\Helper\Data $coreData
  * @param \Magento\Customer\Service\V1\CustomerAccountServiceInterface $accountService
  * @param array $data
  */
 public function __construct(\Magento\Catalog\Block\Product\Context $context, \Magento\Core\Helper\Data $coreData, \Magento\Customer\Service\V1\CustomerAccountServiceInterface $accountService, array $data = array())
 {
     $this->coreData = $coreData;
     $this->accountService = $accountService;
     parent::__construct($context, $data);
     $this->_isScopePrivate = true;
 }
 public function __construct(\Magento\Catalog\Block\Product\Context $context, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Customer\Model\Session $customerSession, array $data = [])
 {
     $this->_storeManager = $storeManager;
     $this->checkoutSession = $checkoutSession;
     $this->customerSession = $customerSession;
     parent::__construct($context, $data);
 }
 /**
  * Related products block construct
  * @param \Magento\Catalog\Block\Product\Context $context
  * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility
  * @param \Magento\Framework\Module\Manager $moduleManager
  * @param \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $data
  */
 public function __construct(\Magento\Catalog\Block\Product\Context $context, \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, \Magento\Framework\Module\Manager $moduleManager, \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory, array $data = [])
 {
     $this->_catalogProductVisibility = $catalogProductVisibility;
     $this->_moduleManager = $moduleManager;
     $this->_productCollectionFactory = $productCollectionFactory;
     parent::__construct($context, $data);
 }
Ejemplo n.º 5
0
 public function __construct(AttributeFactory $attributeFactory, LoggerInterface $loggerInterface, DateTime $dateTime, Context $context, array $data)
 {
     $this->_attributeFactory = $attributeFactory;
     $this->_date = $dateTime;
     $this->_logger = $loggerInterface;
     parent::__construct($context, $data);
 }
Ejemplo n.º 6
0
 /**
  * @param Context $context
  * @param \Magento\Customer\Model\Session $customerSession
  * @param \Magento\Customer\Helper\View $customerView
  * @param array $data
  */
 public function __construct(\Magento\Catalog\Block\Product\Context $context, \Magento\Customer\Model\Session $customerSession, \Magento\Customer\Helper\View $customerView, array $data = array())
 {
     $this->_customerSession = $customerSession;
     $this->_customerView = $customerView;
     parent::__construct($context, $data);
     $this->_isScopePrivate = true;
 }
 /**
  * Push constructor.
  *
  * @param \Magento\Catalog\Model\ProductFactory     $productFactory
  * @param \Dotdigitalgroup\Email\Helper\Data        $helper
  * @param \Magento\Framework\Pricing\Helper\Data    $priceHelper
  * @param \Dotdigitalgroup\Email\Helper\Recommended $recommended
  * @param \Magento\Catalog\Block\Product\Context    $context
  * @param array                                     $data
  */
 public function __construct(\Magento\Catalog\Model\ProductFactory $productFactory, \Dotdigitalgroup\Email\Helper\Data $helper, \Magento\Framework\Pricing\Helper\Data $priceHelper, \Dotdigitalgroup\Email\Helper\Recommended $recommended, \Magento\Catalog\Block\Product\Context $context, array $data = [])
 {
     parent::__construct($context, $data);
     $this->helper = $helper;
     $this->productFactory = $productFactory;
     $this->recommnededHelper = $recommended;
     $this->priceHelper = $priceHelper;
 }
Ejemplo n.º 8
0
 public function __construct(\Magento\Catalog\Block\Product\Context $context, \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory, \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, Registry $registry, array $data = [])
 {
     $this->_coreRegistry = $registry;
     $this->_productCollectionFactory = $productCollectionFactory;
     $this->_catalogConfig = $context->getCatalogConfig();
     $this->_catalogProductVisibility = $catalogProductVisibility;
     parent::__construct($context, $data);
 }
Ejemplo n.º 9
0
 /**
  * Retrieve product
  *
  * @return \Magento\Catalog\Model\Product
  */
 public function getProduct()
 {
     $product = parent::getProduct();
     if ($product && $product->getTypeInstance()->getStoreFilter($product) === null) {
         $product->getTypeInstance()->setStoreFilter($this->_storeManager->getStore(), $product);
     }
     return $product;
 }
Ejemplo n.º 10
0
 /**
  * Basket constructor.
  *
  * @param \Magento\Store\Model\App\EmulationFactory $emulationFactory
  * @param \Magento\Quote\Model\QuoteFactory         $quoteFactory
  * @param \Magento\Catalog\Block\Product\Context    $context
  * @param \Dotdigitalgroup\Email\Helper\Data        $helper
  * @param \Magento\Framework\Pricing\Helper\Data    $priceHelper
  * @param array                                     $data
  */
 public function __construct(\Magento\Store\Model\App\EmulationFactory $emulationFactory, \Magento\Quote\Model\QuoteFactory $quoteFactory, \Magento\Catalog\Block\Product\Context $context, \Dotdigitalgroup\Email\Helper\Data $helper, \Magento\Framework\Pricing\Helper\Data $priceHelper, array $data = [])
 {
     $this->_quoteFactory = $quoteFactory;
     $this->helper = $helper;
     $this->priceHelper = $priceHelper;
     $this->_emulationFactory = $emulationFactory;
     parent::__construct($context, $data);
 }
 /**
  * Wishlist constructor.
  *
  * @param \Magento\Wishlist\Model\WishlistFactory $wishlistFactory
  * @param \Magento\Customer\Model\CustomerFactory $customerFactory
  * @param \Magento\Catalog\Block\Product\Context  $context
  * @param \Dotdigitalgroup\Email\Helper\Data      $helper
  * @param \Magento\Framework\Pricing\Helper\Data  $priceHelper
  * @param array                                   $data
  */
 public function __construct(\Magento\Wishlist\Model\WishlistFactory $wishlistFactory, \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Catalog\Block\Product\Context $context, \Dotdigitalgroup\Email\Helper\Data $helper, \Magento\Framework\Pricing\Helper\Data $priceHelper, array $data = [])
 {
     parent::__construct($context, $data);
     $this->wishlistFactory = $wishlistFactory;
     $this->customerFactory = $customerFactory;
     $this->helper = $helper;
     $this->priceHelper = $priceHelper;
 }
Ejemplo n.º 12
0
 /**
  * {@inheritdoc}
  */
 public function getImage($product, $imageId, $attributes = array())
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getImage');
     if (!$pluginInfo) {
         return parent::getImage($product, $imageId, $attributes);
     } else {
         return $this->___callPlugins('getImage', func_get_args(), $pluginInfo);
     }
 }
 public function __construct(\Magento\Quote\Model\QuoteFactory $quoteFactory, \Magento\Catalog\Block\Product\Context $context, \Dotdigitalgroup\Email\Helper\Data $helper, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\Pricing\Helper\Data $priceHelper, \Magento\Framework\ObjectManagerInterface $objectManagerInterface, array $data = [])
 {
     $this->_quoteFactory = $quoteFactory;
     $this->helper = $helper;
     $this->priceHelper = $priceHelper;
     $this->scopeManager = $scopeConfig;
     $this->objectManager = $objectManagerInterface;
     parent::__construct($context, $data);
 }
 /**
  * Order constructor.
  *
  * @param \Magento\Catalog\Model\ResourceModel\Product\Collection $productCollection
  * @param \Magento\Review\Model\ReviewFactory $reviewFactory
  * @param \Magento\Sales\Model\OrderFactory $orderFactory
  * @param \Dotdigitalgroup\Email\Helper\Data $helper
  * @param \Magento\Framework\Pricing\Helper\Data $priceHelper
  * @param \Magento\Catalog\Block\Product\Context $context
  * @param array $data
  */
 public function __construct(\Magento\Catalog\Model\ResourceModel\Product\Collection $productCollection, \Magento\Review\Model\ReviewFactory $reviewFactory, \Magento\Sales\Model\OrderFactory $orderFactory, \Dotdigitalgroup\Email\Helper\Data $helper, \Magento\Framework\Pricing\Helper\Data $priceHelper, \Magento\Catalog\Block\Product\Context $context, array $data = [])
 {
     $this->productCollection = $productCollection;
     $this->reviewFactory = $reviewFactory;
     $this->orderFactory = $orderFactory;
     $this->helper = $helper;
     $this->priceHelper = $priceHelper;
     parent::__construct($context, $data);
 }
 public function __construct(\Dotdigitalgroup\Email\Helper\Data $helper, \Dotdigitalgroup\Email\Helper\Recommended $recommendedHelper, \Magento\Framework\Pricing\Helper\Data $priceHelper, \Magento\Catalog\Block\Product\Context $context, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\ObjectManagerInterface $objectManagerInterface, array $data = [])
 {
     parent::__construct($context, $data);
     $this->helper = $helper;
     $this->_recommendedHelper = $recommendedHelper;
     $this->priceHelper = $priceHelper;
     $this->scopeManager = $scopeConfig;
     $this->storeManager = $this->_storeManager;
     $this->objectManager = $objectManagerInterface;
 }
Ejemplo n.º 16
0
 /**
  * @param \Magento\Catalog\Block\Product\Context $context
  * @param \Magento\Checkout\Model\Session $checkoutSession
  * @param \Magento\Catalog\Model\Product\Visibility $productVisibility
  * @param \Magento\Catalog\Model\Product\LinkFactory $productLinkFactory
  * @param \Magento\Quote\Model\Quote\Item\RelatedProducts $itemRelationsList
  * @param StockHelper $stockHelper
  * @param array $data
  *
  * @codeCoverageIgnore
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function __construct(\Magento\Catalog\Block\Product\Context $context, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Catalog\Model\Product\Visibility $productVisibility, \Magento\Catalog\Model\Product\LinkFactory $productLinkFactory, \Magento\Quote\Model\Quote\Item\RelatedProducts $itemRelationsList, StockHelper $stockHelper, array $data = [])
 {
     $this->_checkoutSession = $checkoutSession;
     $this->_productVisibility = $productVisibility;
     $this->_productLinkFactory = $productLinkFactory;
     $this->_itemRelationsList = $itemRelationsList;
     $this->stockHelper = $stockHelper;
     parent::__construct($context, $data);
     $this->_isScopePrivate = true;
 }
 /**
  * Recentlyviewed constructor.
  *
  * @param \Magento\Catalog\Model\ProductFactory $productFactory
  * @param \Magento\Customer\Model\SessionFactory $sessionFactory
  * @param \Dotdigitalgroup\Email\Helper\Data $helper
  * @param \Magento\Framework\Pricing\Helper\Data $priceHelper
  * @param \Dotdigitalgroup\Email\Helper\Recommended $recommended
  * @param \Magento\Catalog\Block\Product\Context $context
  * @param \Magento\Reports\Block\Product\Viewed $viewed
  * @param array $data
  */
 public function __construct(\Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Customer\Model\SessionFactory $sessionFactory, \Dotdigitalgroup\Email\Helper\Data $helper, \Magento\Framework\Pricing\Helper\Data $priceHelper, \Dotdigitalgroup\Email\Helper\Recommended $recommended, \Magento\Catalog\Block\Product\Context $context, \Magento\Reports\Block\Product\Viewed $viewed, array $data = [])
 {
     parent::__construct($context, $data);
     $this->sessionFactory = $sessionFactory;
     $this->helper = $helper;
     $this->recommnededHelper = $recommended;
     $this->priceHelper = $priceHelper;
     $this->storeManager = $this->_storeManager;
     $this->productFactory = $productFactory;
     $this->viewed = $viewed;
 }
Ejemplo n.º 18
0
 /**
  * Quoteproducts constructor.
  *
  * @param \Magento\Quote\Model\QuoteFactory         $quoteFactory
  * @param \Dotdigitalgroup\Email\Helper\Data        $helper
  * @param \Magento\Catalog\Model\ProductFactory     $productFactory
  * @param \Dotdigitalgroup\Email\Helper\Recommended $recommendedHelper
  * @param \Magento\Framework\Pricing\Helper\Data    $priceHelper
  * @param \Magento\Catalog\Block\Product\Context    $context
  * @param array                                     $data
  */
 public function __construct(\Magento\Quote\Model\QuoteFactory $quoteFactory, \Dotdigitalgroup\Email\Helper\Data $helper, \Magento\Catalog\Model\ProductFactory $productFactory, \Dotdigitalgroup\Email\Helper\Recommended $recommendedHelper, \Magento\Framework\Pricing\Helper\Data $priceHelper, \Magento\Catalog\Block\Product\Context $context, array $data = [])
 {
     parent::__construct($context, $data);
     $this->helper = $helper;
     $this->_productFactory = $productFactory;
     $this->_quoteFactory = $quoteFactory;
     $this->_recommendedHelper = $recommendedHelper;
     $this->priceHelper = $priceHelper;
     //$this->scopeManager = $scopeConfig;
     $this->storeManager = $this->_storeManager;
 }
Ejemplo n.º 19
0
 public function __construct(\Magento\Sales\Model\OrderFactory $orderFactory, \Dotdigitalgroup\Email\Model\Apiconnector\ClientFactory $clientFactory, \Magento\Catalog\Model\ProductFactory $productFactory, \Dotdigitalgroup\Email\Helper\Recommended $recommended, \Dotdigitalgroup\Email\Helper\Data $helper, \Magento\Framework\Pricing\Helper\Data $priceHelper, \Magento\Catalog\Block\Product\Context $context, array $data = [])
 {
     parent::__construct($context, $data);
     $this->_orderFactory = $orderFactory;
     $this->_clientFactory = $clientFactory;
     $this->recommendedHelper = $recommended;
     $this->_productFactory = $productFactory;
     $this->helper = $helper;
     $this->priceHelper = $priceHelper;
     $this->storeManager = $this->_storeManager;
 }
Ejemplo n.º 20
0
 /**
  * Bestsellers constructor.
  *
  * @param \Dotdigitalgroup\Email\Helper\Data                                  $helper
  * @param \Magento\Framework\Pricing\Helper\Data                              $priceHelper
  * @param \Dotdigitalgroup\Email\Helper\Recommended                           $recommended
  * @param \Magento\Framework\Stdlib\DateTime\DateTime                         $dateTime
  * @param \Magento\Catalog\Model\CategoryFactory                              $categoryFactory
  * @param \Magento\Catalog\Block\Product\Context                              $context
  * @param \Magento\CatalogInventory\Model\StockFactory                        $stockFactory
  * @param \Magento\Reports\Model\ResourceModel\Product\Sold\CollectionFactory $productSoldFactory
  * @param array                                                               $data
  */
 public function __construct(\Dotdigitalgroup\Email\Helper\Data $helper, \Magento\Framework\Pricing\Helper\Data $priceHelper, \Dotdigitalgroup\Email\Helper\Recommended $recommended, \Magento\Framework\Stdlib\DateTime\DateTime $dateTime, \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Catalog\Block\Product\Context $context, \Magento\CatalogInventory\Model\StockFactory $stockFactory, \Magento\Reports\Model\ResourceModel\Product\Sold\CollectionFactory $productSoldFactory, array $data = [])
 {
     $this->helper = $helper;
     $this->_dateTime = $dateTime;
     $this->priceHelper = $priceHelper;
     $this->_stockFactory = $stockFactory;
     $this->recommnededHelper = $recommended;
     $this->_categoryFactory = $categoryFactory;
     $this->_productSoldFactory = $productSoldFactory;
     $this->storeManager = $this->_storeManager;
     parent::__construct($context, $data);
 }
 /**
  * Mostviewed constructor.
  *
  * @param \Dotdigitalgroup\Email\Helper\Data                             $helper
  * @param \Magento\Catalog\Block\Product\Context                         $context
  * @param \Magento\Framework\Pricing\Helper\Data                         $priceHelper
  * @param \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory
  * @param \Magento\Catalog\Model\ProductFactory                          $productFactory
  * @param \Dotdigitalgroup\Email\Helper\Recommended                      $recommended
  * @param \Magento\Catalog\Model\CategoryFactory                         $categtoryFactory
  * @param \Magento\Framework\App\ResourceConnection                      $resourceConnection
  * @param \Magento\Reports\Model\ResourceModel\Product\CollectionFactory $reportProductCollection
  * @param array                                                          $data
  */
 public function __construct(\Dotdigitalgroup\Email\Helper\Data $helper, \Magento\Catalog\Block\Product\Context $context, \Magento\Framework\Pricing\Helper\Data $priceHelper, \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory, \Magento\Catalog\Model\ProductFactory $productFactory, \Dotdigitalgroup\Email\Helper\Recommended $recommended, \Magento\Catalog\Model\CategoryFactory $categtoryFactory, \Magento\Framework\App\ResourceConnection $resourceConnection, \Magento\Reports\Model\ResourceModel\Product\CollectionFactory $reportProductCollection, array $data = [])
 {
     $this->coreResource = $resourceConnection;
     $this->productCollectionFactory = $productCollectionFactory;
     $this->productFactory = $productFactory;
     $this->categoryFactory = $categtoryFactory;
     $this->reportProductCollection = $reportProductCollection;
     $this->helper = $helper;
     $this->recommnededHelper = $recommended;
     $this->priceHelper = $priceHelper;
     parent::__construct($context, $data);
 }
 public function __construct(\Magento\Review\Model\ReviewFactory $reviewFactory, \Dotdigitalgroup\Email\Helper\Review $reviewHelper, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Framework\Registry $registry, \Dotdigitalgroup\Email\Helper\Data $helper, \Dotdigitalgroup\Email\Helper\Review $reviewHelper, \Magento\Framework\Pricing\Helper\Data $priceHelper, \Magento\Catalog\Block\Product\Context $context, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\ObjectManagerInterface $objectManagerInterface, array $data = [])
 {
     parent::__construct($context, $data);
     $this->_reviewHelper = $reviewHelper;
     $this->_reviewFactory = $reviewFactory;
     $this->_orderFactory = $orderFactory;
     $this->helper = $helper;
     $this->reviewHelper = $reviewHelper;
     $this->registry = $registry;
     $this->storeManager = $this->_storeManager;
     $this->priceHelper = $priceHelper;
     $this->scopeManager = $scopeConfig;
     $this->objectManager = $objectManagerInterface;
 }
 public function __construct(\Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Catalog\Model\CategoryFactory $categtoryFactory, \Magento\Reports\Model\ResourceModel\Product\CollectionFactory $proudctCollection, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Dotdigitalgroup\Email\Helper\Data $helper, \Magento\Framework\Pricing\Helper\Data $priceHelper, \Dotdigitalgroup\Email\Helper\Recommended $recommended, \Magento\Catalog\Block\Product\Context $context, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Framework\ObjectManagerInterface $objectManagerInterface, array $data = [])
 {
     $this->_productFactory = $productFactory;
     $this->_categoryFactory = $categtoryFactory;
     $this->_productCollection = $proudctCollection;
     $this->helper = $helper;
     $this->recommnededHelper = $recommended;
     $this->priceHelper = $priceHelper;
     $this->_localeDate = $localeDate;
     $this->scopeManager = $scopeConfig;
     $this->storeManager = $this->_storeManager;
     $this->objectManager = $objectManagerInterface;
     parent::__construct($context, $data);
 }
 /**
  * _beforeToHtml method
  *
  * @return $this
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 protected function _beforeToHtml()
 {
     $provider = $this->config->getValue('socialquestions/general/provider');
     if ($provider === 'facebook') {
         $this->setTemplate('facebook.phtml');
     } elseif ($provider === 'disqus') {
         $this->setData('disqusid', $this->config->getValue('socialquestions/general/disqusid'));
         $this->setTemplate('disqus.phtml');
     } else {
         // Remove tab
         $this->getLayout()->unsetElement('socialquestions.tab');
     }
     return parent::_beforeToHtml();
 }
Ejemplo n.º 25
0
 /**
  * Preparing layout
  *
  * @return \Magento\Catalog\Block\Product\Compare\ListCompare
  */
 protected function _prepareLayout()
 {
     $this->pageConfig->getTitle()->set(__('Products Comparison List') . ' - ' . $this->pageConfig->getTitle()->getDefault());
     return parent::_prepareLayout();
 }
Ejemplo n.º 26
0
 /**
  * Add meta information from product to head block
  *
  * @return \Magento\Catalog\Block\Product\View
  */
 protected function _prepareLayout()
 {
     $this->getLayout()->createBlock('Magento\\Catalog\\Block\\Breadcrumbs');
     $product = $this->getProduct();
     if (!$product) {
         return parent::_prepareLayout();
     }
     $title = $product->getMetaTitle();
     if ($title) {
         $this->pageConfig->getTitle()->set($title);
     }
     $keyword = $product->getMetaKeyword();
     $currentCategory = $this->_coreRegistry->registry('current_category');
     if ($keyword) {
         $this->pageConfig->setKeywords($keyword);
     } elseif ($currentCategory) {
         $this->pageConfig->setKeywords($product->getName());
     }
     $description = $product->getMetaDescription();
     if ($description) {
         $this->pageConfig->setDescription($description);
     } else {
         $this->pageConfig->setDescription($this->string->substr($product->getDescription(), 0, 255));
     }
     if ($this->_productHelper->canUseCanonicalTag()) {
         $this->pageConfig->addRemotePageAsset($product->getUrlModel()->getUrl($product, ['_ignore_category' => true]), 'canonical', ['attributes' => ['rel' => 'canonical']]);
     }
     $pageMainTitle = $this->getLayout()->getBlock('page.main.title');
     if ($pageMainTitle) {
         $pageMainTitle->setPageTitle($product->getName());
     }
     return parent::_prepareLayout();
 }
Ejemplo n.º 27
0
 /**
  * @param \Magento\Catalog\Block\Product\Context $context
  * @param \Magento\Framework\Pricing\Helper\Data $pricingHelper
  * @param EncoderInterface $encoder
  * @param array $data
  */
 public function __construct(\Magento\Catalog\Block\Product\Context $context, \Magento\Framework\Pricing\Helper\Data $pricingHelper, EncoderInterface $encoder, array $data = [])
 {
     $this->pricingHelper = $pricingHelper;
     $this->encoder = $encoder;
     parent::__construct($context, $data);
 }
Ejemplo n.º 28
0
 /**
  * Need use as _prepareLayout - but problem in declaring collection from
  * another block (was problem with search result)
  * @return $this
  */
 protected function _beforeToHtml()
 {
     $toolbar = $this->getToolbarBlock();
     // called prepare sortable parameters
     $collection = $this->_getProductCollection();
     // use sortable parameters
     $orders = $this->getAvailableOrders();
     if ($orders) {
         $toolbar->setAvailableOrders($orders);
     }
     $sort = $this->getSortBy();
     if ($sort) {
         $toolbar->setDefaultOrder($sort);
     }
     $dir = $this->getDefaultDirection();
     if ($dir) {
         $toolbar->setDefaultDirection($dir);
     }
     $modes = $this->getModes();
     if ($modes) {
         $toolbar->setModes($modes);
     }
     // set collection to toolbar and apply sort
     $toolbar->setCollection($collection);
     $this->setChild('toolbar', $toolbar);
     $this->_eventManager->dispatch('catalog_block_product_list_collection', ['collection' => $this->_getProductCollection()]);
     $this->_getProductCollection()->load();
     return parent::_beforeToHtml();
 }
Ejemplo n.º 29
0
 /**
  * @param \Magento\Catalog\Block\Product\Context $context
  * @param \Magento\Framework\App\Http\Context $httpContext
  * @param array $data
  */
 public function __construct(\Magento\Catalog\Block\Product\Context $context, \Magento\Framework\App\Http\Context $httpContext, array $data = [])
 {
     $this->httpContext = $httpContext;
     parent::__construct($context, $data);
 }
Ejemplo n.º 30
0
 /**
  * Before rendering html process
  * Prepare items collection
  *
  * @return \Magento\Catalog\Block\Product\ProductList\Crosssell
  */
 protected function _beforeToHtml()
 {
     $this->_prepareData();
     return parent::_beforeToHtml();
 }