Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Create an Amazon storefront using PHP, Part 2: Build a shopping cart

Also, learn the ins and outs of creating a collectibles shop

Tyler Anderson (tyleranderson5@yahoo.com), Freelance Writer, Stexar Corp.
Tyler Anderson graduated with a degree in computer science from Brigham Young University in 2004 and is currently in his last semester as a master's student in computer engineering. In the past, he worked as a database programmer for DPMG.com, and he is currently an engineer for Stexar Corp., based in Beaverton, Ore.

Summary:  This is Part 2 of a two-part tutorial that constructs an Amazon storefront using PHP and the Amazon E-Commerce Service (ECS). This tutorial shows how to create a shopping cart, a "browse for similar items" feature, a specialty theme shop, and a collectibles shop.

View more content in this series

Date:  01 Nov 2005
Level:  Intermediate PDF:  A4 and Letter (514 KB | 32 pages)Get Adobe® Reader®

Activity:  17653 views
Comments:  

Before you start

This tutorial is for those interested in expanding the storefront, created in Part 1 of this series, by adding a fully functional shopping cart in PHP that automates the process of creating and modifying a shopping cart via Amazon Web Services. The "browse similar items" and "collectibles shop" features are also implemented to help narrow a user's search, making the storefront more effective for users. This tutorial assumes knowledge of basic PHP syntax, as well as knowledge of SOAP and the Amazon ECS and Web services, as covered in Part 1 of this series.

About this series

In Part 1, we created a storefront application with PHP that allowed users to browse items in various categories, as well as search within those categories to narrow a search. Content was retrieved using Amazon Web Services.

In Part 2, we will create and modify a fully functional shopping cart in PHP using Amazon Web Services, integrating it into the storefront created in Part 1. Tools to help narrow a user's search are also integrated into the shopping cart: browse similar items, which allows users to browse items similar to an item he is already interested in; and a collectibles theme shop, which displays only collectible items for the categories in the storefront.


About this tutorial

You will create a shopping cart in PHP and integrate it into the storefront. Shopping cart data is stored on Amazon's servers, which adds security given how the data isn't stored locally. When a user finishes shopping and checks out, he is sent to Amazon's secure checkout servers that pulls up the shopping cart information and collects billing information. You will also add the ability to browse similar items and a collectibles shop, making the process of deciding what to buy easier for users, increasing the likelihood of sales. Like Part 1, this tutorial relies heavily on SOAP requests you send to Amazon Web Services.


Prerequisites

To follow along with this tutorial, you will need to install and test the following tools, and retrieve two identifiers from Amazon:

Web server
Pick any Web server and operating system. Feel free to use Apache V2.X, or the IBM HTTP Server.
PHP
You can follow along in this tutorial without PHP, but if you are interested in interacting with the sample application, download PHP V5. Make sure to build PHP with --enable-soap to enable the PHP SOAP extensions.
Amazon
You need two things from Amazon: a developer token and an Amazon Associates ID (see Resources).
Web Browser
You need a Web browser. These include Mozilla, Firefox, Opera, and Microsoft® Internet Explorer.

1 of 10 | Next

Comments



static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Open source, SOA and Web services
ArticleID=133243
TutorialTitle=Create an Amazon storefront using PHP, Part 2: Build a shopping cart
publish-date=11012005
author1-email=tyleranderson5@yahoo.com
author1-email-cc=troy@backstopmedia.com