All products showing even if home category not in the association #2
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-thirtybees/homefeatured#2
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Howdy all,
I was testing this out today, and it seems that even if I don't have any products associated with the home category, all products loaded so far, still show up in the featured products on the home page.
I changed the category name in the database directly to read shop instead of home, however I did not change the ID at all, it still remains as ID of 2.
What could be the issue?
[Update]
If I select any other category, it will honour that category, however if I select 2 (Home) then it will select the first set of products loads, or random if selected, from any category, it does not explicitly select from category 2
So I am thinking something else is wrong here, maybe a database issue? however I have also tested this on a brand new install of 1.5.1 and I have the same issue
I managed to fix this, however I am unsure if this fix is correct as I have no reference for it.
In the database on the categories table then is a column called nLeft and nRight, with values of 2 and 168 respectively. I changed the 168 to a 2 and it started to works as expected.
@Traumflug can you confirm if this is an acceptable fix for this?
This is most likely not the solution, and the issue will probably be reintroduced when you resave the home category.
Columns nleft and nright continains ids of first and last children
When I read the original issue, I don't think this is a bug, but rather a misunderstanding how the module works. When you select home category, it will display any products associated with any category that is children of Home category. The product doesn't have to be associated with Home category explicitlly.
Sure, that woudl make sense, however then the blockfeatured module would not make any sense then and would not teh same logic apply for any otehr subcategory then as well?
Meaning if I have grooming / beard oil, then if I choose grooming, then it would show products in grooming as well? because it does not do that.
I always have understood and taught customers, to get products into the featured category, you specifically tick the home category for that product. Always worked like that with PS 1.6 and every version of TB (Using it since the first version)
I never detected any other method that it would work?
I believe it always worked this way.
If the category has set Display products from subcategories = true, then then method Category::getProducts will return even products associated with subcategories.
If you don't want this behaviour, you can edit Home category, and disable this option. Then, only products associated with this category will be displayed.
Brilliant, I have done this and it works perfectly, thanks so much. Its great that in general products form sub categories will show, but just the home category its disabled