Book Image

Magento PHP Developer's Guide

By : Allan MacGregor
Book Image

Magento PHP Developer's Guide

By: Allan MacGregor

Overview of this book

<p>Magento has completely reshaped the face of e-commerce since its launch in 2008. Its revolutionary focus on object oriented and EAV design patterns has allowed it to become the preferred tool for developers and retailers alike.</p> <p>"Magento PHP Developer’s Guide" is a complete reference to Magento, allowing developers to understand its fundamental concepts, and get them developing and testing Magento code.</p> <p>The book starts by building the reader’s knowledge of Magento, providing them with the information, techniques, and tools that they require to start their first Magento development.</p> <p>After building this knowledge, the book will then look at more advanced topics: how to test your code, how to extend the frontend and backend, and deploying and distributing custom modules.</p> <p>"Magento PHP Developer’s Guide" will help you navigate your way around your first Magento developments, helping you to avoid all of the most common headaches new developers face when first getting started.</p>
Table of Contents (16 chapters)
Magento PHP Developer's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

The grid widget


Instead of having to write our own grid blocks from scratch, we can reuse the ones that have been already provided by the Magento Adminhtml module.

The block that we will be extending is called grid widget; the grid widget is a special type of block designed to render a collection of Magento objects in a particular table grid.

A grid widget is normally rendered inside a Grid container; the combination of both elements allow not only to display our data in a grid form but also adds search, filtering, sorting, and mass action capabilities. Perform the following steps:

  1. Navigate to the block Adminhtml/ folder and create a folder called Giftregistry/ at the location app/code/loca/Mdg/Giftregistry/Block/Adminhtml/Customer/Edit/Tab/.

  2. Create a class called List.php inside that folder.

  3. Copy the following code into the Giftregistry/List.php file:

    <?php
    class Mdg_Giftregistry_Block_Adminhtml_Customer_Edit_Tab_Giftregistry_List extends Mage_Adminhtml_Block_Widget_Grid
    {
        public function...