Slashdot Mirror


Beginning PHP 5 and MySQL E-Commerce

norburym (Mary Norbury-Glaser) writes " Beginning PHP 5 and MySQL E-Commerce: From Novice to Professional by Cristian Darie and Mihai Bucica is a valuable resource for the web developer/intermediate programmer who is preparing to create a database-driven e-commerce site and who is most comfortable learning by example. The authors have prepared a book with real-world application in a tutorial format; they give detailed instruction on how to create a fully developed e-commerce web site from design phase to deployment. This book is not for the raw beginner; some knowledge of PHP and MySQL is assumed and truthfully, this book will most benefit a professional web designer who has some experience building dynamic elements into web sites." If that fits you, or if you want it to, read on for the rest of Norbury-Glaser's review. Beginning PHP 5 and MySQL E-Commerce: From Novice to Professional author Cristian Darie and Mihai Bucica pages 568 publisher Apress rating 9 reviewer Mary Norbury-Glaser ISBN 1590593928 summary Create an E-Commerce Site Using PHP 5 and MySQL 4

The authors use a T-shirt shop scenario as their model for the design and implementation of their e-commerce site. The book is separated into three distinct "phases" of development. Phase I covers the foundations of creating the Web site, what tools to use and how to use them including creating a product catalog, incorporating a search tool, using PayPal payment processing and adding an administration interface. Phase II proceeds with enhancing the site with a custom shopping cart, a client-server ordering process, a page for pending order administration and a dynamic product recommendations system. Phase III looks at a more complicated customer accounts scenario: taking credit cards instead of using PayPal, building an order-processing pipeline, implementing credit card gateways, adding a product reviews system and accessing web services using SOAP (Simple Object Access Protocol) and REST (Representational State Transfer) XML-based protocols.

Chapter 1 introduces business strategies for considering an online commerce solution and the reasons for launching an e-commerce presence: acquiring more customers, making customers spend more and reducing the costs of fulfilling orders. A thorough read of Appendix C ("Project Management Considerations") would be a good aside at this point. This section provides excellent insight into choosing an appropriate software development cycle model for different projects with a good discussion of advantages and disadvantages of various methods and theories.

Chapters 2 through 7 constitute Phase I proper. The authors begin by tackling the basic structure of the site and focusing on flexible design, scalability and reliability. They introduce a three-tier architecture model: the presentation tier (dynamic pages that contain the elements that allow visitor to the site to interact effectively with the business end), the business or middle tier (requests for data that are posed by the visitor are passed on by the presentation tier to the data tier) and the data tier (manages the data and sends appropriate responses back to the business tier when requested).

Chapter 2 lays the groundwork for the reader to establish the TShirtShop site and accompanying database. Installation instructions for Apache 2, PHP 5, MySQL 4 and phpMyAdmin are referenced to Appendix A. Instructions for installing other tools used in this book - the Smarty template framework for PHP and PEAR DB - are included within Chapter 2. I quite admire the authors' choice to use Smarty. Smarty parses templates behind the scenes and creates PHP scripts from them so when a Web page is rendered, Smarty reads from the PHP scripts instead of pulling the templates themselves, eliminating run-time parsing of templates. Smarty also has built-in caching of template outputs, which saves on overhead in retrieving data from the database.

After creating the main index.php page and the index.tpl Smarty template, the authors discuss error handling and reporting (with a nod to PHP's often head-scratching error messages). They provide a nice set of instructions here for creating an efficient error handling/reporting scheme. The last step in Chapter 2 is to load phpMyAdmin and create the new tshirtshop database and an admin user.

From this point forward, the authors structure each chapter to adhere to the three-tier model. Implementing the presentation tier, the business tier and the data tier is an integral part of the construction of the site. The reader is encouraged to begin every major aspect of the project with these elements in mind.

Chapters 3 and 4 lead the reader through the creation of the product catalog for the TShirtShop site. The authors give a brief overview of SQL, relational databases, using PEAR DB and Smarty plug-ins. The first table is created and populated with data, PEAR DB is used to access the data and a Smarty template is used to implement the user interface. Multiple tables are then added to enhance product catalog features, which allows for a discussion of table relationships. Filtering SQL results and joining data tables are then examined in the section on implementing the data tier.

Chapter 5 introduces a product search engine to the site by using MySQL to search the database and using Smarty templates to build the user interface. This is a major component of any e-commerce site and the authors prepare an excellent code set for this purpose by using the full-text searching functionality of MySQL. The pros and cons of this versus using LIKE are also discussed.

Chapter 6, "Receiving Payments Using PayPal", will be of great interest to many readers. Many individual proprietors and small businesses don't have the resources to process credit cards and therefore use Internet Payment Service Providers to process transactions. In this chapter, the authors teach the reader how to create a new PayPal account, how to integrate the PayPal shopping cart and custom checkout and how to configure PayPal to automatically calculate shipping costs. There is a bit of missing code in this chapter but it appears correctly on this book's Apress errata page (apress.com).

The last chapter of Phase I covers implementation of a catalog administration page using componentized templates and a simple authentication scheme for administrator access to the page.

By the completion of Phase I, the design and programming for a completely functional e-commerce site is in place.

Phase II begins with a pros and cons discussion of using a simple cart method like PayPal versus creating a custom shopping cart and checkout to enhance flexibility. There are some neat tricks here including storing the cart ID as a cookie on the client.

In Chapters 8 and 9, the reader learns how to store cart info in the database, how to implement a client-side ordering mechanism and an orders administration page for pending orders. The benefit to this is that since the data is now stored in the database, quantitative analysis and tracking can be done based on the products sold.

In Chapter 10, the authors add product recommendations to their TShirtShop site. This dynamic visitor-specific functionality is an excellent sales strategy intended to boost sales by adding suggestions for upgrading a purchase or complementing a purchase with another product. The items recommended are based on what products were ordered together by other customers. The SQL query to get the list of products is very nicely done!

This concludes Phase II and the site is again fully functional but with some neat new enhancements: the site has its own shopping cart, credit card processing is accomplished through PayPal and an orders administration page and product recommendations system have been added. Many individually run or small businesses may stop at this point and be completely content with the e-commerce site that has been developed so far. But the authors proceed with more complex scenarios by offering Phase III: "Processing Orders and Adding Features". This final section of the book deals with processing credit cards, using SSL to encrypt data transactions, storing customer accounts, adding a customer product review system (think Amazon.com) and using XML Web services to integrate Amazon.com products into the site.

The authors spend some time covering the design of the order pipeline and optimizing the logical sequence of tasks that need to be tracked. Chapter 12 deals with the modifications necessary to the enable pipeline processing and the database schema changes for auditing and storing data. Chapter 13 implements the pipeline sections in preparation for adding full credit card transaction functionality in Chapter 14 and rounds out with the creation of a new orders admin page that shows an audit trail for any particular order stored in the database.

Full implementation of credit card orders is completed in Chapter 14. The authors discuss credit card transaction fundamentals including working with credit card payment gateways, understanding transactions and card processing. They look at two payment services providers as examples: DataCash (a UK-based company) and Payflow Pro (a division of Verisign).

Product review integration is the subject of Chapter 15. This is another highly coveted enhancement to e-commerce sites. The authors provide a very simple (and therefore, elegant, in my view) implementation of code to add review capabilities to the sample site.

The final chapter of the book is Chapter 16, "Connecting to Web Services", where the authors complete their professionally developed TShirtShop e-commerce site by integrating the Amazon E-Commerce Service using SOAP and REST.

Appendices A-C cover necessary application installation (as mentioned above), hosting advice, steps for getting your files where they need to be on various hosting models and project management theory. Access to code and errata is available on the Apress Web site (apress.com). This book has a nice layout, clean typography, plenty of screen shots and the code sets are offset from the main body of text and are extremely easy to follow. The book can readily be propped open while looking on from your development machine and the overall size of the book isn't unwieldy or awkward to place on a surface.

In the The Expert's Voice in Open Source series, Apress has harnessed the knowledge and expertise of some of the best folks in open source and this book is no exception. Cristian Darie has previously written several well-regarded volumes (Programmer's Guide to SQL, Beginning ASP.NET E-Commerce, Visual C# .NET: A Guide for VB6 Developers, among others) and his skill in untangling complex subject matter is apparent in Beginning PHP 5 and MySQL E-Commerce. Both authors have prepared a book that will enable any intermediate developer to create a fully functional e-commerce Web site that they can then customize and extend. This book is consistent, well organized and clearly presented. Beginning PHP 5 and MySQL E-Commerce: From Novice to Professional is the perfect tutorial-style book for start-to-finish e-commerce site development instruction for any developer with the desire to learn the advanced tools and techniques to get a scalable professional site designed and in production.

You can purchase Beginning PHP 5 and MySQL E-Commerce: From Novice to Professional from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

37 of 202 comments (clear)

  1. Ugh... editors at it again... by Anonymous Coward · · Score: 0, Offtopic

    Nothing like having THE WHOLE REVIEW on the /. summary page...

  2. Yikes! by Botunda · · Score: 0, Offtopic

    Holy post the whole article on the main page!!!

  3. Looks like.. by ciroknight · · Score: 0, Offtopic

    Someone forgot to make the schpeal break in Slashdot. The front page is six miles long!!!

    Ah /., may you stay broken forever.

    --
    "Victory means exit strategy, and it's important for the President to explain to us what the exit strategy is." G.W.Bush
    1. Re:Looks like.. by LNO · · Score: 0, Offtopic

      Shine on, you crazy diamond...

  4. Wow by ClownsScareMe · · Score: 0, Offtopic

    My eyes are bleeding.

    --
    I read Slashdot for the articles
  5. that's it! by M1FCJ · · Score: 1, Offtopic

    Right. What the heck is this? Couldn't you post less into the intro of the article? I'm fed up with sloppy editors in /. (What? Am I new here? Who's asking?)

  6. OffTopic: Display Error by Orne · · Score: 0, Offtopic

    Is there any reason why the entire review is showing up on the slashdot.org front page?

    Someone needs to clip it down...

  7. Note to /. editors: by Tim_F · · Score: 0, Offtopic

    This story was originally posted in its entirety to the front page. I'm sure that none of are really that incompetent (though I have seen the whole front page in italics when Timothy forgot to close an tag.

    plsfixkthx.

    FP

    1. Re:Note to /. editors: by johndiii · · Score: 0, Offtopic

      My kingdom for a "+1, Ironic" moderation!!!

      --
      Floating face-down in a river of regret...and thoughts of you...
    2. Re:Note to /. editors: by RangerRick98 · · Score: 0, Offtopic
      This story was originally posted in its entirety to the front page. I'm sure that none of are really that incompetent (though I have seen the whole front page in italics when Timothy forgot to close an <i>tag.

      plsfixkthx.

      FP


      How ironic. :)
      --
      "You're older than you've ever been, and now you're even older."
    3. Re:Note to /. editors: by Tim_F · · Score: 0, Offtopic

      It looks like they fixed it. I apologize to all involved for my harsh words and for a post that was missing words and a closing tag.

  8. formatting by RapmasterT · · Score: 0, Offtopic

    now THAT makes for an awkward front page.

  9. That's a long summary! by avkillick · · Score: 0, Offtopic

    I've never seen one that long on the front page before.

    --
    OpenOffice tips:richhillsoftware.com
    1. Re:That's a long summary! by RangerRick98 · · Score: 0, Offtopic

      I've never seen one that long on the front page before.

      <suave>Why, thank you.</suave>

      --
      "You're older than you've ever been, and now you're even older."
  10. Here's a Q: by 4Lancer.net · · Score: 0, Offtopic

    Why the hell did we have to annhilate the front page for the next 24 hours with this huge post?

    --
    All your searching needs (and free money!) - 4Lancer.net
    1. Re:Here's a Q: by 4Lancer.net · · Score: 0, Offtopic

      So, mine is Offtopic, yet everyone elses is on topic?

      --
      All your searching needs (and free money!) - 4Lancer.net
  11. I'll get you Timothy!!!! by Morphix84 · · Score: 0, Offtopic

    *shakes fist*

  12. Re:my God! by MissTuxie · · Score: 1, Offtopic

    blurb? that's more like a sermon to me!

  13. Someone call a medic... by IBeatUpNerds · · Score: 0, Offtopic

    ... my head's about to fucking explode after reading the front page.

  14. Holy lack of character limits batman! by Nephroth · · Score: 0, Offtopic

    That was a bit excessive, I think we as the Slashdot community need to see to collectively ask that there be no more of these.

    --
    Our greatest enemy is neither a single man, nor is it a nation, it is, as it has always been, our own greed.
    1. Re:Holy lack of character limits batman! by Nephroth · · Score: 0, Offtopic

      Correction! They fixed it. And to people who didn't see it, the entirity of the review was on the front page.

      --
      Our greatest enemy is neither a single man, nor is it a nation, it is, as it has always been, our own greed.
  15. OMG by bosewicht · · Score: 0, Offtopic

    Do they think they left anything out?

    --
    There are 10 kinds of people in the world - those who understand binary and those who don't
  16. Lenght of comment threads. by suso · · Score: 1, Offtopic

    Let's see if the length of the threads talking about the oversize length of the blurb will end up being longer than the blurb was. ;-)

  17. Nice job editors... by Marthisdil · · Score: 0, Offtopic

    For such a damn long post making me have to f'in scroll the main page.

  18. Re:my God! by twilight30 · · Score: 0, Offtopic

    from the for-not-quite-beginners dept.

    Looks like Timothy needs to read this himself.

    Oh wait, Slashdot runs on Perl ...

    Thank you, I'm here all week.

    --
    ========================================
    Death will come, and will have your eyes
    -- Pavese
  19. Re:Largest Front Page Article Evar? by 4Lancer.net · · Score: 0, Offtopic

    Slashcode not broken - timothy's brain broken.

    --
    All your searching needs (and free money!) - 4Lancer.net
  20. Um.... by bushda · · Score: 0, Offtopic

    Anyone else think that some script kiddie had managed to hack /. and put up their manifesto when they saw something that long?

    --
    There are two seasons in my world - Hockey and Construction
  21. Timothy by LittleLebowskiUrbanA · · Score: 0, Offtopic

    What's the point of the Read More link?

  22. Don't bother... by nebaz · · Score: 0, Offtopic

    Making comments about the errors in the blurb if any appear. They will eventually be fixed, possibly silently, and the people looking at the article later will wonder what the big deal is.

    --
    Rhymes that keep their secrets will unfold behind the clouds.There upon the rainbow is the answer to a neverending story
  23. Re:my God! by vgaphil · · Score: 0, Offtopic

    It's more of a blog than a blurb..

    New headline "timothy Hampers Mobile Internet?"

    --
    A clever person solves a problem. A wise person avoids it. -- Einstein
  24. Re:my God! by Coocha · · Score: 0, Offtopic

    yea, and timothy said unto the unwashed masses:

    "my bad. really."

    --sigh-- this day has been the most evident of /. degradation yet... or maybe I wasn't paying attention before.

    --
    May the threads progress competently.
  25. Re:Poor editing by Thnikkaman · · Score: 0, Offtopic

    AMEN! How can the editors expect us to be interested in the story if they won't give us enough information? I understand keeping it brief so that we can read more if we choose to, but we need something to wet our tastebuds.

  26. Calm down... by ErnieD · · Score: 0, Offtopic

    Come on people, calm the hell down. Mistakes happen. Your life is not going to end because the /. front page is bigger than normal. Get over it, move on, and hit PgDn a few extra times.

  27. Re:my God! by dotslasher_sri · · Score: 0, Offtopic

    i can see the fark headline "timothy Hampers Mobile Internet..hilarity ensues"

  28. Oh wow! by GreyWolf3000 · · Score: 0, Offtopic

    Every single post is a comment about the front page screw up. How hilarious!

    --
    Slashdot: Where people pretend to be twice as smart as they really are by behaving like children.
  29. Re:Talk about length! by MudButt · · Score: 0, Offtopic

    How did I know that I'd be the one to get modded down out of 300 other replies saying the same thing? Hmph!

  30. Hmm sounds good by thegamerformelyknown · · Score: 0, Offtopic

    Now where can I get it....