OpenMage / magento-lts

Official OpenMage LTS codebase | Migrate easily from Magento Community Edition in minutes! Download the source code for free or contribute to OpenMage LTS | Security vulnerability patches, bug fixes, performance improvements and more.
https://www.openmage.org
Open Software License 3.0
869 stars 436 forks source link

Hiding out of stock child products in Layered Navigation #563

Open seansan opened 6 years ago

seansan commented 6 years ago

Suppose a store admin wants to

In short. One would want to be able to visit the 'old url' and see the product data. But it makes no sense to add the options of these products to the layered navigation filters. For example: if a product in size SMALL Is no longer available in a category: then dont show the filter.

Problem 1: removing only out of stock products from the layered filters

It seems the setting 'Display Out of Stock Products" does a little more than only as the descriptions describes "Products will still be shown by direct product URLs." For instance it also controls if children options from out of stock child products are added to the layered navigation filters.

So if a store admin wants to "keep old products reachable via the URL even if completely out of stock" but does want to "remove the options from the layered navigation filters if out of stock" then this is not possible at the same time.

image

To solve this situation one could:

Problem 2: removing out of stock children products from the layered filters

A second problem that occurs is that if you add the parent (configurable) products to a category that the SIZE (or other related product attribute) does not respect the stock status even if you configure the previous setting under problem 1 correctly. The resulting querye checks for the in_stock value for the parent product and hence shows all the SIZE options, even when the sub-size is not in stock anymore (leading to customers clicking XXL: then seeing the same complete list of products, but non of them have a size XXL available)

The problem and a workaround solution are presented here: https://magento.stackexchange.com/questions/97742/hide-out-of-stock-products-in-layered-navigation/154654#154654

For example in the image below the sizes 5XL and 6XL no longer exist and all child products with these sizes are out of stock. A user that uses this filter would to either: well not see the filter option n the first place. Or after a click: see not results.

image

This comment also describes the problem (comment on this reference http://colin.mollenhour.com/2009/07/14/hiding-out-of-stock-items-in-layered-navigation/) :

image

References:

In conclusion the issue

  1. It is not possible for a store admin to "keep old products reachable via the URL even if completely out of stock" but to "remove the options from the layered navigation filters if out of stock".

A new setting can be created to allow for this. Based on the new setting "Remove options fomr layered navigation when out of stock" the admin can control 'only' the removeal of the options from the layered navigation.

  1. The out of stock children products should not be allowed in a category list (explained otherwise: if a customer filters by size 4XL, then as a result he/she would want to only see products that are in stock and salable in size 4X).

This sounds rather default and it gave me quite a scare when I realized this did not work as expected. The link above does solve the situation but doesnt seem to be the structural solution. This needs to be fixed.

colinmollenhour commented 6 years ago

My memory may not be right but I thought it worked this way already.. Did you reindex after changing the config value?

seansan commented 6 years ago

For problem 1 yes this is partly solved. Only the functionality is coupled -- and I think should be decoupled into 2 settings. (btw the extension Lucky does indeed have a duplicate entry error when indexing as mentioned in the blog post)

For problem 2: this seems to be an actual problem