@@ -43,24 +43,24 @@ class ProductsList extends AbstractProduct implements BlockInterface, IdentityIn
4343 /**
4444 * Default value for products count that will be shown
4545 */
46- public const DEFAULT_PRODUCTS_COUNT = 10 ;
46+ const DEFAULT_PRODUCTS_COUNT = 10 ;
4747
4848 /**
4949 * Name of request parameter for page number value
5050 *
5151 * @deprecated @see $this->getData('page_var_name')
5252 */
53- public const PAGE_VAR_NAME = 'np ' ;
53+ const PAGE_VAR_NAME = 'np ' ;
5454
5555 /**
5656 * Default value for products per page
5757 */
58- public const DEFAULT_PRODUCTS_PER_PAGE = 5 ;
58+ const DEFAULT_PRODUCTS_PER_PAGE = 5 ;
5959
6060 /**
6161 * Default value whether show pager or not
6262 */
63- public const DEFAULT_SHOW_PAGER = false ;
63+ const DEFAULT_SHOW_PAGER = false ;
6464
6565 /**
6666 * Instance of pager block
@@ -75,11 +75,15 @@ class ProductsList extends AbstractProduct implements BlockInterface, IdentityIn
7575 protected $ httpContext ;
7676
7777 /**
78+ * Catalog product visibility
79+ *
7880 * @var Visibility
7981 */
8082 protected $ catalogProductVisibility ;
8183
8284 /**
85+ * Product collection factory
86+ *
8387 * @var CollectionFactory
8488 */
8589 protected $ productCollectionFactory ;
@@ -235,8 +239,8 @@ public function getCacheKeyInfo()
235239 */
236240 public function getProductPriceHtml (
237241 Product $ product ,
238- $ priceType = null ,
239- $ renderZone = \Magento \Framework \Pricing \Render::ZONE_ITEM_LIST ,
242+ $ priceType = null ,
243+ $ renderZone = \Magento \Framework \Pricing \Render::ZONE_ITEM_LIST ,
240244 array $ arguments = []
241245 ) {
242246 if (!isset ($ arguments ['zone ' ])) {
@@ -334,12 +338,12 @@ public function createCollection()
334338 $ collection ->setVisibility ($ this ->catalogProductVisibility ->getVisibleInCatalogIds ());
335339
336340 /**
337- * Change sorting attribute to position because created_at can be the same for products fastly created
341+ * Change sorting attribute to entity_id because created_at can be the same for products fastly created
338342 * one by one and sorting by created_at is indeterministic in this case.
339343 */
340344 $ collection = $ this ->_addProductAttributesAndPrices ($ collection )
341345 ->addStoreFilter ()
342- ->addAttributeToSort ('position ' , 'asc ' )
346+ ->addAttributeToSort ('entity_id ' , 'desc ' )
343347 ->setPageSize ($ this ->getPageSize ())
344348 ->setCurPage ($ this ->getRequest ()->getParam ($ this ->getData ('page_var_name ' ), 1 ));
345349
0 commit comments