Tag: magento 2

  • Creating Your First PHTML Template in Minutes

    Creating Your First PHTML Template in Minutes

    Magento uses the .phtml extension for template files, which are PHP files primarily used to output HTML. Magento’s PHTML format includes syntactic sugar for rendering logic like loops and conditionals, making it easier to integrate PHP logic in these templates. Template File Location Magento modules store presentational layer files in the view directory. Depending on…

  • Level Up Your Magento Code with Class Preferences (No More Spaghetti!)

    Level Up Your Magento Code with Class Preferences (No More Spaghetti!)

      In Magento 2, managing dependencies between different parts of your code is crucial. This lesson will show you how to use XML to define class preferences, a powerful technique for achieving loose coupling and promoting code flexibility. What are Class Preferences? Imagine you have an interface called CategoryInterface that outlines methods for interacting with…

  • Unlocking The Power Of Interfaces In Magento 2!

    Unlocking The Power Of Interfaces In Magento 2!

    Interfaces play a vital role in Magento 2 development. Here’s why: Abstraction: They decouple your code from concrete implementations, making it more flexible and adaptable to changes. Extensibility: Interfaces promote modularity, allowing third-party developers to extend or modify functionality without affecting your core code. Testability: Interfaces make it easier to write unit tests by allowing…

  • How to check Magento 2 version

    How to check Magento 2 version

    There´s many Magento 2 versions and editions. Sometimes you need to know, which exactly version of Magento you´re running – for example, for planning upgrade. Here is a few tricks, which will show your actual version of Magento 2. Special Magento 2 version page The simplest way to know, which version you are running without…

  • Constructor Property Promotion

    Constructor Property Promotion

    With the advent of Magento 2.4.4 and subsequent versions embracing PHP 8, we’re poised to leverage the innovative constructor property promotion feature introduced in PHP 8. This powerful feature streamlines our coding efforts significantly. Traditionally, the practice involved declaring a class property separately and then initializing it within the constructor. Constructor property promotion elegantly condenses…

  • Magento 2 Dependency Injection

    Magento 2 Dependency Injection

    Dependency injection: Hey everyone, and welcome to my channel! Today, we’re diving into the world of Magento 2, and specifically, we’ll be exploring a powerful design pattern called dependency injection. But before we jump in, let’s imagine you’re baking a cake. You need ingredients, right? Flour, sugar, eggs… the list goes on. Instead of running…

  • Create a Magento Controller

    Create a Magento Controller

    How to Create a Magento Controller As we discuss in the previous lesson the Controller consist of two parts controllerName and actionName We will create new controller under Kickstart folder Controller/Index/Index.php and we will use predefined template to create our controller For now, we will just use the die() function to output some text to make sure…

  • Magento’s MVC & Routing Mechanism

    Magento’s MVC & Routing Mechanism

    Hello everyone Detailed Look at Magento’s URL Anatomy When you look at a URL for any Magento page, you might see a URL like https://magento.dev/customer/account/create. Magento follows a Model-View-Controller design pattern, also known as MVC. The Controller part of that pattern in Magento follows a very structured format, as each of the parts of the URL…

  • Create new module

    Create new module

    Hello everyone In this lesson we will know how to create new Magento module Magento Module Naming Convention The naming conventions for modules in Magento are straightforward. A module name consists of two parts, a “Vendor” name and a “Module” name. Step 1: Name your module In this course, we’ll use the Itcforu vendor name and the KickStart module…

  • Magento 2: Create new admin user using command line

    Magento 2: Create new admin user using command line

    Magento 2 Create new admin user using command line