@@ -106,27 +106,29 @@ protected virtual void WriteCategories(XmlWriter xmlWriter, int parentCategoryId
106106 foreach ( var category in categories )
107107 {
108108 xmlWriter . WriteStartElement ( "Category" ) ;
109- xmlWriter . WriteElementString ( "Id" , null , category . Id . ToString ( ) ) ;
110- xmlWriter . WriteElementString ( "Name" , null , category . Name ) ;
111- xmlWriter . WriteElementString ( "Description" , null , category . Description ) ;
112- xmlWriter . WriteElementString ( "CategoryTemplateId" , null , category . CategoryTemplateId . ToString ( ) ) ;
113- xmlWriter . WriteElementString ( "MetaKeywords" , null , category . MetaKeywords ) ;
114- xmlWriter . WriteElementString ( "MetaDescription" , null , category . MetaDescription ) ;
115- xmlWriter . WriteElementString ( "MetaTitle" , null , category . MetaTitle ) ;
116- xmlWriter . WriteElementString ( "SeName" , null , category . GetSeName ( 0 ) ) ;
117- xmlWriter . WriteElementString ( "ParentCategoryId" , null , category . ParentCategoryId . ToString ( ) ) ;
118- xmlWriter . WriteElementString ( "PictureId" , null , category . PictureId . ToString ( ) ) ;
119- xmlWriter . WriteElementString ( "PageSize" , null , category . PageSize . ToString ( ) ) ;
120- xmlWriter . WriteElementString ( "AllowCustomersToSelectPageSize" , null , category . AllowCustomersToSelectPageSize . ToString ( ) ) ;
121- xmlWriter . WriteElementString ( "PageSizeOptions" , null , category . PageSizeOptions ) ;
122- xmlWriter . WriteElementString ( "PriceRanges" , null , category . PriceRanges ) ;
123- xmlWriter . WriteElementString ( "ShowOnHomePage" , null , category . ShowOnHomePage . ToString ( ) ) ;
124- xmlWriter . WriteElementString ( "IncludeInTopMenu" , null , category . IncludeInTopMenu . ToString ( ) ) ;
125- xmlWriter . WriteElementString ( "Published" , null , category . Published . ToString ( ) ) ;
126- xmlWriter . WriteElementString ( "Deleted" , null , category . Deleted . ToString ( ) ) ;
127- xmlWriter . WriteElementString ( "DisplayOrder" , null , category . DisplayOrder . ToString ( ) ) ;
128- xmlWriter . WriteElementString ( "CreatedOnUtc" , null , category . CreatedOnUtc . ToString ( ) ) ;
129- xmlWriter . WriteElementString ( "UpdatedOnUtc" , null , category . UpdatedOnUtc . ToString ( ) ) ;
109+
110+ xmlWriter . WriteString ( "Id" , category . Id ) ;
111+
112+ xmlWriter . WriteString ( "Name" , category . Name ) ;
113+ xmlWriter . WriteString ( "Description" , category . Description ) ;
114+ xmlWriter . WriteString ( "CategoryTemplateId" , category . CategoryTemplateId ) ;
115+ xmlWriter . WriteString ( "MetaKeywords" , category . MetaKeywords , IgnoreExportCategoryProperty ( ) ) ;
116+ xmlWriter . WriteString ( "MetaDescription" , category . MetaDescription , IgnoreExportCategoryProperty ( ) ) ;
117+ xmlWriter . WriteString ( "MetaTitle" , category . MetaTitle , IgnoreExportCategoryProperty ( ) ) ;
118+ xmlWriter . WriteString ( "SeName" , category . GetSeName ( 0 ) , IgnoreExportCategoryProperty ( ) ) ;
119+ xmlWriter . WriteString ( "ParentCategoryId" , category . ParentCategoryId ) ;
120+ xmlWriter . WriteString ( "PictureId" , category . PictureId ) ;
121+ xmlWriter . WriteString ( "PageSize" , category . PageSize , IgnoreExportCategoryProperty ( ) ) ;
122+ xmlWriter . WriteString ( "AllowCustomersToSelectPageSize" , category . AllowCustomersToSelectPageSize , IgnoreExportCategoryProperty ( ) ) ;
123+ xmlWriter . WriteString ( "PageSizeOptions" , category . PageSizeOptions , IgnoreExportCategoryProperty ( ) ) ;
124+ xmlWriter . WriteString ( "PriceRanges" , category . PriceRanges , IgnoreExportCategoryProperty ( ) ) ;
125+ xmlWriter . WriteString ( "ShowOnHomePage" , category . ShowOnHomePage , IgnoreExportCategoryProperty ( ) ) ;
126+ xmlWriter . WriteString ( "IncludeInTopMenu" , category . IncludeInTopMenu , IgnoreExportCategoryProperty ( ) ) ;
127+ xmlWriter . WriteString ( "Published" , category . Published , IgnoreExportCategoryProperty ( ) ) ;
128+ xmlWriter . WriteString ( "Deleted" , category . Deleted , true ) ;
129+ xmlWriter . WriteString ( "DisplayOrder" , category . DisplayOrder ) ;
130+ xmlWriter . WriteString ( "CreatedOnUtc" , category . CreatedOnUtc , IgnoreExportCategoryProperty ( ) ) ;
131+ xmlWriter . WriteString ( "UpdatedOnUtc" , category . UpdatedOnUtc , IgnoreExportCategoryProperty ( ) ) ;
130132
131133 xmlWriter . WriteStartElement ( "Products" ) ;
132134 var productCategories = _categoryService . GetProductCategoriesByCategoryId ( category . Id , showHidden : true ) ;
@@ -136,11 +138,11 @@ protected virtual void WriteCategories(XmlWriter xmlWriter, int parentCategoryId
136138 if ( product != null && ! product . Deleted )
137139 {
138140 xmlWriter . WriteStartElement ( "ProductCategory" ) ;
139- xmlWriter . WriteElementString ( "ProductCategoryId" , null , productCategory . Id . ToString ( ) ) ;
140- xmlWriter . WriteElementString ( "ProductId" , null , productCategory . ProductId . ToString ( ) ) ;
141- xmlWriter . WriteElementString ( "ProductName" , null , product . Name ) ;
142- xmlWriter . WriteElementString ( "IsFeaturedProduct" , null , productCategory . IsFeaturedProduct . ToString ( ) ) ;
143- xmlWriter . WriteElementString ( "DisplayOrder" , null , productCategory . DisplayOrder . ToString ( ) ) ;
141+ xmlWriter . WriteString ( "ProductCategoryId" , productCategory . Id ) ;
142+ xmlWriter . WriteString ( "ProductId" , productCategory . ProductId ) ;
143+ xmlWriter . WriteString ( "ProductName" , product . Name ) ;
144+ xmlWriter . WriteString ( "IsFeaturedProduct" , productCategory . IsFeaturedProduct ) ;
145+ xmlWriter . WriteString ( "DisplayOrder" , productCategory . DisplayOrder ) ;
144146 xmlWriter . WriteEndElement ( ) ;
145147 }
146148 }
@@ -257,7 +259,17 @@ private bool IgnoreExportPoductProperty(Func<ProductEditorSettings, bool> func)
257259 var productAdvancedMode = _workContext . CurrentCustomer . GetAttribute < bool > ( "product-advanced-mode" ) ;
258260 return ! productAdvancedMode && ! func ( _productEditorSettings ) ;
259261 }
260-
262+
263+ private bool IgnoreExportCategoryProperty ( )
264+ {
265+ return ! _workContext . CurrentCustomer . GetAttribute < bool > ( "category-advanced-mode" ) ;
266+ }
267+
268+ private bool IgnoreExportManufacturerProperty ( )
269+ {
270+ return ! _workContext . CurrentCustomer . GetAttribute < bool > ( "manufacturer-advanced-mode" ) ;
271+ }
272+
261273 /// <summary>
262274 /// Export objects to XLSX
263275 /// </summary>
@@ -277,11 +289,11 @@ protected virtual byte[] ExportToXlsx<T>(PropertyByName<T>[] properties, IEnumer
277289
278290 // get handles to the worksheets
279291 var worksheet = xlPackage . Workbook . Worksheets . Add ( typeof ( T ) . Name ) ;
280- var fWorksheet = xlPackage . Workbook . Worksheets . Add ( "DataForProductsFilters " ) ;
292+ var fWorksheet = xlPackage . Workbook . Worksheets . Add ( "DataForFilters " ) ;
281293 fWorksheet . Hidden = eWorkSheetHidden . VeryHidden ;
282294
283295 //create Headers and format them
284- var manager = new PropertyManager < T > ( properties . Where ( p => ! p . Ignore ) . ToArray ( ) ) ;
296+ var manager = new PropertyManager < T > ( properties . Where ( p => ! p . Ignore ) ) ;
285297 manager . WriteCaption ( worksheet , SetCaptionStyle ) ;
286298
287299 var row = 2 ;
@@ -347,7 +359,7 @@ private byte[] ExportProductsToXlsxWithAttributes(PropertyByName<Product>[] prop
347359 faWorksheet . Hidden = eWorkSheetHidden . VeryHidden ;
348360
349361 //create Headers and format them
350- var manager = new PropertyManager < Product > ( properties . Where ( p => ! p . Ignore ) . ToArray ( ) ) ;
362+ var manager = new PropertyManager < Product > ( properties . Where ( p => ! p . Ignore ) ) ;
351363 manager . WriteCaption ( worksheet , SetCaptionStyle ) ;
352364
353365 var row = 2 ;
@@ -437,29 +449,29 @@ public virtual string ExportManufacturersToXml(IList<Manufacturer> manufacturers
437449 xmlWriter . WriteStartDocument ( ) ;
438450 xmlWriter . WriteStartElement ( "Manufacturers" ) ;
439451 xmlWriter . WriteAttributeString ( "Version" , NopVersion . CurrentVersion ) ;
440-
452+
441453 foreach ( var manufacturer in manufacturers )
442454 {
443455 xmlWriter . WriteStartElement ( "Manufacturer" ) ;
444456
445- xmlWriter . WriteElementString ( "ManufacturerId" , null , manufacturer . Id . ToString ( ) ) ;
446- xmlWriter . WriteElementString ( "Name" , null , manufacturer . Name ) ;
447- xmlWriter . WriteElementString ( "Description" , null , manufacturer . Description ) ;
448- xmlWriter . WriteElementString ( "ManufacturerTemplateId" , null , manufacturer . ManufacturerTemplateId . ToString ( ) ) ;
449- xmlWriter . WriteElementString ( "MetaKeywords" , null , manufacturer . MetaKeywords ) ;
450- xmlWriter . WriteElementString ( "MetaDescription" , null , manufacturer . MetaDescription ) ;
451- xmlWriter . WriteElementString ( "MetaTitle" , null , manufacturer . MetaTitle ) ;
452- xmlWriter . WriteElementString ( "SEName" , null , manufacturer . GetSeName ( 0 ) ) ;
453- xmlWriter . WriteElementString ( "PictureId" , null , manufacturer . PictureId . ToString ( ) ) ;
454- xmlWriter . WriteElementString ( "PageSize" , null , manufacturer . PageSize . ToString ( ) ) ;
455- xmlWriter . WriteElementString ( "AllowCustomersToSelectPageSize" , null , manufacturer . AllowCustomersToSelectPageSize . ToString ( ) ) ;
456- xmlWriter . WriteElementString ( "PageSizeOptions" , null , manufacturer . PageSizeOptions ) ;
457- xmlWriter . WriteElementString ( "PriceRanges" , null , manufacturer . PriceRanges ) ;
458- xmlWriter . WriteElementString ( "Published" , null , manufacturer . Published . ToString ( ) ) ;
459- xmlWriter . WriteElementString ( "Deleted" , null , manufacturer . Deleted . ToString ( ) ) ;
460- xmlWriter . WriteElementString ( "DisplayOrder" , null , manufacturer . DisplayOrder . ToString ( ) ) ;
461- xmlWriter . WriteElementString ( "CreatedOnUtc" , null , manufacturer . CreatedOnUtc . ToString ( ) ) ;
462- xmlWriter . WriteElementString ( "UpdatedOnUtc" , null , manufacturer . UpdatedOnUtc . ToString ( ) ) ;
457+ xmlWriter . WriteString ( "ManufacturerId" , manufacturer . Id ) ;
458+ xmlWriter . WriteString ( "Name" , manufacturer . Name ) ;
459+ xmlWriter . WriteString ( "Description" , manufacturer . Description ) ;
460+ xmlWriter . WriteString ( "ManufacturerTemplateId" , manufacturer . ManufacturerTemplateId ) ;
461+ xmlWriter . WriteString ( "MetaKeywords" , manufacturer . MetaKeywords , IgnoreExportManufacturerProperty ( ) ) ;
462+ xmlWriter . WriteString ( "MetaDescription" , manufacturer . MetaDescription , IgnoreExportManufacturerProperty ( ) ) ;
463+ xmlWriter . WriteString ( "MetaTitle" , manufacturer . MetaTitle , IgnoreExportManufacturerProperty ( ) ) ;
464+ xmlWriter . WriteString ( "SEName" , manufacturer . GetSeName ( 0 ) , IgnoreExportManufacturerProperty ( ) ) ;
465+ xmlWriter . WriteString ( "PictureId" , manufacturer . PictureId ) ;
466+ xmlWriter . WriteString ( "PageSize" , manufacturer . PageSize , IgnoreExportManufacturerProperty ( ) ) ;
467+ xmlWriter . WriteString ( "AllowCustomersToSelectPageSize" , manufacturer . AllowCustomersToSelectPageSize , IgnoreExportManufacturerProperty ( ) ) ;
468+ xmlWriter . WriteString ( "PageSizeOptions" , manufacturer . PageSizeOptions , IgnoreExportManufacturerProperty ( ) ) ;
469+ xmlWriter . WriteString ( "PriceRanges" , manufacturer . PriceRanges , IgnoreExportManufacturerProperty ( ) ) ;
470+ xmlWriter . WriteString ( "Published" , manufacturer . Published , IgnoreExportManufacturerProperty ( ) ) ;
471+ xmlWriter . WriteString ( "Deleted" , manufacturer . Deleted , true ) ;
472+ xmlWriter . WriteString ( "DisplayOrder" , manufacturer . DisplayOrder ) ;
473+ xmlWriter . WriteString ( "CreatedOnUtc" , manufacturer . CreatedOnUtc , IgnoreExportManufacturerProperty ( ) ) ;
474+ xmlWriter . WriteString ( "UpdatedOnUtc" , manufacturer . UpdatedOnUtc , IgnoreExportManufacturerProperty ( ) ) ;
463475
464476 xmlWriter . WriteStartElement ( "Products" ) ;
465477 var productManufacturers = _manufacturerService . GetProductManufacturersByManufacturerId ( manufacturer . Id , showHidden : true ) ;
@@ -471,11 +483,11 @@ public virtual string ExportManufacturersToXml(IList<Manufacturer> manufacturers
471483 if ( product != null && ! product . Deleted )
472484 {
473485 xmlWriter . WriteStartElement ( "ProductManufacturer" ) ;
474- xmlWriter . WriteElementString ( "ProductManufacturerId" , null , productManufacturer . Id . ToString ( ) ) ;
475- xmlWriter . WriteElementString ( "ProductId" , null , productManufacturer . ProductId . ToString ( ) ) ;
476- xmlWriter . WriteElementString ( "ProductName" , null , product . Name ) ;
477- xmlWriter . WriteElementString ( "IsFeaturedProduct" , null , productManufacturer . IsFeaturedProduct . ToString ( ) ) ;
478- xmlWriter . WriteElementString ( "DisplayOrder" , null , productManufacturer . DisplayOrder . ToString ( ) ) ;
486+ xmlWriter . WriteString ( "ProductManufacturerId" , productManufacturer . Id ) ;
487+ xmlWriter . WriteString ( "ProductId" , productManufacturer . ProductId ) ;
488+ xmlWriter . WriteString ( "ProductName" , product . Name ) ;
489+ xmlWriter . WriteString ( "IsFeaturedProduct" , productManufacturer . IsFeaturedProduct ) ;
490+ xmlWriter . WriteString ( "DisplayOrder" , productManufacturer . DisplayOrder ) ;
479491 xmlWriter . WriteEndElement ( ) ;
480492 }
481493 }
@@ -504,16 +516,16 @@ public virtual byte[] ExportManufacturersToXlsx(IEnumerable<Manufacturer> manufa
504516 new PropertyByName < Manufacturer > ( "Name" , p => p . Name ) ,
505517 new PropertyByName < Manufacturer > ( "Description" , p => p . Description ) ,
506518 new PropertyByName < Manufacturer > ( "ManufacturerTemplateId" , p => p . ManufacturerTemplateId ) ,
507- new PropertyByName < Manufacturer > ( "MetaKeywords" , p => p . MetaKeywords ) ,
508- new PropertyByName < Manufacturer > ( "MetaDescription" , p => p . MetaDescription ) ,
509- new PropertyByName < Manufacturer > ( "MetaTitle" , p => p . MetaTitle ) ,
510- new PropertyByName < Manufacturer > ( "SeName" , p => p . GetSeName ( 0 ) ) ,
519+ new PropertyByName < Manufacturer > ( "MetaKeywords" , p => p . MetaKeywords , IgnoreExportManufacturerProperty ( ) ) ,
520+ new PropertyByName < Manufacturer > ( "MetaDescription" , p => p . MetaDescription , IgnoreExportManufacturerProperty ( ) ) ,
521+ new PropertyByName < Manufacturer > ( "MetaTitle" , p => p . MetaTitle , IgnoreExportManufacturerProperty ( ) ) ,
522+ new PropertyByName < Manufacturer > ( "SeName" , p => p . GetSeName ( 0 ) , IgnoreExportManufacturerProperty ( ) ) ,
511523 new PropertyByName < Manufacturer > ( "Picture" , p => GetPictures ( p . PictureId ) ) ,
512- new PropertyByName < Manufacturer > ( "PageSize" , p => p . PageSize ) ,
513- new PropertyByName < Manufacturer > ( "AllowCustomersToSelectPageSize" , p => p . AllowCustomersToSelectPageSize ) ,
514- new PropertyByName < Manufacturer > ( "PageSizeOptions" , p => p . PageSizeOptions ) ,
515- new PropertyByName < Manufacturer > ( "PriceRanges" , p => p . PriceRanges ) ,
516- new PropertyByName < Manufacturer > ( "Published" , p => p . Published ) ,
524+ new PropertyByName < Manufacturer > ( "PageSize" , p => p . PageSize , IgnoreExportManufacturerProperty ( ) ) ,
525+ new PropertyByName < Manufacturer > ( "AllowCustomersToSelectPageSize" , p => p . AllowCustomersToSelectPageSize , IgnoreExportManufacturerProperty ( ) ) ,
526+ new PropertyByName < Manufacturer > ( "PageSizeOptions" , p => p . PageSizeOptions , IgnoreExportManufacturerProperty ( ) ) ,
527+ new PropertyByName < Manufacturer > ( "PriceRanges" , p => p . PriceRanges , IgnoreExportManufacturerProperty ( ) ) ,
528+ new PropertyByName < Manufacturer > ( "Published" , p => p . Published , IgnoreExportManufacturerProperty ( ) ) ,
517529 new PropertyByName < Manufacturer > ( "DisplayOrder" , p => p . DisplayOrder )
518530 } ;
519531
@@ -552,19 +564,19 @@ public virtual byte[] ExportCategoriesToXlsx(IEnumerable<Category> categories)
552564 new PropertyByName < Category > ( "Name" , p => p . Name ) ,
553565 new PropertyByName < Category > ( "Description" , p => p . Description ) ,
554566 new PropertyByName < Category > ( "CategoryTemplateId" , p => p . CategoryTemplateId ) ,
555- new PropertyByName < Category > ( "MetaKeywords" , p => p . MetaKeywords ) ,
556- new PropertyByName < Category > ( "MetaDescription" , p => p . MetaDescription ) ,
557- new PropertyByName < Category > ( "MetaTitle" , p => p . MetaTitle ) ,
558- new PropertyByName < Category > ( "SeName" , p => p . GetSeName ( 0 ) ) ,
567+ new PropertyByName < Category > ( "MetaKeywords" , p => p . MetaKeywords , IgnoreExportCategoryProperty ( ) ) ,
568+ new PropertyByName < Category > ( "MetaDescription" , p => p . MetaDescription , IgnoreExportCategoryProperty ( ) ) ,
569+ new PropertyByName < Category > ( "MetaTitle" , p => p . MetaTitle , IgnoreExportCategoryProperty ( ) ) ,
570+ new PropertyByName < Category > ( "SeName" , p => p . GetSeName ( 0 ) , IgnoreExportCategoryProperty ( ) ) ,
559571 new PropertyByName < Category > ( "ParentCategoryId" , p => p . ParentCategoryId ) ,
560572 new PropertyByName < Category > ( "Picture" , p => GetPictures ( p . PictureId ) ) ,
561- new PropertyByName < Category > ( "PageSize" , p => p . PageSize ) ,
562- new PropertyByName < Category > ( "AllowCustomersToSelectPageSize" , p => p . AllowCustomersToSelectPageSize ) ,
563- new PropertyByName < Category > ( "PageSizeOptions" , p => p . PageSizeOptions ) ,
564- new PropertyByName < Category > ( "PriceRanges" , p => p . PriceRanges ) ,
565- new PropertyByName < Category > ( "ShowOnHomePage" , p => p . ShowOnHomePage ) ,
566- new PropertyByName < Category > ( "IncludeInTopMenu" , p => p . IncludeInTopMenu ) ,
567- new PropertyByName < Category > ( "Published" , p => p . Published ) ,
573+ new PropertyByName < Category > ( "PageSize" , p => p . PageSize , IgnoreExportCategoryProperty ( ) ) ,
574+ new PropertyByName < Category > ( "AllowCustomersToSelectPageSize" , p => p . AllowCustomersToSelectPageSize , IgnoreExportCategoryProperty ( ) ) ,
575+ new PropertyByName < Category > ( "PageSizeOptions" , p => p . PageSizeOptions , IgnoreExportCategoryProperty ( ) ) ,
576+ new PropertyByName < Category > ( "PriceRanges" , p => p . PriceRanges , IgnoreExportCategoryProperty ( ) ) ,
577+ new PropertyByName < Category > ( "ShowOnHomePage" , p => p . ShowOnHomePage , IgnoreExportCategoryProperty ( ) ) ,
578+ new PropertyByName < Category > ( "IncludeInTopMenu" , p => p . IncludeInTopMenu , IgnoreExportCategoryProperty ( ) ) ,
579+ new PropertyByName < Category > ( "Published" , p => p . Published , IgnoreExportCategoryProperty ( ) ) ,
568580 new PropertyByName < Category > ( "DisplayOrder" , p => p . DisplayOrder )
569581 } ;
570582 return ExportToXlsx ( properties , categories ) ;
0 commit comments