kopia lustrzana https://github.com/longclawshop/longclaw
Correct documentation and urls for basket api
rodzic
99e9ef7917
commit
062851ea99
|
@ -14,7 +14,7 @@ The function ``longclaw.longclawbasket.utils.get_basket_items`` will return all
|
|||
session. This accepts a django ``request`` object and uses ``longclaw.longclawbasket.utils.basket_id`` to
|
||||
fetch the underlying ``basket_id`` on which to filter the ``BasketItem`` objects.
|
||||
|
||||
On the front end, you can use the API endpoint ``<api_prefix>/get_basket/`` or the django view ``basket/``. You should
|
||||
On the front end, you can use the API endpoint ``<api_prefix>/basket/`` or the django view ``basket/``. You should
|
||||
provide a template for the view title ``basket.html``. ``basket`` is also the name of the context variable
|
||||
containing all basket items.
|
||||
|
||||
|
@ -58,19 +58,19 @@ Adding and Removing items
|
|||
|
||||
Items can be added or removed via the RESTful api:
|
||||
|
||||
``<api_prefix>/add_to_basket/`` to add an item and ``<api_prefix>/remove_from_basket/`` to remove an item
|
||||
POST to ``<api_prefix>/basket/`` to add an item and DELETE to ``<api_prefix>/basket/<variant_id>/`` to remove an item
|
||||
|
||||
For both endpoints, you should provide the product variant id as ``variant_id`` and the ``quantity`` in
|
||||
When adding an item, provide the ``variant_id`` in the request data. For both endpoints, you can optionally provide the ``quantity`` in
|
||||
the request data.
|
||||
|
||||
There is currently no django view for addition/deletion of basket items.
|
||||
|
||||
Other API endpoints:
|
||||
|
||||
``<api_prefix>/get_item_count/``
|
||||
``<api_prefix>/basket/<variant_id>/count/``
|
||||
get the quantity of a single item in the basket. Requires ``variant_id`` in the request data
|
||||
|
||||
``<api_prefix>/basket_total_items/``
|
||||
``<api_prefix>/basket/count/``
|
||||
get total number of items in the basket
|
||||
|
||||
All basket items can be deleted using the ``longclaw.longclawbasket.utils.destroy_basket`` function.
|
||||
|
|
|
@ -25,13 +25,13 @@ urlpatterns = [
|
|||
url(API_URL_PREFIX + r'basket/$',
|
||||
basket_list,
|
||||
name='longclaw_basket_list'),
|
||||
url(API_URL_PREFIX + r'basket/count',
|
||||
url(API_URL_PREFIX + r'basket/count/$',
|
||||
total_items,
|
||||
name="longclaw_basket_total_items"),
|
||||
url(API_URL_PREFIX + r'basket/(?P<variant_id>[0-9]+)/$',
|
||||
basket_detail,
|
||||
name='longclaw_basket_detail'),
|
||||
url(API_URL_PREFIX + r'basket/(?P<variant_id>[0-9]+)/$',
|
||||
url(API_URL_PREFIX + r'basket/(?P<variant_id>[0-9]+)/count/$',
|
||||
item_count,
|
||||
name='longclaw_basket_item_count'),
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ def capture_payment(request):
|
|||
|
||||
'email': Email address of the customer
|
||||
'ip': IP address of the customer
|
||||
'shipping': The shipping rate (standard or premium)
|
||||
'shipping': The shipping rate (in the sites' currency)
|
||||
'''
|
||||
|
||||
# Get the contents of the basket
|
||||
|
|
Ładowanie…
Reference in New Issue