Book Image

PHP 5 E-commerce Development

By :
Book Image

PHP 5 E-commerce Development

By:

Overview of this book

<p>The popularity of online shopping has increased dramatically over the past few years. There are plenty of options available if you not are planning to build your own e-commerce solution but sometimes it's better to use your own solutions. It may be easy to find an e-commerce system but when it comes to extending it or using it you might come across a lot of difficulties.<br /><br />This book will show you how to create your own PHP framework that can be extended and used with ease, particularly for e-commerce sites. Using this framework you will be able to display and manage products, customize products, create wish-lists, make recommendations to customers based on previous purchases, send email notifications when certain products are in stock, rate the products online, and much more.<br /><br />This book helps you build a Model-View-Controller style framework, which is then used to put together an e-commerce application. The framework contains template management, database management, and user authentication management. With core functionality in place, e-commerce-focused features are gradually added to the framework including products, categories, customizable products with different variations and customer input, wish-lists, recommendations, the shopping basket, and a complete order process.<br />&nbsp;<br />At the end of the book, you will have an e-commerce architecture that will take you from viewing or searching for products, and adding them to your basket, through the checkout process and making payment for your order, to your order being dispatched. Focus is placed on flexibility, so that the framework can be extended as the needs of a particular store change, as illustrated by one of the appendices, which goes through the process of modifying the store to sell downloadable products, as well as physical ones.<br /><br />Supplementary information, such as how to market and promote an online store, as well as take regular backups and perform maintenance is also covered, ensuring you have every chance of success with you own e-commerce framework backed store.</p>
Table of Contents (23 chapters)
PHP 5 e-commerce Development
Credits
About the Author
About the Reviewers
Preface

Google products


Google has a product search feature, which allows users to search specifically for products using the Google search engine. Products can be added to this search engine using the Google merchant center.

The Google merchant center is an area where online retailers can list (and manage these listings) their products for including in the Google product search. Google merchant center is a specialized section of Google base: a search area that was designed for allowing anything to be added to the Google index — documents, notes, products, events, and so on, essentially anything that generally wasn't in a web page. As this service grew, the products aspect was spun off into the merchant center.

Apart from being able to manually add products, we can also add a feed of products. This feed of products would be tied directly to our store, updating in real time as we added new products, removed older ones, and updated details. By adding a feed, Google can keep an up-to-date copy of our product catalog for inclusion in its search results.

To get started with the Google merchant center, we need to sign up, or sign in at http://www.google.com/base/.

Adding the feed to the Google merchant center

Within the merchant center, we can click on the Data feeds link on the left-hand side, and then on the New Data Feed button to create a new feed. Here we can set:

  • The Target country to determine who would see results from our feed

  • The Data feed type (googlebase)

  • A name for the feed, that is, the Data feed filename (for example feed.xml)

After adding the feed to the Google merchant center, we set an update schedule.

Setting an update schedule

The update schedule is where we actually tell the Google merchant center where our feed of products is, and how often it should be updated. When we have added our feed to the center, there is a link next to it under the Upload schedule column called Create. If we click on this, we will see the Scheduled Upload form. This form allows us to select:

  • How frequently we wish to upload the feed: Daily/Monthly/Weekly

  • When we want to update the feed (for example, day 15 of every month)

  • Our time zone

  • The URL of the feed

Creating the feed

To be able to actually create the update schedule we discussed, we need a product feed. We could use a tab-delimited feed, which would be easy to do using a spreadsheet program. If we did it this way, we would need to create and upload the feed manually — something we don't want to do.

XML is a standard way of representing data, and is particularly useful when interacting with web services.

Product feed controller

We could create a product feed controller, which generates the feed for us. One requirement for XML feeds in the Google merchant center, is that they end in .xml, so we would have the controller search the second bit of the URL (for example, productsfeed/latest.xml) split the string by the dot, and then depending on the first word, here latest, display the relevant feed.

The controller would build a query of products, cache the results, and store them as a template variable, which would go into the XML template for the data feed.

<?xml version="1.0"?>
<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0" xmlns:c="http://base.google.com/cns/1.0">
<channel>
<title>Juniper Theatricals Product Feed</title>
<link>http://www.junipertheatricals.test</link>
<description> Theatrical supplies, props and costumes
</description>
<!-- START items -->
<item>
<title>{name}</title>
<link>
http://www.junipertheatricals.test/products/view/{path}
</link>
<description>{description}</description>
<g:image_link>{image}</g:image_link>
<g:price>{cost}</g:price>
<g:condition>new</g:condition>
<g:id>{ID}</g:id>
<c:retail_price type="decimal">{cost}</c:retail_price>
<c:promo_offer type="boolean">false</c:promo_offer>
</item>
<!-- END items -->
</channel>
</rss>

This is an XML feed showing some basic information for products. We can define our own custom elements to this too if we wish, such as how the product could be customized, if it is a downloadable product, if we can upload an image, the delivery time, and so on. More information on this is available from Google at http://www.google.com/support/merchants/bin/answer.py?answer=160603&hl=en.

Other useful link

For information on data feed specifications, visit http://www.google.com/support/merchants/bin/topic.py?topic=24946

Alternative — Google Base Data API

In addition to adding feeds to the merchant center, we can also add products directly from our framework if we wish. We could do this using the Google Base Data API (http://code.google.com/apis/base/). Further details on inserting, updating, and deleting data items using this API are available at http://code.google.com/apis/base/starting-out.html#insupdel.

Others

We've discussed Google quite a bit here; they are a very big player in this arena, being one of the most popular search engines around. There are some other options available, and these have their own specifications for data feeds, which are also supported by the Google merchant services center. These feed types include:

  • shopzilla

  • shopping.com