October 2017
Intermediate to advanced
370 pages
8h 57m
English
Now let's look at the server. When an item is added to the cart, we need to keep track of the total price, as well as the product ID, product name, and price for each product. Once again, the details of how to build an e-commerce backend don't really belong in a book about AMP, so we'll just describe it briefly here (and you can see the code at /ch6/add-to-cart.php, and /ch6/CartFileStorage.php).
On the server, we'll use a simple file-based system to store the carts. Each cart will be identified by the CLIENT_ID. When the add-to-cart form is submitted to the server, the server should do the following:
Read now
Unlock full access