awesto / django-shop

A Django based shop system
http://www.django-shop.org
BSD 3-Clause "New" or "Revised" License
3.17k stars 1.04k forks source link

ProductRetrieveView:param:with_direct_siblings if True return product_pre, product_next to the context and direct_siblings in serializer #801

Open haricot opened 4 years ago

haricot commented 4 years ago

Same things as the linked pull request #734 but reviewed in a simpler way.

haricot commented 4 years ago

Otherwise change ProductRetrieveView.as_view in myshop.cms_app.CatalogListApp should be sufficient and in this case this pull request can be closed.

jrief commented 4 years ago

Thanks for this pull request. Rendering the previous and next siblings of a product, may really be useful in some situations. Just some points I would have done differently:

But in general looking at your code, how does this view function behave, if someone filters by a certain product tag, or uses the search input field? Where is that information kept while rendering the product's detail view?

For this we have three possible solutions. Add this filtering information to the session, or to a cookie or as a request parameter. The latter generates ugly URLs for the detail view. Session could be problematic, because in django-SHOP the session_id is generated only after adding the first product to the cart, or as logged in user. So the remaining possibility is a cookie.

Let's discuss this on a chat.