2017-03-24 08:50:25 +00:00
|
|
|
.. _products:
|
2017-02-12 21:36:31 +00:00
|
|
|
|
|
|
|
Adding Products
|
|
|
|
===============
|
|
|
|
|
2017-09-17 12:01:12 +00:00
|
|
|
Your new longclaw project has ``products`` app installed with ``ProductVariant``, ``Product`` and ``ProductIndex`` models.
|
2017-02-22 16:15:21 +00:00
|
|
|
You should add your own custom fields to ``ProductVariant`` to meet the demands of your catalogue.
|
2017-02-12 21:36:31 +00:00
|
|
|
|
2017-09-17 12:01:12 +00:00
|
|
|
A ``ProductVariant`` is a child of the ``Product`` model and is used to represent variants of a single product.
|
2017-02-22 16:15:21 +00:00
|
|
|
E.g different sizes, colours etc.
|
2017-02-12 21:36:31 +00:00
|
|
|
|
2017-09-17 12:01:12 +00:00
|
|
|
``Product`` and ``ProductIndex`` are not required by longclaw, although this way of modelling your catalogue means that:
|
|
|
|
|
|
|
|
- Your models fit into Wagtail way of creating ``Page`` models. Here, ``Product`` is your ``Page``, with ``ProductVariant`` being an
|
|
|
|
inline model. ``ProductIndex`` is the index page for listing all ``Products``.
|
|
|
|
|
|
|
|
- It is easy with this setup to model fairly simple catalogues where each product has multiple options. E.g. a music shop selling
|
|
|
|
CD and vinyl versions of each product.
|
|
|
|
|
|
|
|
Other examples might include having multiple ``ProductIndex`` models to represent different catalogues - e.g. clothing lines
|
|
|
|
or categories in a large shop.
|
|
|
|
You may also wish to create of supporting models for images, categories, tags etc. This is all up to you.
|
|
|
|
|
2017-02-12 21:36:31 +00:00
|
|
|
Writing the templates
|
|
|
|
-----------------------
|
|
|
|
|
2017-09-17 12:01:12 +00:00
|
|
|
Since ``ProductIndex`` and ``Product`` are Wagtail pages, HTML templates should be created for each.
|
2017-03-06 07:37:14 +00:00
|
|
|
The developer should refer to the `Wagtail documentation <http://docs.wagtail.io/en/v1.8.1/topics/writing_templates.html>`_ for further details.
|
2017-03-24 10:07:16 +00:00
|
|
|
Basic example templates are provided in ``your_project/templates/longclawproducts/`` when creating a project
|
2017-02-22 16:15:21 +00:00
|
|
|
with the longclaw project template.
|
2017-02-12 21:36:31 +00:00
|
|
|
|
|
|
|
|