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 a product to the cart through querystring


In some use cases, you will link a visitor to your site when they directly add a product to the cart; for example, when you have a campaign with a buy now button on an external website.

Getting ready

Open your browser with your shop and navigate to Catalog | Manage Products in the backend.

How to do it...

In the next steps, we will create a URL where a product will be added to the cart:

  1. Find a product in your frontend you want to add to the cart. For example, navigate to Furniture | Living Room | Ottoman.

  2. Find this product in the backend and keep the ID in mind.

  3. To add a product, we have to call the checkout/cart/add URL with the product ID as the GET parameter. So, the final URL will be http://magento-dev.local/checkout/cart/add?product=51.

  4. While calling this URL, you will be redirected to the cart page with one item of this product in the cart.

  5. When you add the qty parameter to the query, you can add more than one item of the same product to the...