Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

NetTuts.com:
Understand Overriding in Magento: Controllers
Jul 24, 2015 @ 16:19:45

The NetTuts.com site has posted a tutorial (the third and last in their series) showing how to override controller handling in Magento. In the previous posts they showed how to override functionality related to the models and blocks (frontend layout elements).

In Magento, the controller is responsible for handling incoming requests, and it's a backbone of the Magento routing implementation. [...] As I said in the previous tutorial, it's never recommended to change core files directly, as it makes upgrading Magento really difficult. To avoid this, we should follow the standard way of making desired changes to core files: we should either use event observers or override core files with our custom module files. We'll discuss the overriding feature today.

You'll need to be familiar with custom module creation to be able to follow along (see here if not) but other than that they provide everything you'll need. They start by creating the files and folders needed for the custom module including:

  • Module XML definition (Envato_All.xml)
  • Module XML configuration
  • the Envato_Catalog_ProductController controller file (PHP)

The controller extends the pre-existing Product controller but the configuration definitions tell it ti use the "Envato" version instead.

tagged: magento overriding controller tutorial custom xml module

Link: http://code.tutsplus.com/tutorials/understand-overriding-in-magento-controllers--cms-23386

PHPro.org:
Class Hierachies And Overriding
Nov 20, 2008 @ 14:46:47

The PHPro.org website has this new tutorial posted today - a step further into the would of OOP in PHP with a look at abstraction, hierarchies and polymorphism.

The PHP Object Oriented method of programming brings many exciting possibilities to application code. Many of the theories surrounding PHP Object Oriented code comes from some simple concepts. To the new comer, some of these concepts seem a little abstract, and with good reason. Abstraction is a key concept on Object Oriented code, but to the un-initiated, may seem rather vague.

Kevin looks at creating abstract classes as a foundation for types other classes can work from, overriding built in classes (like extending the DirectoryIterator to make a DirectoryReader class).

tagged: class hierarchies overriding tutorial abstraction ploymorphism

Link:


Trending Topics: