Beispiel #1
0
def index(request, template_name="catalog/index.html"):
    search_recs = stats.recommended_from_search(request)
    featured = Product.featured.all()[0:PRODUCTS_PER_ROW]
    recently_viewed = stats.get_recently_viewed(request)
    view_recs = stats.recommended_from_views(request)
    page_title = 'Musical Instruments and Sheet Music for Musicians'
    return render_to_response(template_name, locals(), context_instance=RequestContext(request))
Beispiel #2
0
def index(request, template_name='meadery/index.html'):
    page_title = SITE_NAME
    search_recs = stats.recommended_from_search(request)
    featured = Product.featured.all()[0:PRODUCTS_PER_ROW]
    recently_viewed = stats.get_recently_viewed(request)
    view_recs = stats.recommended_from_views(request)
    return render(request, template_name, locals())
Beispiel #3
0
def index(request, template_name="meadery/index.html"):
    page_title = SITE_NAME
    search_recs = stats.recommended_from_search(request)
    featured = Product.featured.all()[0:PRODUCTS_PER_ROW]
    recently_viewed = stats.get_recently_viewed(request)
    view_recs = stats.recommended_from_views(request)
    return render(request, template_name, locals())
Beispiel #4
0
def index(request, template_name='catalog/index.html'):
    search_recs = stats.recommended_from_search(request)
    featured = Product.featured.all()[0:PRODUCTS_PER_ROW]
    recently_viewed = stats.get_recently_viewed(request)
    view_recs = stats.recommended_from_views(request)
    page_title = 'Online Grocery Shopping - Buy Fruits, Vegetables, Groceries and More | Speedkart'
    return render(request, template_name, locals())
def index(request, template_name="catalog/index.html"):
    search_recs = stats.recommended_from_search(request)
    featured = Product.featured.all()[0:settings.PRODUCTS_PER_ROW]
    recently_viewed = stats.get_recently_viewed(request)
    view_recs = stats.recommended_from_views(request)

    page_title = 'Musical Instruments and Sheet Music for Musicians'

    return render(request, template_name, locals())
Beispiel #6
0
def index(request, template_name="spiritbuzz/index.html"):

    page_title = 'Small Batch, Artisanal, and Expressive Spirits'
    search_recs = stats.recommended_from_search(request)
    featured = Product.featured.all()[0:PRODUCTS_PER_ROW]
    recently_viewed = stats.get_recently_viewed(request)
    view_recs = stats.recommended_from_views(request)

    return render_to_response(template_name, locals(), context_instance=RequestContext(request))
Beispiel #7
0
def index(request, template_name="catalog/index.html"):
    page_title = u'Ладошки'
    new_products = Product.active.all()
    new_products = [i for i in new_products if i.new()][0:PRODUCTS_PER_ROW]
    search_recs = stats.recommended_from_search(request)
    featured = Product.featured.all()[0:PRODUCTS_PER_ROW]
    recently_viewed = stats.get_recently_viewed(request)
    view_recs = stats.recommended_from_views(request)
    return render_to_response(template_name, locals(), context_instance=RequestContext(request))
Beispiel #8
0
def index(request, template_name='catalog/index.html'):
    """ site home page"""
    search_recs = stats.recommended_from_search(request)
    featured = Product.featured.all()[0:PRODUCTS_PER_ROW]
    recently_viewed = stats.get_recently_viewed(request)
    view_recs = stats.recommended_from_views(request)

    page_title = 'Welcome to Teeshop| Retail store for all kinds of clothing for your need'

    return render(request, template_name, locals())
Beispiel #9
0
def index(request, template_name="catalog/index.html"):
    search_recs = stats.recommended_from_search(request)
    featured = Product.featured.all()[0:PRODUCTS_PER_ROW]
    recently_viewed = stats.get_recently_viewed(request)
    view_recs = stats.recommended_from_views(request)
    page_title = 'Musical Instruments and Sheet Music for Musicians'
    # locals() it returns a dictioanary of local variables if you have local variables
    return render_to_response(template_name,
                              locals(),
                              context_instance=RequestContext(request))
