Developer forum

Forum » Templates » VariantStockCombinations documentation

VariantStockCombinations documentation

Martin Grønbekk Moen
Martin Grønbekk Moen
Reply

Cant find any docmentation regarding which fields that are available in the VariantStockCombinations loop.
Can someone post a list?


Replies

 
Nicolai Pedersen
Reply

Hi Martin

You can always get a list of available tags and their values using TemplateTags() method: https://doc.dynamicweb.com/template-tags/introduction/helper-tags/templatetags

This is the list for this loop:

  • Ecom:VariantStockCombination.VariantID
  • Ecom:VariantStockCombination.Product.Name
  • Ecom:VariantStockCombination.Product.Number
  • Ecom:VariantStockCombination.Stock
  • Ecom:VariantStockCombination.ReservedAmount
  • Ecom:VariantStockCombination.AvailableAmount
 
Martin Grønbekk Moen
Martin Grønbekk Moen
Reply

Thanks Nicolai!
Usually I can use TemplateTags() but in my Rapido solution when I try to use it the whole site freeze...

Another quick question, are there any loops that can give me information about the status of the variant option?
With this I mean if the variantoption is disabled or not.

 
Nicolai Pedersen
Reply

Hi Martin

An option cannot be inactive.

You have variant groups (I.e. Colors, Sizes) and you have options in those groups (ie. Blue, red and S, M, L). Those are the available variant definitions and they are 'global'.

On the product you define the variant dimensions by adding variant groups - i.e. Colors and sizes, and you define the possible Variant Combinations - i.e. Blue-Small, Blue-Medium and Red-Large. It is the combinations that are in the VariantStockCombinations loop - in this example 3 in total.

So in this case both Small, medium and large variant options are in use - but it depends on the other dimension, colors, weather it is valid or not for the current product.

So if Red is chosen, Large is valid - but if Blue is chosen, Small and Medium are valid and large is not. On top of this logic - which just handles if the combination has been defined - you can also add a stock check if a given combination is in stock and what should happen then.

So you need to build some logic into the UI in order to support this using both VariantGroups, Options and Combination loops.

So you have data like this

  • Color
    • Blue
    • Red
  • Size
    • Small
    • Medium
    • Large
  • Combinations
    • Blue.Small
    • Blue.Medium
    • Red.Large

Logic: If Blue is chosen, small and Medium is active - if Red is chosen, Large is active.

BR Nicolai

 
Martin Grønbekk Moen
Martin Grønbekk Moen
Reply

I understand that, but there is an option in the administration that allows to set the value "Aktiv Type" (True/False). Please see screenshot 1.

Here you can see that the option is disabled, and I dont want it to show in the frontend. Also tried to write a query in the index to remove non active products, but the option is still available.
Also found this option (screenshot 2), and thought that would remove those disabled options, but it did not help...

2018-09-20_1313.png 2018-09-20_1318.png
 
Nicolai Pedersen
Reply

Hi Martin

That active flag is on a variant product record - not a combination record, nor a variant option.

In the product template you also have a Variants loop that contains the entire variant product record - and that you can look at to 'disable' it.

"Only show variants that are acvtive" flag is related to the old database driven product list - and maybe variants loop. So that flag will not have any impact on search results based on the index - you would need to add an expression to filter them out of the product list (Rapido should have that by default). But again - that will NOT affect the groups, options and combination loops.

BR Nicolai

 
Nicolai Pedersen
Reply

Also be aware that there is a significant difference between VariantCombinations loop and VariantStockCombinations loops. The first contains a lot of information - including the variant product record and the active flag - the VariantStockCombinations is an optimized loop for giving you stock levels for all combinations.

 

You must be logged in to post in the forum