Magento PHP Developer’s Guide
Formats:

save 15%!
save 37%!

Also available on: |
![]() ![]() ![]() ![]() ![]() |
- Build your first Magento extension, step by step
- Extend core Magento functionality, such as the API
- Learn how to test your Magento code
Book Details
Language : EnglishPaperback : 256 pages [ 235mm x 191mm ]
Release Date : April 2013
ISBN : 1782163069
ISBN 13 : 9781782163060
Author(s) : Allan MacGregor
Topics and Technologies : All Books, Web Development, e-Commerce, Open Source, PHP
Table of Contents
PrefaceChapter 1: Understanding and Setting Up Our Development Environment
Chapter 2: Magento Fundamentals for Developers
Chapter 3: ORM and Data Collections
Chapter 4: Frontend Development
Chapter 5: Backend Development
Chapter 6: The Magento API
Chapter 7: Testing and Quality Assurance
Chapter 8: Deployment and Distribution
Appendix: Hello Magento
Index
- Chapter 1: Understanding and Setting Up Our Development Environment
- LAMP from scratch
- Getting VirtualBox
- Booting our virtual machine
- Installing Apache2
- Installing PHP
- Installing MySQL
- Putting everything together
- Up and running with Vagrant
- Installing Vagrant
- Choosing an IDE
- Working with a version control system
- Summary
- Chapter 2: Magento Fundamentals for Developers
- Zend Framework – the base of Magento
- Magento folder structure
- Modular architecture
- Autoloader
- Code pools
- Routing and request flow
- Magento version of MVC
- Models
- Views
- Dissecting a layout file
- Controllers
- Websites and store scopes
- Factory names and functions
- Events and observers
- Event dispatch
- Observer bindings
- Summary
- Chapter 3: ORM and Data Collections
- Magento Model Anatomy
- It's magic – methods
- EAV Model
- What is EAV?
- Retrieving the data
- Working with Magento collections
- Get product collection only from a specific category
- Get new products added since X date
- Get Bestseller products
- Filter product collection by visibility
- Filter products without images
- Add multiple sort orders
- Using Direct SQL
- Reading
- Writing
- Summary
- Chapter 4: Frontend Development
- Extending Magento
- Scenario
- Features
- Further improvements
- Hello Magento
- XML module configuration
- Models and saving data
- Creating the models
- Setup resources
- Defining a setup resource
- Creating the Installer Script
- What have we learned?
- Setting up our routes
- The index controller
- The search controller
- The view controller
- Block and layouts
- IndexController blocks and views
- SearchController blocks and views
- ViewController block and views
- Adding products to the registry
- Summary
- Chapter 5: Backend Development
- Extending the Adminhtml
- Back to the configuration
- The grid widget
- Managing the registries
- Permissions and the ACL
- Updating in bulk with Massactions
- The form widget
- Loading the data
- Saving the data
- Summary
- Chapter 6: The Magento API
- The Core API
- XML-RPC
- SOAP
- RESTful API
- Using the API
- Setting up the API credentials for XML-RPC/SOAP
- Setting up the REST API credentials
- Loading and reading data
- Updating data
- Deleting a product
- Extending the API
- Extending the REST API
- Securing the API
- Summary
- Chapter 7: Testing and Quality Assurance
- Testing Magento
- Unit testing
- Regression testing
- Functional tests
- TDD
- Tools and testing frameworks
- Unit testing with PHPUnit
- Installing Ecomdev_PHPUnit
- Setting up the configuration for our extension
- Anatomy of a Test case
- Creating a unit test
- Functional tests with Mink
- Magento Mink installation and setup
- Creating our first test
- Summary
- Chapter 8: Deployment and Distribution
- The road towards zero-downtime deployment
- Make it right from scratch
- Be sure that what you see is what you get
- Ready means ready
- Version control system and deployment
- SVN
- Git
- Distribution
- Packing our extension
- Package Info
- Release Info
- Authors
- Dependencies
- Contents
- Load Local Package
- Publishing our extension
- Summary
- Appendix: Hello Magento
- The configuration
- The controller
- Testing the route
Allan MacGregor
"Magento PHP Developer's Guide" is a unique tutorial helping out new developers to avoid many of the headaches that most of them had to suffer when starting out. - Anastasia Harlamova
This is a great book for getting started with Magento module development and will be a handy reference for any Magento developer. - Robert Popovic
Code Downloads
Download the code and support files for this book.
Submit Errata
Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.
Errata
- 20 submitted: last submission 05 Jun 2014Page No.: 108 | Errata type: Code
In the "Index Controller" Section the file name should be IndexController.php instead of Index.php. Otherwise the autoloader will not find it.
Readers can also find the solutions for their errata at http://magedevguide.com/errata
Page No.: 25 | Errata Type: Technical
Under the definition for merging towards the top of the page, the second sentence should use branch instead of brand.
Page No.: 30 | Errata Type: Typo
There is an extra "the" under the third bullet point for "Controller"
It should be "The classes in this folder are meant to be abstract classes and extended by the controller class under the controllers folder"
Page No.: 40 | Errata type: Technical
Second bullet point should say "groups" not "group" since there is no "group" node in the provided code sample.
Page No.: 29 | Errata type: technical
The image at the bottom shows a typical Magento module folder structure. It should folder name as "Controllers" with a capital "C". It should be "controllers"
Page No.: 79 | Errata Type: Code
The second code snippet, 1st line of code says:
$productCollection->addAttributeToFilter('small_image', array('notnull'=>'','neq'=>'no_selection'));
should be
$productCollection->addAttributeToFilter('small_image', array('notnull'=>'','neq'=>'no_selection'))
There should be no semi colon at the end of the code line.
Page No.: 96 | Errata Type: Code
At the bottom of the page, bullet point 3:
app/code/local/Mdg/Giftregistry/Model/Entity.php
should be
app/code/local/Mdg/Giftregistry/etc/config.xml
Errata type: Typo | Page number: 92
In the bottom section the second step:
Create a new file called Type.php and copy the following content into the file (the file location is app/code/local/Mdg/Giftregistry/Model/Mysql4/ Type/Collection.php):
should be:
Create a new file called Collection.php and copy the following content into the file (the file location is app/code/local/Mdg/Giftregistry/Model/Mysql4/ Type/Collection.php):
Errata type: Code | Page number: 144
The first bullet states the location of the main.phtml template as:
app/design/adminhtml/default/default/template/customer/.
The location should read:
app/design/adminhtml/default/default/template/mdg/giftregistry/customer/
Errata type: Code | Page number: 81
In the section "Using Direct SQL", under "Reading" subsection, the description of `fetchOne` is incorrect
Quoting the source code's phpdoc at lib/Varien/Db/Interface.php, `fetchOne` fetches the first column of the first row of the SQL result.
Errata type: Code | Page number: 125
The edit.phtml file is like this:
<input type="hidden" id="type_id" value="<?php echo
$loadedRegistry->getTypeId(); ?>" />
This field will not be posted without a name. If you update the edit.phml file like this it works:
<input type="hidden" name="type_id" id="type_id" value="<?php echo
$loadedRegistry->getTypeId(); ?>" />
<input type="hidden" name="registry_id" id="registry_id"
value="<?php echo $loadedRegistry->getEntityId(); ?>" >
Errata type: Code | Page number: 125
At the bottom of the page there is a table with function can also be written as:
getModel()
|
getModelInstance()
|
getModelClassName()
|
getGroupedClassName()
Errata type: Code | Page no: 82
The line: $read = $resource->getConnection('core_write);
Should read: $write = $resource->getConnection('core_write');
Errata type: Code | Page no: 113
The line: if($this->getRequest()->getPosts() && !empty($data))
Should be: if($this->getRequest()->getPost()&& !empty($data))
Errata type: Technical | Page number: 143
It reads: "We are setting the gridId; the default sort to be by eventDate, and we are enabling pagination and filtering."
Should be: "We are setting the gridId; the default sort to be by eventDate, and we are disabling pagination and filtering."
Errata type: Code | Page number: 129
The line: if ($searchParams = $this->getRequest()->getParam('search_params'))
Should be: if ($searchParams = $this->getRequest()->getParam())
The line: $this->getLayout()->getBlock('mdg_giftregistry.search.results')
Should be: $this->getLayout()->getBlock('giftregistry.results')
Errata type: Code | Page number: 119
The following step:
3. Add the following code inside the node (the file location is app/design/frontend/base/default/layout/mdg_giftregistry.xml)
Should be:
3. Add the following code inside the node (the file location is app/code/local/Mdg/Giftregistry/etc/config.xml)
Errata type: Code | Page number: 112
Errata type: Code | Page number: 114
Sample chapters
You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.
- Understand the fundamental concepts of Magento
- Deploy and distribute custom modules
- Explore development techniques and tools for Magento
- Extend Magento core functionality
- Discover the design patterns which form Magento
- Understand Magento architecture
- Test Magento with different tools and frameworks
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.
"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.
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.
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.
"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.
"Magento PHP Developer’s Guide" is an easily accessible tutorial, designed and written to give the reader maximum understanding of the powerful Magento framework.
This book is written for developers who have previous experience with PHP and PHP frameworks, such as Zend or CakePHP, and want to start developing and working with Magento. Even developers with previous experience with Magento will find the book extremely useful to gain a full understanding of Magento fundamentals, architecture, and overall philosophy.