Esempio n. 1
0
def showDetailsOfBook(productID):
    details = Product.getDetailsOfProduct(productID)
    if (details['status'] == 0):
        details['data'][0]['rate'] = Product.getRateOfProduct(productID)
        if (flask_login.current_user.is_authenticated):
            return render_template(
                'shop-details.html',
                user=flask_login.current_user,
                details=details['data'][0],
                userMark=flask_login.current_user.getUserMarkTo(productID),
                quantityInCart=Cart.getQuantityOfProductInCart(
                    flask_login.current_user.userID, productID))
        else:
            return render_template('shop-details.html',
                                   user=flask_login.current_user,
                                   details=details['data'][0])
    elif (details['status'] == 2):
        return render_template('shop-details.html',
                               user=flask_login.current_user,
                               error=details['message'])
    elif (details['status'] == 1):  #TODO: ERROR
        return render_template('shop-details.html',
                               user=flask_login.current_user,
                               error=details['message'])
    else:
        return redirect(url_for('showBooks', page=1))
Esempio n. 2
0
def showDetailsOfBookAPI(productID):
    return Product.getDetailsOfProduct(productID)