Upgrade from 8.7.1 to 8.15
Seems that somethings changed.
Variation.ItemAttributes.MaxQuantity and MinQuantity is always 0 after upgrade. Even if in the database and Catalog UI the values are set. In the database table "Variation" the value is set to 1 and 30.
What to do?
Even the Weight object is Null, thought is a value 1 in database. If i run sql "exec ecf_CatalogEntry @CatalogEntryId=1361,@ReturnInactive=0,@ResponseGroup=4"
The third return is (observe only MerchantId is Null)
CatalogEntryId ListPrice TaxCategoryId TrackInventory MerchantId WarehouseId Weight PackageId MinQuantity MaxQuantity Length Height Width
1361 0,00 0 0 NULL 0 1 0 1,00 30,00 0 0 0
You meant the Entry object?
Previously some methods in ICatalogSystem will return CatalogEntryFull if no responseGroup is not supplied. This is incorrect and we decided to change it.
So you can explicitly pass the CatalogResponseGroup.Variations to your method call.
What is best practice then with webforms?
I am inheriting from BaseEntryTemplate, for the Entry Object. On ProductTemplate.ascx i need to list all variations:
Im using the base.Entry to retrieve the actual entry.
foreach (var ProductVariation in base.Entry.Entries.Entry.Where(x => x.IsActive == true))
var min = ProductVariation.ItemAttributes.MinQuantity //not working
var newvari = CatalogContext.Current.GetCatalogEntry(ProductVariation.CatalogEntryId, new CatalogEntryResponseGroup(CatalogEntryResponseGroup.ResponseGroup.Variations));
min = newvari.ItemAttributes.MinQuantity // working good
Is this the best practice then?
I don't think we have a best practice for this, but if you can - stick with content APIs, unless you really need to entry object.
The first one requires you to use CatalogEntryFull or RecursiveAssociations responsegroup, but as it loads in batch so it can have better performance than the second approach - but you should try it for sure.