2. Templatetags — Django Shop v0.0.0 documentation

### Navigation

- index
- next |
- previous |
- Django Shop v0.0.0 documentation »

# 2. Templatetags

django-shop ships various templatetags to make quick creation of html templates easier. In order to use these templatetags you need to load them in your template

    {% load shop_tags %}

## 2.1. Cart

Renders information about the Cart object. This could be used (for example) to show the total amount of items currently in the cart on every page of your shop.

### 2.1.1. Usage

    {% load shop_tags %}
    {% cart %}

In order to define your own template, override the template `shop/templatetags/_cart.html`. The tag adds a variable called `cart` to the context.

## 2.2. Order

Renders information about an Order object.

### 2.2.1. Usage

    {% load shop_tags %}
    {% order my_order %}

In order to define your own template, override the template `shop/templatetags/_order.html`. The tag adds a variable called `order` to the context.

## 2.3. Product

Renders information about all active products in the shop. This is useful if you need to display your products on pages other than just product_list.html.

### 2.3.1. Usage

If no argument is given, the tag will just render all active products. The tag allows an optional argument `objects`. It should be a queryset of Product objects. If given, the tag will render the given products only instead of all active products.

    {% load shop_tags %}
    {% products %}
    {% products object_list %}

In order to define your own template, override the template `shop/templatetags/_products.html`. The tag adds a variable called `products` to the context.

### Navigation

- index
- next |
- previous |
- Django Shop v0.0.0 documentation »