Exemple #1
0
def view_card(request):

    card = Card(request)
    products = card.shopping_card

    data = []
    for product in products:
        pd = Product.objects.get(pk = int(product["product_id"]))
        data.append({"id" : pd.id, "image" : pd.image.url, 'name' : pd.name, 'price' : pd.price1, 'num' : product["num"], 'amount' : pd.price1 * int(product["num"])})
    return render_to_response("card/card.html", {'items' : data}, context_instance=RequestContext(request))
Exemple #2
0
def update_product(request, product_id, num):

    card = Card(request)
    card.update(product_id, int(num), 1)
    return HttpResponse("okie")
Exemple #3
0
def index(request, product_id, size):
    #Check if user logging
    card = Card(request)
    card.add(product_id, 1, size)
    return render_to_response('card/card.html',
                              {'card': card.shopping_card}, context_instance=RequestContext(request))
Exemple #4
0
def remove_product(request, product_id):

    card = Card(request)
    card.remove(product_id)
    return HttpResponse("okie")
Exemple #5
0
def index(request, product_id, size):
    #Check if user logging
    card = Card(request)
    card.add(product_id, 1, size)
    return render_to_response('card/card.html', {'card': card.shopping_card},
                              context_instance=RequestContext(request))
Exemple #6
0
def update_product(request, product_id, num):

    card = Card(request)
    card.update(product_id, int(num), 1)
    return HttpResponse("okie")
Exemple #7
0
def remove_product(request, product_id):

    card = Card(request)
    card.remove(product_id)
    return HttpResponse("okie")
Exemple #8
0
def my_shopping_card(request):
    card = Card(request)

    return render_to_response('card/card.html', {'card': card.shopping_card},
                              context_instance=RequestContext(request))