Developer forum

Forum » Ecommerce - Standard features » In stock facet for products with and without variants

In stock facet for products with and without variants

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

I have a project based on Rapido 3.0 and DW 9.5.

The customer is asking for a filtering facet based on the stock status.

The catalog has both products with variants and without variants. If I base my facet on the Stock property, it only applies to products without variants. Is there a property already counting every stock on the product including Variants's stock?

Or a setting forcing calculation of stock on the parent product based on the stock of its variants?

Any alternative solution is welcome.

Thank you,

Adrian


Replies

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys, 

in the documentation i have found this piece of information: 

"For extended variants, if a default variant is selected, the stock field on the main product is read-only and contains the total sum of stock across all variants."

Does this mean the stock of the parent product in the index will be calculated as the sum of the stock of the variants? Or it is just for backend display purposes?

Thank you,

Adrian

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

HI Guys,

I have not received any opinion about this issue.

In the meantime I have found that setting a DefaultVariantComboID solves the stock part but opens up a new problem. A problem that I have stumbled upon, a while ago but I can;t remember if it had any solution.

The ProductDetail page will always list the DefaultVariant information, which is something I want to avoid.

On the productList, I can probably control the URL that's generated for the ProductDetailPage but once I get to the ProductDetailPage, I get all the information from the Variant instead of the product.

In some circumstances this behavior is very good, but it would be very good to have control over it. For example, it can be connected with the option to "Show default variant in product list".

It makes sense that this option would trigger also a default view of the ProductDetailPage.

If I am missing a setting,

Please let me know.

Thank you,
Adrian

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Just to recap, there are 2 possible situations:

1. Set DefaultVariantComboID but avoid getting the details for ProductDetailPage

2. Do not set DefaultComboID but find a way to have stock information as sum of all variants of a master product.

Thank you,

Adrian

 
Nicolai Pedersen
Reply

Hi Adrian

Either are currently not possible.

Just to be completely sure - given this database data:

  • Master (0 in stock - on the DB record of the master)
    • Variant 1 (0 in stock)
    • Variant 2 (2 in stock)
    • Variant 3 (3 in stock)
  • Product not variant (1 in stock)

You want this in the index:

  • Master (5 in stock - sum of all records)
    • Variant 1 (0 in stock)
    • Variant 2 (2 in stock)
    • Variant 3 (3 in stock)
  • Product not variant (1 in stock)

BR Nicolai

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nicolai,

That's exactly what I am expecting.
Apparently, if I set a DefaultComboVariantID on Master, the stock is rendered correctly. And I did just that. But the other issues kicks in and I cannot display the properties of the master anymore.

I believe these are 2 separate issues. One (the stock) can probably be solved with an indexbuilder extender, but the second one is a lot deeper in the core and I still think it should not behave like this unless a specific decision is made. I know I have requested this behavior in the past and I think it still makes sense to some situations, but connecting it to the checkbox I mentioned before (or a separate one) might make more sense and it can cover a few more scenarios.

Just to be clear, I am not saying is an easy change. I am just expressing what I think makes sense as behavior fpr covering multiple situations.

Thank you,

Adrian

 

You must be logged in to post in the forum