November Happy Hour will be moved to Thursday December 5th.

Dictionary not shown alphabetical in Catalogue View

Vote:
 

We are running our application on Commerce 7.7.2.

We have a dictionary property specified as below:

[Display(Name = "Medietyp",
            Order = 270)]
        [BackingType(typeof(PropertyDictionaryMultiple))]
        public virtual ItemCollection Medium { get; set; }

All the values are shown alphabetically in the Commerce Manager site, but in the Catalogue View all the values are not shown alphabetically. Since our customer has over 400 values for this property it makes it difficult to locate what values to fill in.

I guess this is a bug (?) or should they be sorted on latest added which I assume it is now? Despite cause I need to sort all the values alphabetically and wonder how I may accomplish that?

I assume that I have to unzip the zip file located in "modules\_protected\CMS\EPiServer.Cms.Shell.UI", and then locate the correct ascx, which I cant seem to find. I have been looking here in the unzipped file "\EPiServer.Cms.Shell.UI\Util\Views\Shared\DisplayTemplates" but don't find any for the dictionary (?).

Any help much appreciated.

/J

#114505
Dec 14, 2014 13:51
Vote:
 

Hi,

Unfortunately with new Catalog UI there's no ascx involved, so you won't be able to modify the list that way.

For the behaviour you're seeing, I can say that's not a bug as the list of item will be displayed as you added it in Commerce Manager. 

For your case, a workaround can be used - althought it's not officially recommended by EPiServer but it seems to work for you: You can update the mdpsp_sys_LoadMetaDictionary stored procedures to this:

ALTER PROCEDURE [dbo].[mdpsp_sys_LoadMetaDictionary]
	@MetaFieldId	INT,
	@Language	NVARCHAR(20)=NULL
AS
	DECLARE @MultiLanguageValue BIT

	SELECT @MultiLanguageValue = MultiLanguageValue FROM MetaField
	WHERE MetaFieldId = @MetaFieldId

	IF @Language IS NOT NULL AND @MultiLanguageValue = 1
	BEGIN
		SELECT MD.MetaDictionaryId, MD.MetaFieldId, MD.[Value] as DefaultValue,  MDL.Value  as Value, MDL.Tag as Tag
		FROM MetaDictionary MD
			LEFT JOIN MetaDictionaryLocalization MDL ON MDL.MetaDictionaryId = MD.MetaDictionaryId
		WHERE MD.MetaFieldId = @MetaFieldId AND MDL.Language = @Language
		ORDER BY MDL.Value
	END
	ELSE
	BEGIN
		SELECT MetaDictionaryId, MetaFieldId, [Value] as DefaultValue, Tag as DefaultTag, [Value] as Value, Tag as Tag
		FROM MetaDictionary
		WHERE MetaFieldId = @MetaFieldId
		ORDER BY [Value]
	END

You might need to restart your site.

Disclaimer: The above workaround is my personal advice. It's not recommeded by EPiServer to work directly with our stored procedures. Back up your database and use it with your own risks.

Regards.

/Q

#114531
Edited, Dec 15, 2014 10:08
Vote:
 

Great, thanks for this solution!

/J

#114615
Dec 16, 2014 12:00
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.