How to get attribute from OrderItems table to order list?

1 month ago
How to get attribute value ID=22 and ID=23 from OrderItems table to order list?


Nop.Admin (OrderController.cs)



             var gridModel = new DataSourceResult
            {
                Data = orders.Select(x =>                                
                {
                    var store = _storeService.GetStoreById(x.StoreId);
                    return new OrderModel
                    {
                        Id = x.Id,
                        TimeRecord = x. ???
                        ...



<Attributes><ProductAttribute ID="22"><ProductAttributeValue><Value>пятница, 28 февраля 2020 г.</Value></ProductAttributeValue></ProductAttribute><ProductAttribute ID="23"><ProductAttributeValue><Value>17:00-18:30</Value></ProductAttributeValue></ProductAttribute></Attributes>


Thanks
1 month ago
use some variation of the Product Attribute Parser?


var combination = _productAttributeParser.FindProductAttributeCombination(orderItem.Product, orderItem.AttributesXml);
                        if (combination != null)
                        {
                            //combination exists
                            if (combination.Id == 23 || combination.Id == 24)
                            {
                                //get date
                            }
                        }
1 month ago
af1racing wrote:
use some variation of the Product Attribute Parser?


var combination = _productAttributeParser.FindProductAttributeCombination(orderItem.Product, orderItem.AttributesXml);
                        if (combination != null)
                        {
                            //combination exists
                            if (combination.Id == 23 || combination.Id == 24)
                            {
                                //get date
                            }
                        }


Sorry. How to implement this correctly in the function public virtual ActionResult OrderList (DataSourceRequest command, OrderListModel model) where there is a question mark


public virtual ActionResult OrderList(DataSourceRequest command, OrderListModel model)
        {
              ...
            var gridModel = new DataSourceResult
            {
                Data = orders.Select(x =>                                
                {
                    var store = _storeService.GetStoreById(x.StoreId);
                    return new OrderModel
                    {
                        Id = x.Id,
                        TimeRecord = x. ???
                        ...
1 month ago
gnikitsin wrote:
use some variation of the Product Attribute Parser?


var combination = _productAttributeParser.FindProductAttributeCombination(orderItem.Product, orderItem.AttributesXml);
                        if (combination != null)
                        {
                            //combination exists
                            if (combination.Id == 23 || combination.Id == 24)
                            {
                                //get date
                            }
                        }


Sorry. How to implement this correctly in the function public virtual ActionResult OrderList (DataSourceRequest command, OrderListModel model) where there is a question mark


public virtual ActionResult OrderList(DataSourceRequest command, OrderListModel model)
        {
              ...
            var gridModel = new DataSourceResult
            {
                Data = orders.Select(x =>                                
                {
                    var store = _storeService.GetStoreById(x.StoreId);
                    return new OrderModel
                    {
                        Id = x.Id,
                        TimeRecord = x. ???
                        ...


Thanksl. Solved the problem