Welcome | Get started | Dive into Lino | Contribute | Topics | Reference | More

shopping : A shopping cart

The lino_xl.lib.shopping plugin adds a shopping cart, an addresses table for delivery and invoicing addresses.

This page is a tested document and the following instructions are used for initialization:

>>> import lino
>>> lino.startup('lino_book.projects.min9.settings')
>>> from django.utils import translation
>>> from lino.api.doctest import *
>>> from django.db.models import Q

Glossary

shopping cart

A database row representing the fact that a given user plans to buy a set of products. A shopping cart has one item per product for which the users has clicked "Add to cart". It also has an action to create an invoice.

shopping address

A postal address that can be used either as invoicing address or delivery address.

Shopping addresses are not stored in lino_xl.lib.contacts because they are private to each user and won't be used as business partners of the site operator.

delivery method

A method to be used for delivery of a shopping cart.

The end user must set this before they can start an order (invoice) from their shopping cart.

The list of available delivery methods is to be maintained by the site manager.

Demo data

The plugin does not yet add much demo data.

>>> rt.show('shopping.Addresses')
No data to display
>>> rt.show('shopping.DeliveryMethods')
==== ================ ================== ================== ================
 ID   Designation      Designation (de)   Designation (fr)   Product
---- ---------------- ------------------ ------------------ ----------------
 1    Parcel center    Parcel center      Parcel center      Parcel center
 2    Home using UPS   Home using UPS     Home using UPS     Home using UPS
 3    Take away        Take away          Take away          Take away
==== ================ ================== ================== ================

Reference

class lino_xl.lib.shopping.Cart

Django model used to represent a shopping cart.

Inherits from lino.modlib.users.UserPlan.

user

The end user who created this cart.

date

The date of last modification.

delivery_address

The delivery address. A pointer to a shopping address of this user.

invoicing_address

The invoicing address. A pointer to a shopping address of this user.

delivery_method
invoice

The invoice that has been created from this shopping cart. This field is empty as long as the user didn't yet run start_order.

class lino_xl.lib.shopping.CartItem

Django model used to represent an item of a shopping cart.

product
qty
class lino_xl.lib.shopping.Address

Django model used to represent a shopping address.

class lino_xl.lib.shopping.DeliverMethod

Django model used to represent a delivery method.