Product attribute stock quantity

1 个月 前
Hi,

Is it possible to add product attribute combination stock quantity after attribute name in _ProductAttributes.cshtml view?

In this line I would like to add @attributeName + (@stockquantity)
For example Tshirt size: M (5), L (2), XXL (0)..
<label for="@(controlId)_@(attributeValue.Id)">@attributeName</label>


case AttributeControlType.RadioList:
                            {
                                <ul data-attr="@(attribute.Id)" class="option-list">
                                    @foreach (var attributeValue in attribute.Values)
                                    {
                                        var attributeName = string.IsNullOrEmpty(attributeValue.PriceAdjustment) ?
                                            attributeValue.Name :
                                            T("Products.ProductAttributes.PriceAdjustment", attributeValue.Name, attributeValue.PriceAdjustment,
                                                attributeValue.CustomerEntersQty ? T("Products.ProductAttributes.PriceAdjustment.PerItem").Text : string.Empty).Text;
                                        <li data-attr-value="@attributeValue.Id">
                                            <input id="@(controlId)_@(attributeValue.Id)" type="radio" name="@(controlId)" value="@attributeValue.Id" checked="@attributeValue.IsPreSelected"
                                                   @(attribute.Values.Any(value => value.CustomerEntersQty) ? Html.Raw($"onclick=\"showHideRadioQuantity('{controlId}')\"") : null) />
                                            <label for="@(controlId)_@(attributeValue.Id)">@attributeName</label>
                                            

                                            @if (attributeValue.CustomerEntersQty)
                                            {
                                                <div class="qty-box" id="@(controlId)_@(attributeValue.Id)_qty_box" style="display:none">
                                                    <label for="@(controlId)_@(attributeValue.Id)_qty">@(T("Products.ProductAttributes.PriceAdjustment.Quantity").Text)</label>
                                                    <input type="text" name="@(controlId)_@(attributeValue.Id)_qty" id="@(controlId)_@(attributeValue.Id)_qty" value="@(attributeValue.Quantity)" />
                                                </div>
                                            }
                                        </li>
                                    }
                                </ul>
1 个月 前
Yes, you able to do this, just need custom code for that...and follow with nopcommerce code
Otherwise it will added in all attributes
DM for more need
1 个月 前
I made a solution in _ProductAttributes view using IProductAttributeService (GetAllProductAttributeCombinationsAsync)