from superalikal.djopping.models import ProductType, Order, OrderItem, get_non_empty_product_types as get_categories
from superalikal.settings import MEDIA_URL
from flash.models import Flash
 
def categories(request):
    return {'categories': get_categories()}
 
def cart(request):
    orden_id = request.session.get('active_cart')
    if orden_id is None:
        orden = Order(user=request.user)
        orden.save()
    else:
        orden = Order(id=orden_id)
    print orden_id
    return {'cart': orden}
 
def url(request):
    return {'URL': request.path}
 
def flash(request):
    flash = request.flash
    request.flash = Flash()
    if 'flash' in request.session:        
        flash.update(request.session['flash'])
        del request.session['flash']
    return {'flash': flash}