Basket related changes.

 Ticket 69559: 3.3. DISPLAY STOCK FOR EACH ITEM IN BASKET https://sanacommerce.visualstudio.com/Sana%20Projects/_workitems/edit/69559/




1.BasketInfoCellContext


public class BasketInfoCellContext
    {
        public ISalesLine Line { getset; }
        public string ProductUrl { getset; }
        public string ProductTitle { getset; }
        public string ProductId { getset; }
        //[69559]3.3. DISPLAY STOCK FOR EACH ITEM IN BASKET
        public StockModel StockModel { get; set; }
        public bool ReadOnly { getset; }
        public IList<ISalesLine> ExtendedLines { getset; }
        public bool SingleLineMode { getset; }
        public bool HasComponentTitle { getset; }
        public int LineIndex { getset; }
        public string ConfiguredProductDescription { getset; }
    }

2.BasketExtensions.cs

Add new infoCell  method

public static IHtmlString InfoCell(this HtmlHelper htmlHelper, ISalesLine line, string productUrl,
            string productTitle, string productId, bool readOnly, IList<ISalesLine> extendedLines = null,
            bool singleLineMode = truebool hasComponentTitle = falseint lineIndex = 0,
            string configuredProductDescription = nullStockModel stockModel = null)
        {
            var context = new BasketInfoCellContext
            {
                Line = line,
                ProductUrl = productUrl,
                ProductTitle = productTitle,
                ProductId = productId,
                ReadOnly = readOnly,
                ExtendedLines = extendedLines,
                SingleLineMode = singleLineMode,
                HasComponentTitle = hasComponentTitle,
                LineIndex = lineIndex,
                ConfiguredProductDescription = configuredProductDescription,
                //[69559]3.3. DISPLAY STOCK FOR EACH ITEM IN BASKET
                StockModel =stockModel
            };
            return CompiledHelpers.Themed(BasketHelpers.InfoCell, context);
        }


3._BasketLinesB2B.cshtml

@helper SimpleProductLine(SimpleProductLine productLine)
{
var line = productLine.SalesLine;
//[69559]3.3. DISPLAY STOCK FOR EACH ITEM IN BASKET
int productQuantity = (int)CommerceFrameworkBase.Stock.GetStockInfo(@line.ProductId, new StockInfoLoadOptions()).FirstOrDefault().Inventory;
var product = CommerceFrameworkBase.Products.GetProduct(line.ProductId, new ProductLoadOptions());
var stockRange = CommerceFrameworkBase.Stock.GetStockRangeFor(product);
var stockModel = new StockModel();
stockModel.StockRange = stockRange;
stockModel.Inventory = productQuantity;
var productUrl = productLine.Product != null && productLine.Product.Visible ? Url.Sana.Product(productLine.Product) : null;
var index = Next();
    <tr class="upper-row row-simple-product" data-productid="@line.ProductId" data-unitofmeasureid="@line.UnitOfMeasureId"
        data-salesagreementlineno="@line.SalesAgreementLineNo"
        data-tracking-data="@productLine.ProductTrackingDataModel.ToJson(encode: true)">
        <td class="col-first">
            @if (Model.ShowImages)
            {
                @Html.ImageCell(productLine.DisplayImage, productUrl, line.ProductTitle)
            }
        </td>
        <td class="col-info clearfix">
            @Html.InfoCell(line,
                            productUrl,
                            line.ProductTitle,
                            line.ProductId,
                            line.IsNonEditableItem,
                            productLine.ExtendedTexts,
                            lineIndex: index,
                            configuredProductDescription: productLine.ConfiguredProductDescription,
                            stockModel:stockModel                            
                            )
        </td>
        <td class="col-price">


BasketHelpers.cshtml


Add stock lable to quick order.

Ravensburg  Ticket 113689: [Ravensburger - Phase 2] 3.1. Display stock availability in the shopping cart. 
 

go to :https://www.blogger.com/blog/post/edit/7752405819139694131/7793167428942590653
search :Quick order / knowkout add variable to quick order