How to get attribute from OrderItems table to order list?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
4 years 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
4 years 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
                            }
                        }
4 years 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. ???
                        ...
4 years 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
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.