djaodjin-saas
djaodjin-saas copied to clipboard
Create a page to view a user cart and remove items from it
The page in views.billing.CartView
is used for checkout/payment. There needs to be a similar page whose purpose is just to view/modify any User
cart.
The API end points to add or remove items from a cart are api.billing.CartItemAPIView
and api.billing.CartItemDestroyAPIView
respectively.
"view/modify any User cart" -- does "any" mean that we can pass an organization
parameter via url and retrieve a cart based on this parameter? Also, what can be modified exactly: is this about deleting items or changing quantities of items, etc? And this should be a regular view not an angular controller which makes requests to API, correct?
The primary request for this functionality is for managers to be able to see and manage abandoned carts. It is a manager dashboard feature. Details:
-
Carts (ie.
CartItem
objects) are perUser
(anonymous or authenticated) so it makes sense to pass ausername
in the URL. Note: I don't think we currently keep carts (asCartItem
in the db) for anonymous users, mostly because with so many bots hitting everything they can, unauthenticated requests do not provide meaningful information. -
Carts should be fully manageable (deleting items, changing quantities, etc.) in order to give enough flexibility to customer support staff.
-
Any feature (this one and others) should always be implemented using the API end-points. For historical reasons some features (like update
Organization
) are not yet doing so but intended to.
For customer-centric, adding a delete button that calls the api.billing.CartItemDestroyAPIView
API end-point (see https://github.com/djaodjin/djaoapp/issues/6) is enough.
- I see that the angular code expects the view to have an organization context variable and it is taken from
OrganizationMixin
which queries it via url, however by using username in url we are not able to get the organization. Should I change the angular code to work without organization?
the other thing is if we're going to make a vue.js rewrite, what's the point of investing time in this feature if it gets rewritten soon anyway?
There is a UserMixin
that reads username
from a view kwargs. I believe the angularjs code itemsListCtrl
could work with either a username
or organization
.
The purpose of doing the work now is to help support teams Today. I agree though that if it takes more than 4 or 5 hours to get the feature done, we should wait for the vue.js rewrite. Thanks.
Time to get back on this. Add an url page in broker.py
called /billing/carts/
that displays the CartItem
which are active and allow to delete them.
PR #276 addresses this item. The /api/cartitems/{id}
URL is using the primary key of the CartItem
in the database. It is acceptable as long as only brokers can view/update cartitems.