Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • James Dimmer 12 posts 155 karma points
    Nov 05, 2019 @ 12:50
    James Dimmer
    0

    ProductCollectionValueConverter

    Hi,

    I was wondering if anyone had experienced the following issue before and could help?

    I am using Merchello Core 2.7.1

    I have setup a document type which has a Product Collection Picker on it, this document type is used to display a listing of the products in a collection or an "All Products" listing.

    For the pages that use this document type and have a collection selected in the backoffice, the listings load correctly with no errors in the logs. However, for the "All Products" listing I have selected "All items" in the backoffice. When this page is loaded I get an error in the log file stating unrecognised Guid format.

    Merchello.Web.PropertyConverters.ProductCollectionValueConverter - Failed to Convert ProductCollection property System.FormatException: Unrecognized Guid format. at System.Guid.GuidResult.SetFailure(ParseFailureKind failure, String failureMessageID, Object failureMessageFormatArgument, String failureArgumentName, Exception innerException) at System.Guid.TryParseGuid(String g, GuidStyles flags, GuidResult& result) at System.Guid..ctor(String g) at Merchello.Web.PropertyConverters.ProductCollectionValueConverter.ConvertDataToSource(PublishedPropertyType propertyType, Object source, Boolean preview)

    I have looked into the Merchello v2.7.1 code and have ran Merchello locally to test. It appears that here in the ConvertDataToSource function:

            if (source == null)
                return null;
    
            try
            {
                var key = new Guid(source.ToString());
                var collection = MerchelloContext.Current.Services.EntityCollectionService.GetByKey(key);
                return collection != null ? new ProductCollection(collection) : null;
            }
            catch (Exception ex)
            {
                MultiLogHelper.Error<ProductCollectionValueConverter>("Failed to Convert ProductCollection property", ex);
                return null;
            }
    

    The source object is an empty string when selecting "All items". Is this correct?

    Thanks, James

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies