Archives of Uncategorized

Magento 2 Frontend: Adding Javascript and CSS via Layout XML

Layout system critiqued, let’s get back to the practical business of adding a front end file to our Magento module. Before we begin, per pervious articles in this series, the following assumes You’re working with developer mode enabled (SetEnv MAGE_MODE developer in your apache config) That you’ve disabled the full page caching in System -> Cache Management You […]

Working With Models in Magento 2

What Are Models? Models are a flexible, highly abstract class that represents business logic in your application.  Models in Magento 2 can be anything that is packaged up and labeled.  For instance, database tables are representative of models. Magento’s ORM demands that only models can work with data in the application.  Models in the scope of ORM […]

Magento 2: ORM

Magento 2 works in many ways to the Magento 1 ORM structure.  They still have models, resource models, and collections.  There are a few small differences, but the overall structure remains unchanged. Create a Module Create the following folders: app/code/Ecommage/OrmExample/etc/ app/code/Ecommage/OrmExample/Model/ Let’s register our module. In app/code/Ecommage/OrmExample/etc/module.xml, enter the following: <?xml version="1.0"?> <config xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module […]

Magento Mode

Magento has 3 modes when running. To show the current mode, we can use this command: $ php bin/magento deploy:mode:show After running this command, we will se the current mode that we are using:   You can run Magento in any of the following modes: default Enables you to deploy the Magento application on a single […]

PHP Primer: Namespaces

After spending a bit of time poking around a Magento 1 codebase, I was reminded that Magento 2 is going to be some developer’s first major experience with PHP namespaces. Beyond Magento, many PHP systems still live in a namespaceless world, and other systems do their best to shield developers from needing to understand namespaces. […]