@@ -43,24 +43,24 @@ class ProductsList extends AbstractProduct implements BlockInterface, IdentityIn
4343 /**
4444 * Default value for products count that will be shown
4545 */
46- const DEFAULT_PRODUCTS_COUNT = 10 ;
46+ public 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- const PAGE_VAR_NAME = 'np ' ;
53+ public const PAGE_VAR_NAME = 'np ' ;
5454
5555 /**
5656 * Default value for products per page
5757 */
58- const DEFAULT_PRODUCTS_PER_PAGE = 5 ;
58+ public const DEFAULT_PRODUCTS_PER_PAGE = 5 ;
5959
6060 /**
6161 * Default value whether show pager or not
6262 */
63- const DEFAULT_SHOW_PAGER = false ;
63+ public const DEFAULT_SHOW_PAGER = false ;
6464
6565 /**
6666 * Instance of pager block
@@ -75,15 +75,11 @@ class ProductsList extends AbstractProduct implements BlockInterface, IdentityIn
7575 protected $ httpContext ;
7676
7777 /**
78- * Catalog product visibility
79- *
8078 * @var Visibility
8179 */
8280 protected $ catalogProductVisibility ;
8381
8482 /**
85- * Product collection factory
86- *
8783 * @var CollectionFactory
8884 */
8985 protected $ productCollectionFactory ;
@@ -338,12 +334,12 @@ public function createCollection()
338334 $ collection ->setVisibility ($ this ->catalogProductVisibility ->getVisibleInCatalogIds ());
339335
340336 /**
341- * Change sorting attribute to entity_id because created_at can be the same for products fastly created
337+ * Change sorting attribute to position because created_at can be the same for products fastly created
342338 * one by one and sorting by created_at is indeterministic in this case.
343339 */
344340 $ collection = $ this ->_addProductAttributesAndPrices ($ collection )
345341 ->addStoreFilter ()
346- ->addAttributeToSort ('entity_id ' , 'desc ' )
342+ ->addAttributeToSort ('position ' , 'asc ' )
347343 ->setPageSize ($ this ->getPageSize ())
348344 ->setCurPage ($ this ->getRequest ()->getParam ($ this ->getData ('page_var_name ' ), 1 ));
349345
0 commit comments