How to check given folder contains Files in Magento 2?

Magento 2, You can check the given folder path contains the file or not using the isFile() method.

For example, You have an image inside the pub/media folder with path,
$imagePath = ‘/catalog/product/placeholder/default/coming-soon.jpg’;

You can see a placeholder image at the above location in the media folder. Continue reading “How to check given folder contains Files in Magento 2?”

Get Base Url in Model or Plugin file Magento 2.

You can get the base URL of the store in the controller file using Store Manager Interface.

To Retrieve the Base URL of the current store, You need to instantiate constructor in your controller file,

Check below code snippet for getting base URL, Continue reading “Get Base Url in Model or Plugin file Magento 2.”

Disable Native Contact us page Magento 2.

You can stop/disable the contact us page in Magento 2 using store configuration settings.

By default, the Contact page is enabled and you can check the contact us page using URL, <SITE_URL>/contact

If you want to modify or change the contact us page with your custom contact page, you can disable the Contact page using the below settings.

Contact Us Page Scope is Store Level, You can Enable the contact us page at one store and disable it on another store based on your settings.

Continue reading “Disable Native Contact us page Magento 2.”