Issue #26 resolved
Anonymous created an issue

changing part of refresh_cart function ensures us that customer won't buy amount of items we don't have in stock. No I need to find a way of informing customer via jQgrowl :

this: {{{

!python

    amount = request.POST.get("amount-cart-item_%s" % item.id, 0)
    try:
        item.amount = int(amount)
    except ValueError:
        item.amount = 1
    item.save()

}}}

to: {{{

!python

    amount = request.POST.get("amount-cart-item_%s" % item.id, 0)
    stock = item.product.stock_amount
    try:
        if int(amount) <= item.product.stock_amount:
            item.amount = int(amount)
        else:
            item.amount = stock
    except ValueError:
        item.amount = 1
    item.save()

}}}

Comments (2)

  1. Log in to comment