Magento Codepools

codepool

The Magento application contains 3 codepools. Core is reserved for the base classes written by the Core Magento developers. When you want to extend or change the functionality of these classes, you do so by over-riding these classes in your code located in one of the other 2 codepools. Changes to code should never be made in the Core codepool because they may be lost when Magento is upgraded. The Community code pool is where third-party modules, such as the ones downloaded from Magento Connect, can be found. The Local codepool is where any other kind of modification, extension or core (or community) overrides should take place. The Local code pool is loaded first and is the place for changes that need to be made to a specific site or to modify/extend/override what is in the Core or Community codepool.

codepoolconfigDuring the bootstrap, Magento first checks the local codepool for include files, then checks community, and then core. Magento reads a module’s configuration file, looking in the block, to notify the system where to find module code. The module’s configuration file is located in /app/etc/modules.
codepoolconfigfileloc

/app/Mage.php defines the pathing for the three code pools.

Magento Stuck in Maintenance Mode

Sometimes when you install an extension and go to your Magento site you get a 503 error with a message saying your system is in maintenance mode. Often times the culprit is a file called maintenance.flag which should have deleted during installation and didn’t. Browse to your root Magento folder and delete that file. Voila! Magento is up and running again.

Texas Chili

Texas Chili

It’s the Fourth of July, and what better way to celebrate than with some good ole Texas Chili!

Cubed SirloinCovered with TomatoAfter Cooking a Bit

In a cast iron skillet, brown some cubed sirloin in a little bit of bacon grease. Cover with diced tomatoes and sauce and boil until the tomatoes stop foaming. The acid from the tomatoes will start to break down and soften the meat. Add some fresh tomatoes, onions (I use yellow), and as many different peppers as you can find in your store and cook at a near boil until the fresh veggies are soft and the onions are translucent. Add in a mix of chili powder, ground cumin, ground oregano, salt and pepper and a can of tomato paste and simmer until at least half the meat has nearly disintegrated, and voila! it’s chili.

The VeggiesCooking the Veggies DownChili Spices

For the 5 pounds of meat I had to work with, I used 2 one pound cans of diced tomatoes, a can of water, 4 ancho peppers, one jalapeno, three fresh tomatoes, 2 vidalia onions, about 3/4 cup of chili powder, a spice jar lid of cumin, half a spice jar lid of ground oregano, a spice jar lid of paprika, and a healthy pinch of cayenne. Salt and pepper to taste. If you’re not worried about carbs, add a can or two of Ranch-Style Beans. The only peppers I could find were fresh anchos and jalepenos. I would have loved some of those red, sun-dried ancho peppers also to give it a little more smokey flavor, but alas, here in Yankee-land they are scarce.

Halfway Finished

I serve topped with a healthy dollop of sour cream and shredded orange cheese.

 

Tomato and Cucumer Salad

Campari Tomatoes and CucumbersTasty IngredientsI had some lovely Campari tomatoes and cucumbers. Cube the cucumbers with half a Vidalia onion, salt, and soak in white vinegar for a few minutes. While soaking the cucumbers, cut the tomatoes into 8ths. You should have about a handful of diced onion and equal parts tomato and cucumber when finished with the veggie prep.

Tomato Cucumber Salad

Put the tomatoes in the bowl with the cucumbers and onions, and add a quick chiffonade of a bunch of fresh basil. Drizzle with olive oil and balsamic vinegar, and add a pinch of salt. Stir and refrigerate for a few hours. Serve on a bed of baby spinach and arugula dressed with balsamic vinaigrette and top with crumbled feta and Kalamata olives or eat as is. Delicious!

 
A Great Meal
 

 

Commonly Used Core Magento Block Types

The most commonly used core block types used in Magento layouts

  • core/template: This block renders a template defined by its template attribute. The majority of blocks defined in the layout are of type or subtype of core/template.
  • page/html: This is a subtype of core/template and defines the root block. All other blocks are child blocks of this block.
  • page/html_head: Defines the HTML head section of the page which contains elements for including JavaScript, CSS etc.
  • page/html_header: Defines the header part of the page which contains the site logo, top links, etc.
  • page/template_links: This block is used to create a list of links. Links visible in the footer and header area use this block type.
  • core/text_list: Some blocks like content, left, right etc. are of type core/text_list. When these blocks are rendered, all their child blocks are rendered automatically without the need to call thegetChildHtml() method.
  • page/html_wrapper: This block is used to create a wrapper block which renders its child blocks inside an HTML tag set by the action setHtmlTagName. The default tag is <div> if no element is set.
  • page/html_breadcrumbs: This block defines breadcrumbs on the page.
  • page/html_footer: Defines footer area of page which contains footer links, copyright message etc.
  • core/messages: This block renders error/success/notice messages.
  • page/switch: This block can be used for the language or store switcher.

Insert blocks into the config file with this syntax:

<block type=”page/html” name=”root” output=”toHtml” template=”example/view.phtml”>

where type indicates where in your layout the block will be drawn

 

Hello world!

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!

The Magento Module

module-structureMagento is a shopping cart application written in PHP with an MVC style architecture. Model-View-Controller applications aim to separate the representation of information contained in the database from the presentation of that information to the user. This architecture pattern leads to increased reuse of code within an application, simplification of design, and ease in maintenance (separation of concerns). The model contains business rules, application data, logic, and functions. The view generates the display of the application data to the user. The controller passes information between the view and the model. Each model in the application separates an area of functionality from others.

To extend the functionality in your Magento, you can create custom modules to do nearly anything you desire. Your custom changes should *never* be placed in the core code so you don’t lose them when you upgrade. Magento contains 3 code pools (groups of modules): core, community, and local. Your modules should be placed in community (if developing for use on multiple magento instances) or local (if developing for your single magento installation).

Namespace refers to a folder used to group similar modules together. What you place in your custom module can override what is in the core or can extend the core with altogether new functionality.

module-structureA module can consist of the following components:

  • Block – contains the layout information
  • Models – implement business logic
  • Resource Models – provide an access layer to data for the extension
  • Controllers – contain methods called actions which process web server requests that correspond to the module
  • Configuration – module-specific XML config files which tell Magento how this module interacts with it
  • Helpers – auxillary classes that implement commonly used business logic – forms, validators, formatters, formatters, etc
  • Schema SQL Scripts – the SQL scripts that implement schema changes for the module
  • Data SQL scripts – scripts which manipulate the data for the SQL schema of the module. NOTE: difference between Enterprise and Community Editions.