72 $productCollectionFactory,
73 $catalogProductVisibility,
95 $collection = $this->_getRecentlyAddedProductsCollection();
106 protected function _getRecentlyAddedProductsCollection()
109 $collection = $this->_productCollectionFactory->create();
110 $collection->setVisibility($this->_catalogProductVisibility->getVisibleInCatalogIds());
114 ->addAttributeToSort(
'created_at',
'desc')
138 parent::getCacheKeyInfo(),
143 $this->serializer->serialize($this->getRequest()->getParams())
155 if (!$this->
hasData(
'display_type')) {
156 $this->
setData(
'display_type', self::DISPLAY_TYPE_ALL_PRODUCTS);
158 return $this->
getData(
'display_type');
168 if (!$this->
hasData(
'products_count')) {
169 return parent::getProductsCount();
171 return $this->
getData(
'products_count');
181 if (!$this->
hasData(
'products_per_page')) {
182 $this->
setData(
'products_per_page', self::DEFAULT_PRODUCTS_PER_PAGE);
184 return $this->
getData(
'products_per_page');
194 if (!$this->
hasData(
'show_pager')) {
195 $this->
setData(
'show_pager', self::DEFAULT_SHOW_PAGER);
197 return (
bool)$this->
getData(
'show_pager');
218 if (!$this->_pager) {
219 $this->_pager = $this->
getLayout()->createBlock(
221 'widget.new.product.list.pager' 224 $this->_pager->setUseContainer(
true)
225 ->setShowAmounts(
true)
226 ->setShowPerPage(
false)
227 ->setPageVarName($this->
getData(
'page_var_name'))
230 ->setCollection($this->getProductCollection());
233 return $this->_pager->toHtml();
249 public function getProductPriceHtml(
272 $priceRender = $this->
getLayout()->getBlock(
'product.price.render.default');
276 $price = $priceRender->render(
getData($key='', $index=null)
_addProductAttributesAndPrices(\Magento\Catalog\Model\ResourceModel\Product\Collection $collection)