Book Image

Magento 1.8 Development Cookbook

By : Bart Delvaux, Nurul Ferdous
Book Image

Magento 1.8 Development Cookbook

By: Bart Delvaux, Nurul Ferdous

Overview of this book

<p>Magento is an open source e-commerce platform which has all the functionality to function from small to large online stores. Its architecture makes it possible to extend the functionalities with plugins where a lot of them are shared by the community. This is the reason why the platform is liked by developers and retailers.</p> <p>A practical developer guide packed with recipes that cover all the parts of Magento development. The recipes will start with the simple development exercises and get the more advanced as the book progresses. A good reference for every Magento developer!</p> <p>This book starts with the basics. The first thing is to create a test environment. Next, the architecture, tools, files and other basics are described to make you ready for the real work.</p> <p>The real work starts with the simple things like theming and catalog configuration. When you are familiar with this, we will move on to more complex features such as module and database development. When you have survived this, we will move on to the last part of making a shop ready for launch: performance optimization and testing. This book will guide you through all the development phases of Magento, covering the most common pitfalls through its recipes.</p>
Table of Contents (19 chapters)
Magento 1.8 Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Adding customer attributes


Sometimes, it is easy if we can add an attribute to a customer as we can do with products. This is possible, but there is no interface for adding attributes in the backend. We have to create it using a module that adds the attributes to the customer object. In this recipe, we will add a loyaltynumber field to the customer.

Getting ready

For adding a customer attribute, the only task is to create an upgrade script which adds the attribute. Then, we have to link the attribute in the form table.

How to do it...

Perform the following steps to add the loyaltynumber attribute to your customer objects:

  1. The first step is to create the upgrade script. In the previous chapters, we have created an install and upgrade script in the app/code/local/Packt/Helloworld/sql/helloworld_setup folder. Create an extra install script with the name upgrade-002-003.php.

  2. To install the customer attribute, add the following code in that install script:

    <?php
    
    $installer = $this;
    
    $installer-...