Get Placeholder image url in Magento 2.

Native Magento 2 has four types of placeholder image called, small_image, image, thumbnail, and swatch_image.

Placeholder image URL used when you want to display default images for a site.
Magento 2 get placeholder image URL using below simple code snippet. Continue reading “Get Placeholder image url in Magento 2.”

Magento 2 display out of stock products at the end of the list page.

You can display out of stock product at end of catalog page in Magento 2 using just simple way. All the Out of stock product will be displayed at end of listing page.

You need to create module for display out of stock product at end of the page.

Create registration.php and module.xml file for creating a module. I hope you have created both file for define module,

For Collection of product generate fromĀ Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection file. We need to create a plugin for load() function. we need to set our custom condition for out of stock product to beforeLoad() function.

Create a di.xml file,

Path, app/code/Rbj/OutOfStock/etc/di.xml

Need to override Stock.php file fromĀ Magento\CatalogInventory\Helper\Stock class.

Create Toolbar.php file, File Path, app/code/Rbj/OutOfStock/Plugin/Product/ProductList/Toolbar.php

Clear Cache and Check in front. All the Out of stock product will display at end of listing page.