Page 68 of 69

Magento 2 – How to add calendar in admin configuration options?

Recently I have found one solution to add calendar in system configuration options. Lets discuss in detail. In order to add calendar in system configuration options, we have to add one system field and require one Block file. Use below code to add system field. <field id=”startdate” translate=”label” type=”text” sortOrder=”20″ showInDefault=”1″ showInWebsite=”1″ showInStore=”1″> <label>Start Date</label>…

How to get current CMS page id in Magento2

To get the id of current CMS page in Magento 2, use the following code snippet. protected $_page; public function __construct( … \Magento\Cms\Model\Page $page, … array $data = [] ) { parent::__construct($context, $data); … $this->_page = $page; … } if ($this->_page->getId()) { $pageId = $this->_page->getId(); } There are so many other methods to get CMS…

Magento 2 – How to add WYSIWYG editor in admin configuration options?

In this blog post, we learn how to add WYSIWYG editor with textarea in admin system configuration options. First we will add one system config field in system.xml file. Use below code to add new field with the type Editor. <field id=”editortextarea” translate=”label” type=”editor” sortOrder=”10″ showInDefault=”1″ showInWebsite=”1″ showInStore=”1″> <label>Textare with WYSIWYG</label> <frontend_model>Hiddentechies\ConfigEditor\Block\Adminhtml\System\Config\Editor</frontend_model> </field> In order…

How to get parent product id in Magento 2?

As you know when we works with any customization work related to configurable product and simple product, we need some code snippet that helps us to find out the relation between parent and child product. Lets take one example, when we have one simple product (child product) and we need all the simple (child) product…

Magento 2 – Get current logged in customer details

In this blog post, we will see how to retrieve currently logged in customer details in Magento 2. We can retrieve the currently logged in customer details using an instance of \Magento\Customer\Model\Session model through constructor. After initialization of model instant, we need to store instantiated object into protected variable like $customerSession. Session model contains so…

How to Enable Maintenance Mode in Magento 2

In this post we will get the knowledge about how to enable Maintenance Mode in Magento 2 store so your visitors know that you’re working on your website. Magento uses maintenance mode while you’re maintaining, upgrading, or reconfiguring your site. In order to put your Magento 2 store in maintenance mode, you need to create…

How to check if customer is logged in or not in Magento 2?

As we know, there are so many situation where we require to check whether customer is currently logged in or not. In this blog post you will learn about how to check customer is logged in or not in Magento 2. In order to check this situation you can use below code snippet. /** @var…

Magento 2 – How to Reindex using Command line

In Magento 1.x, store owner can directly do reindex from Index management. But in Magento 2.x there is no direct options available for Reindex from backend. As Magento 2.x provides reindex using command line. So lets discuss about how to do reindex using command line. If you need to do whole index management in the…

Magento – How to show 4 products per row on category page?

Magento by default provides us a very good template for displaying different different pages. It also provides variety of layout files to display different pages with different different layouts. But for our convenience we need to do some modifications in the default layout of magento. One of the most common issue for product display is…

Magento – Disable Admin Notification Popup

Every time you log in to the Magento Admin Panel, you will see an admin magento notification popop message. From the developer point of view, it’s best way to stay informed about new updates. But end client never like these pop up on every login about which they don’t know anything. In this post I…

« Older posts Newer posts »