awesto / django-shop

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

How do I correctly configure my Product Catalog? #809

Closed markusmo closed 4 years ago

markusmo commented 4 years ago

I am a bit confused. I am configuring my Catalog with CMS. I have my root object, and then my sub pages. All of them have "Catalog List" selected as their "Application". But in my Catalog, I always see all the products, there are no filters applied ... I also see no errors, this is a bit confusing for me.

markusmo commented 4 years ago

When I add or change the cms I get site-packages/cms/plugin_base.py:286: DontUsePageAttributeWarning: Don't use the page attribute on CMSPlugins! CMSPlugins are not guaranteed to have a page associated with them! page=obj.page

And as I have a look at my categories the CatalogList still does not filter my products to their assigned CMSPages. Could it be, that this warning is indicating, that my CMSPages are not working properly?

jrief commented 4 years ago

You should only add the "Catalog List" as CMSApp to pages, which actually need to render a list view of products. This also handles the routing of the product's detail view.

Could it be, that this warning is indicating, that my CMSPages are not working properly?

No, that warning originates from the CMS itself. If a plugin isn't associated with a page, for example in the clipboard, then the obj.page attribute is None. There is nothing special about this.

markusmo commented 4 years ago

EDIT: Disregard what I wrote earlier... I had the wrong implementation in my CatalogListApp. I added CMSPagesFilterBackend and then I got it working.


So that I get it right: I have a "catalog" CMS-page, which is configured as a "Catalog List" and my categories, which are sub-CMS-pages also have to have "Catalog List". Then my product, which should be displayed in my "catalog" and my category does have both CMS-pages assigned in their configuration? When I configure it that way, I always get all products in my "catalog" and my subcategory

jrief commented 4 years ago
Screenshot 2020-06-17 at 22 49 31

all four "categories" (Catalog, Smart Cards, Earphones, Smartphones) which actually are CMS-pages) have the "Catalog List" app assigned to them.

Screenshot 2020-06-17 at 22 52 47

Then we can assign each product to one or more of those categories / CMS-pages:

Screenshot 2020-06-17 at 22 57 20
markusmo commented 4 years ago

Thanks :-)