September 2018
Intermediate to advanced
398 pages
9h 43m
English
To add a product to the cart, we have to click on the Add to cart button of the product panel. We need to edit ProductDiv again and implement the addToCart method.
As we said in the Introducing the UI manager section of this chapter, we would like to delegate the user interface manipulation to the UIManager class, so the addToCart method implementation is as follows:
private def addToCart() = () => UIManager.addOneProduct(product)
Indeed, we are asking UIManager to add the product to the cart. The UIManager builds a div representing the product in the cart, and if it is already in the cart, nothing happens.
The implementation is as follows:
def addOneProduct(product: Product): JQueryDeferred = { val quantity = ...Read now
Unlock full access