0

I need to show all the newly created products on top. So need to arrange all the products according entity id in descending order

  • Please, show your collection? – Khoa TruongDinh Jun 6 at 9:33
  • what do you mean by "product page"? the admin grid? the category in the storefront? – Philipp Sander Jun 6 at 9:36
  • sorry it was category page on frontend – twinkle_systematix Jun 6 at 11:08
0

Easiest and cleanest solution would be creating an "afterPlugin" on \Magento\Catalog\Model\Config\Source\ListSort::toOptionArray and adding $options[] = ['label' => __('Entity ID'), 'value' => 'entity_id'];

Once you did this, you can select the value in "Configuration -> Catalog -> Catalog -> Product Listing Sort by" to apply it to all categories by default.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.