magento2

How to create custom product attribute using Data Patch in Magento 2

Check if customer logged using HttpContext in Magento 2

4 years ago
Usually, we can check whether a customer is logged in via the Customer Session (Magento\Customer\Model\Session) class. Sometimes when a full-page cache is enabled, the generic class will not work as per our expectation. So in that case we can use HttpContext (Magento\Framework\App\Http\Context) class to check whether a customer is logged in or not. HttpContext class […]
Read More

Custom attributes with and without getCustomAttributes() method in Magento 2

4 years ago
Custom Attributes are the attributes that we can add with customized sources of available data types. In short, we can add Custom Attributes not available in built-in Magento. The Customer and Catalog entities use EAV entities and CustomAttributesDataInterface defines getCustomAttributes() and setCustomAttributes() methods. In this blog, we are getting an idea of how we can […]
Read More

Declarative Schema in Magento 2

4 years ago
Declarative schema is a new concept introduced in Magento 2.3. It makes the smooth process of database schema operations with fewer coding and execution steps. Before Magento 2.3, the following script files are used in the Setup directory of the module to perform DB management: InstallSchema.php: runs script when module is installed to the setup […]
Read More

Check if customer is logged in using js component – Magento2

4 years ago
Easy way to check whether customer logged in or not via customer Js component in phtml file. <div data-bind="scope: 'customer'"> <!-- ko if: customer().fullname --> Logged In customer <!-- /ko --> <!-- ko ifnot: customer().fullname --> Notlogged In customer <!-- /ko --> </div> <script type="text/x-magento-init"> { "*": { "Magento_Ui/js/core/app": { "components": { "customer": { "component": […]
Read More

Create your account

chatsimple