@@ -578,14 +578,14 @@ private dynamic ToDynamic(
578578
579579 #region gerneral data
580580
581- dynObject . Price = CalculatePrice ( ctx , product , combination != null ) ;
582-
583- if ( combination != null && ctx . Projection . AttributeCombinationValueMerging == ExportAttributeValueMerging . AppendAllValuesToName )
584- {
585- var values = _productAttributeParser . Value . ParseProductVariantAttributeValues ( combination . AttributesXml , productAttributes , ctx . Projection . LanguageId ?? 0 ) ;
581+ dynObject . _CategoryName = null ;
582+ dynObject . _CategoryPath = null ;
583+ dynObject . _AttributeCombination = null ;
584+ dynObject . _AttributeCombinationValues = null ;
585+ dynObject . _AttributeCombinationId = ( combination == null ? 0 : combination . Id ) ;
586+ dynObject . _DetailUrl = ctx . Store . Url . EnsureEndsWith ( "/" ) + ( string ) dynObject . SeName ;
586587
587- dynObject . Name = ( ( string ) dynObject . Name ) . Grow ( string . Join ( ", " , values ) , " " ) ;
588- }
588+ dynObject . Price = CalculatePrice ( ctx , product , combination != null ) ;
589589
590590 dynObject . _BasePriceInfo = product . GetBasePriceInfo ( _services . Localization , _priceFormatter . Value , _currencyService . Value , _taxService . Value ,
591591 _priceCalculationService . Value , ctx . ContextCurrency , decimal . Zero , true ) ;
@@ -595,21 +595,34 @@ private dynamic ToDynamic(
595595 else
596596 dynObject . _ProductTemplateViewPath = "" ;
597597
598- var detailUrl = ctx . Store . Url . EnsureEndsWith ( "/" ) + ( string ) dynObject . SeName ;
599-
600598 if ( combination != null )
601599 {
600+ if ( ctx . Supports ( ExportFeatures . UsesAttributeCombination ) ||
601+ ctx . Projection . AttributeCombinationValueMerging == ExportAttributeValueMerging . AppendAllValuesToName )
602+ {
603+ var variantAttributes = _productAttributeParser . Value . DeserializeProductVariantAttributes ( combination . AttributesXml ) ;
604+ var variantAttributeValues = _productAttributeParser . Value . ParseProductVariantAttributeValues ( variantAttributes , productAttributes , languageId ) ;
605+
606+ if ( ctx . Supports ( ExportFeatures . UsesAttributeCombination ) )
607+ {
608+ dynObject . _AttributeCombination = variantAttributes ;
609+ dynObject . _AttributeCombinationValues = variantAttributeValues ;
610+ }
611+
612+ if ( ctx . Projection . AttributeCombinationValueMerging == ExportAttributeValueMerging . AppendAllValuesToName )
613+ {
614+ dynObject . Name = ( ( string ) dynObject . Name ) . Grow ( string . Join ( ", " , variantAttributeValues ) , " " ) ;
615+ }
616+ }
617+
602618 var attributeQueryString = _productAttributeParser . Value . SerializeQueryData ( combination . AttributesXml , product . Id ) ;
603619 if ( attributeQueryString . HasValue ( ) )
604620 {
605- detailUrl = string . Concat ( detailUrl , detailUrl . Contains ( "?" ) ? "&" : "?" , "attributes=" , attributeQueryString ) ;
621+ var url = ( string ) dynObject . _DetailUrl ;
622+ dynObject . _DetailUrl = string . Concat ( url , url . Contains ( "?" ) ? "&" : "?" , "attributes=" , attributeQueryString ) ;
606623 }
607624 }
608625
609- dynObject . _IsChild = ( combination != null ) ;
610- dynObject . _DetailUrl = detailUrl ;
611- dynObject . _CategoryName = null ;
612-
613626 if ( ctx . Categories . Count > 0 )
614627 {
615628 dynObject . _CategoryPath = _categoryService . Value . GetCategoryPath (
@@ -621,13 +634,8 @@ private dynamic ToDynamic(
621634 productCategories . OrderBy ( x => x . DisplayOrder ) . FirstOrDefault ( )
622635 ) ;
623636 }
624- else
625- {
626- dynObject . _CategoryPath = null ;
627- }
628637
629638 ToDeliveryTime ( ctx , dynObject , product . DeliveryTimeId ) ;
630-
631639 ToQuantityUnit ( ctx , dynObject , product . QuantityUnitId ) ;
632640
633641 dynObject . ProductPictures = productPictures
0 commit comments