Welcome to
Beginning PHP 5 and MySQL E-Commerce!

[ Updated July 31, 2006 ]

Dear Reader,

Welcome to Beginning PHP 5 and MySQL E-Commerce: From Novice to Professional! We really hope you'll enjoy reading this book, and that it will effectively help you build your own websites with PHP 5 and MySQL! Find more details about the book at http://www.cristiandarie.ro (where you can also register to the newsletter to be notified about any important book updates, errata updates, etc), and at http://www.apress.com/book/bookDisplay.html?bID=356.

About the Errata

This errata file has been updated on June 07, 2005. However, some of the errata entries have been already corrected in recent book reprints. We're always happy to receive your feedback (even if it's about the errata :-), and we almost always respond to it, even if sometimes it can take a while, due to tight deadlines and other time constraints. Please note the book is written for PHP 5, and the code won't work as it is, on PHP 4. Please check this detail before submitting bug reports or errata, as it's been the cause of some confusion in the past.

Note About the Code Download

This errata entries haven't been corrected in the code download as well, yet.

Special Thanks

We always appreciate the effort readers put into helping us improve and market the book. Many thanks go to Peter Michaux, Thomas Albrecht and Jamie McDaniel for submitting many of the errata entries, and to our readers that were so kind to write online reviews about the book.

Happy reading,

Cristian Darie and Mihai Bucica

 

Errata

Page 29, 30

Recent versions of Apache have more restrictive default security settings. At Step 2 of both exercises, when adding the aliases, you should also add permission to access the tshirtshop physical folder by modifying httpd.conf like this:

<IfModule alias_module>
  # ...

  Alias /tshirtshop/ "c:/
tshirtshop/"
  Alias /
tshirtshop "c:/tshirtshop"

</IfModule>

<Directory "C:/
tshirtshop">
  Allow from all
</Directory>

 

Page 74, 76  
Readers who have installed MySQL version 4.1.3 and above will likely be using PHP's improved MySQL extension. In order for the database
connection to work, step 2 on page 76 (and elsewhere in the book) would need to be changed to:
 
define("MYSQL_CONNECTION_STRING", "mysqli://" . DB_USERNAME . ":" . DB_PASSWORD . "@" . DB_SERVER . "/" . DB_DATABASE);

 

Page 105
The 4th table in Figure 4-14 should be labeled "product" instead of "department"

 

Page 155
The SQL statement (shown below) that creates the FULLTEXT search index is included in the Database\Chapter05 folder of the code download, but it is not included in the complete creation script in Database\Complete. If you use that script (tshirtshop.sql), you still need to execute this statement manually, to ensure the search functionality works as expected:

ALTER TABLE product ADD FULLTEXT NameDescFTIndex(name,description)

 

Page 175
The exercise should also add an "Add to Cart" button to the
product details page. You need to add the following code (similar to the one
at Step 3 of the exercise) in
product.tpl:

<br /><br />
<a href=
"JavaScript:
OpenPayPalWindow('https://www.paypal.com/cgi-bin/webscr?cmd=_cart&amp;business=youremail@yourserver.com&amp;item_name=' + escape('{$product->mProduct.name}') + '&amp;amount={$product->mProduct.price}&amp;add=1&amp;return=www.yourwebsite.com&amp;cancel_return=www.yourwebsite.com')">
<img src="images/add_to_cart.gif" border="0" alt="add to cart"/>

 

Page 231
Replace:
WHERE shopping_cart.cart.id = '$cartId'";
with:
WHERE shopping_cart.cart.id = '$cartId' AND shopping_cart.purchase_when = 'now'";

 

Page 235
A comment in index.php specifies that 432000 seconds means 7 days, but in reality there are 5 days.

 

Page 259
EmptyShoppingCart should only clear the shopping cart's "buy now" items. The code should be like this:

// empties visitor's shopping cart
public function EmptyShoppingCart($cartId)
{
  $query_string = "DELETE FROM shopping_cart
                   WHERE cart_id='$cartId' AND when_to_buy='NOW'";
  $this->dbManager->DbQuery($query_string);
}

 

Page 260
Replace:
UPDATE ORDERS
with:
UPDATE orders

 

Page 344
The exercise has a missing step. Find the following code in index.php (somewhere around line 40):

if (!isset($_GET['ProductID']) && !isset($_GET['CartAction']))
  $_SESSION['PageLink'] = "http://" . $_SERVER['SERVER_NAME'] .
    ":" . $_SERVER['SERVER_PORT'] . $_SERVER['REQUEST_URI'];

Change this code with:

if (!isset($_GET['ProductID']) && !isset($_GET['CartAction']))
  $_SESSION['PageLink'] = ($_SERVER['SERVER_PORT'] == '443' ? "https://" : "http://")
    . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $_SERVER['REQUEST_URI'];


 

Page 355
Replace:
$total_amount += $order_items[$i]['price'];
with:
$total_amount += $order_items[$i]['price']*$order_items[$i]['quantity'];

 

Page 365
Replace:
$cps = $this->GetCurrentPipelineSection();
$cps->Process($this);

with:
$this->GetCurrentPipelineSection();
$this->mCurrentPipelineSection->Process($this);

 

Page 471
Replace:
"http://webservices.amazon.com/onca/xml?Service=ECSECommerceService"
with:
"http://webservices.amazon.com/onca/xml?Service=AWSECommerceService"
 

<< Return to book Details.