3. Templatetags — django SHOP 0.1.1.dev0 documentation

### Navigation

- index
- modules |
- next |
- previous |
- django SHOP 0.1.1.dev0 documentation »

# 3. 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 %}

## 3.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.

### 3.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.

## 3.2. Order

Renders information about an Order object.

### 3.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.

## 3.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`.

### 3.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 supplied, the tag will render the given products 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.

## 3.4. Filters

### 3.4.1. priceformat

Renders the float using the `SHOP_PRICE_FORMAT` format. This should be used whenever displaying prices in the templates.

    {{ product.get_price|priceformat }}

### Navigation

- index
- modules |
- next |
- previous |
- django SHOP 0.1.1.dev0 documentation »