Beispiel #10
0
def product_list(request):
    page_title = 'Decor Products'
    search_recs = stats.recommended_from_search(request)
    # default object manager
    # products = Product.objects.filter(is_active=True)
    # customized actve manager
    new_arrivals = Product.objects.filter(is_new=True)
    products = Product.active.all()
    bestseller = Product.objects.filter(is_bestseller=True)
    featured = Product.featured.all()[0:settings.PRODUCTS_PER_ROW]
    recently_viewed = stats.get_recently_viewed(request)
    view_recs = stats.recommended_from_views(request)
    return render(request, 'product/list.html', {'products': products, 'bestseller': bestseller, 'featured': featured, 'search_recs': search_recs, 'new': new_arrivals})
Beispiel #11
0
def index(request, template_name="catalog/index.html"):
    search_recs = stats.recommended_from_search(request)
    featured = Product.featured.all()[0:PRODUCTS_PER_ROW]
    recently_viewed = stats.get_recently_viewed(request)
    view_recs = stats.recommended_from_views(request)
    all_view_recs = stats.recommended_from_all_views(request)
    print(search_recs)
    page_title = 'Musical Instruments and Sheet Music for Musicians'
    context = {
        'page_title': page_title,
    }
    # context2 = RequestContext(request, context)
    request.session.set_test_cookie()
    return render(request, template_name, locals(), RequestContext(request))
Beispiel #12
0
def index(request):
    """ site home page """
    search_recs = stats.recommended_from_search(request)
    featured = Product.featured.all()[0:4]
    recently_viewed = stats.get_recently_viewed(request)
    view_recs = stats.recommended_from_views(request)

    template = 'catalog/index.html'
    context = {
        'search_recs': search_recs,
        'featured': featured,
        'recently_viewed': recently_viewed,
        'view_recs': view_recs,
    }

    return render(request, template, context)
Beispiel #13
0
def index(request):
    search_recs = stats.recommended_from_search(request)

    featured = Product.featured.all()[0:settings.PRODUCTS_PER_ROW]
    recently_viewed = stats.get_recently_viewed(request)
    view_recs = stats.recommended_from_views(request)

    page_title = 'books'
    template = 'catalog/index.html'
    context = {
        'page_title': page_title,
        'search_recs': search_recs,
        'view_recs': view_recs,
        'featured': featured,
        'recently_viewed': recently_viewed,
    }
    return render(request, template, context)
Beispiel #14
0
def show_cart(request, template_name="cart/cart.html"):
    request.session.set_test_cookie()
    next1 = ''
    recent_views = stats.recommended_from_views(request)
    if request.method == 'POST':
        print(request.session['cart_id'])
        postdata = request.POST.copy()
        if postdata['submit'] == 'Remove':
            if pending_checker(request) == 0:
                url = reverse('show_checkout', args=['Lipa'])
                return HttpResponseRedirect(url)
            cart.remove_from_cart(request)
            next1 = request.GET.get('next', '')
            if len(next1) > 0:
                url = reverse('show_checkout', args=[next1])
                return HttpResponseRedirect(url)
        if postdata['submit'] == 'Update':
            if pending_checker(request) == 0:
                url = reverse('show_checkout', args=['Lipa'])
                return HttpResponseRedirect(url)
            try:
                int(postdata['quantity'])
                cart.update_cart(request)
                next1 = request.GET.get('next', '')
                if len(next1) > 0:
                    url = reverse('show_checkout', args=[next1])
                    return HttpResponseRedirect(url)
            except:
                if cart.cart_distinct_item_count(request) > 0:
                    qerror = 'Invalid Quantity Value'
        if postdata['submit'] == 'Card Checkout':
            checkout_url = checkout.get_checkout_url(request)
            return HttpResponseRedirect(checkout_url)
        if postdata['submit'] == 'Mpesa Checkout':
            checkout_url = checkout.get_checkout_url(request)
            return HttpResponseRedirect(checkout_url)
    if len(next1) > 0:
        url = reverse('show_checkout', args=[next1])
        return HttpResponseRedirect(url)
    cart_items = cart.get_cart_items(request)
    page_title = 'Shopping Cart'
    cart_subtotal = cart.cart_subtotal(request)
    return render(request, template_name, locals(), RequestContext(request))