The shopper can also enter the SKU code manually.
![This illustration is described in the preceding text.](media/image30.jpeg)
Manual Code Entry
If a string is found through barcode scanning or manual input, the ATGScanAndGoViewController
uses the ATGProductManager
to get an ATGProduct
the SKU string using the method getProductFromSKU:delegate
where delegate
is the instance of ATGScanAndGoViewController
. If the product is successfully found, didGetProduct
is called.
![This illustration is described in the preceding text.](media/image31.jpeg)
Adding Manually Identified item to the cart
On failure, didErrorGettingProduct
: is called and the error message, as shown in the illustration that follows.
![This illustration is described in the preceding text.](media/image32.jpeg)
Item not found
![This illustration is described in the preceding text.](media/image33.png)
Added to cart after successful scan pop-up
Adding to the cart from the scan
ATGScanAndGoViewController
leverages ATGCommerceManager
to add items to the shopping cart. When Add to cart is touched, the method addItemToShoppingCartWithSkuId:productID:quantity:delegate
is called. On a successful scan, the SKU and product ID have been found and quantity defaults to 1, and the delegate
is set to ATGScanAndGoViewController
. If the item is successfully added to the cart, the delegate method didAddItemToShoppingCart
is called back on in the delegate, which displays the Added to cart pop up for two seconds. Failure to successfully add the item calls back didErrorAddingItemToShoppingCart
and an error message displays.