Display product specifications on product box

6 Monate weitere
Hey, i'm looking to make a code which will provide product specifications in _productbox.cshtml
I Allready made it via NOP-Templates Product Ribbon, but it takes a lot of time to load from base (base is around 400G, photos are going instantly but Ribbons take like 30s to load in /newproducts tab).

It looks like this:

I Tried to put it into Description section, but it wont work.
        <div class="description-1">
            <table>
                @{ var grps = Model.SpecificationAttributeModels.ToList(); }
                @foreach (var grp in grps)
                {
                    <tr>
                        <td class="text-light bg-dark">
                            @grp.SpecificationAttributeName.ToString();
                        </td>
                        <td class="spec-value">
                            @Html.Raw(string.Join(@" / ", grp.ValueRaw.ToString()))
                        </td>
                    </tr>
                }
            </table>
        </div>



Did i made something wrong ? (I Tried to use the code from _ProductSpecifications.cshtml)
@model IList<ProductSpecificationModel>
@* ADEMIR DODAO *@
@using Nop.Web.Models.Catalog;
@*
@if (Model.Count > 0)
{
    Layout = "~/Themes/Pavilion/Views/Shared/_Root.Head.cshtml";
}
*@

@if (Model.Count > 0)
{
    <div class="product-specs-box">
        <div class="title">
            <strong>@T("Products.Specs")</strong>
        </div>
        <div class="table-responsive table-hover">
            <table class="table">
                <colgroup>
                    <col width="25%" />
                    <col />
                </colgroup>
                <tbody>
                    @{
                        var grps = Model.GroupBy(x => x.SpecificationAttributeName).ToList();
                        for (var i = 0; i < grps.Count; i++)
                        {
                            var grp = grps[i];
                            <tr @(i % 2 == 0 ? Html.Raw(" class=\"odd\"") : Html.Raw(" class=\"even\""))>
                                <td class="text-light bg-dark">
                                    @grp.FirstOrDefault().SpecificationAttributeName
                                </td>
                                <td class="spec-value">
                                    @Html.Raw(string.Join(@" / ", grp.Select(x => x.ValueRaw)))
                                </td>
                            </tr>
                        }
                    }
                </tbody>
            </table>
        </div>
    </div>
}
6 Monate weitere
I Tried with this
https://www.nopcommerce.com/en/boards/topic/38500/show-specification-attribute-in-category-listing-page-search-result-page-nop-36

But i'm at nopCommerce 4.30 so there's nothing in this controller
5 Monate weitere
Clarify "it wont work".  Any error messages?
5 Monate weitere
New York wrote:
Clarify "it wont work".  Any error messages?


There's no message, it just wont show, i put the
<table>
                @{ var grps = Model.SpecificationAttributeModels.ToList(); }
                @foreach (var grp in grps)
                {
                    <tr>
                        <td class="text-light bg-dark">
                            @grp.SpecificationAttributeName.ToString();
                        </td>
                        <td class="spec-value">
                            @Html.Raw(string.Join(@" / ", grp.ValueRaw.ToString()))
                        </td>
                    </tr>
                }
            </table>

And it shows only <table></table> in inspect element.
5 Monate weitere
I Tried to index via JSON
<pre>@Html.Raw(JsonConvert.SerializeObject(Model.SpecificationAttributeModels, Formatting.Indented))</pre>



But it also shows only brackets "[ ]".

Maybe is restricted to put product specifications on ItemBox ?
5 Monate weitere
Do i need to change/remove ACL's or something, maybe i need to enable/disable something in Catalog settings ?
5 Monate weitere
Okay, i'll explain what i need better :)

So,
I want the specifications of product be listed in productbox (like productribbon)
So, first of all i created specifications and filled them into product.


Then i change several codes but none of them works;

<div class="description-1">
    <h2>Specification Model Details:</h2>
    <div class="table-responsive table-hover">
        <table class="table">
            <colgroup>
                <col width="25%" />
                <col />
            </colgroup>
            <tbody>
                @{
                    
                    var grps = Model.SpecificationAttributeModels.GroupBy(x => x.SpecificationAttributeId).ToList();
                    @if(grps.Any())
                    {
                        for (var i = 0; i < grps.Count; i++)
                        {
                            var grp = grps[i];
                            <tr @(i % 2 == 0 ? Html.Raw(" class=\"odd\"") : Html.Raw(" class=\"even\""))>
                                <td class="text-light bg-dark">
                                    @grp.FirstOrDefault().SpecificationAttributeName
                                </td>
                                <td class="spec-value">
                                    @Html.Raw(string.Join(@" / ", grp.Select(x => x.ValueRaw)))
                                </td>
                            </tr>
                        }
                    }
                }
                </tbody>
                </table>
                </div>
</div>


It always show empty stuff:



What do you think what could be the problem ?
5 Monate weitere
It's likely that SpecificationAttributeModels property is not getting populated by the calls made from that page.  You can debug / set breakpoint in factory to see why.  An optional param defaults false.
public virtual async Task<IEnumerable<ProductOverviewModel>> PrepareProductOverviewModelsAsync(IEnumerable<Product> products,
    bool preparePriceModel = true, bool preparePictureModel = true,
    int? productThumbPictureSize = null, bool prepareSpecificationAttributes = false,
    bool forceRedirectionAfterAddingToCart = false)


Have you considered just "calling" the partial view:
  @await Html.PartialAsync("_ProductSpecifications", Model.ProductSpecificationModel)
5 Monate weitere
New York wrote:
It's likely that SpecificationAttributeModels property is not getting populated by the calls made from that page.  You can debug / set breakpoint in factory to see why.  An optional param defaults false.
public virtual async Task<IEnumerable<ProductOverviewModel>> PrepareProductOverviewModelsAsync(IEnumerable<Product> products,
    bool preparePriceModel = true, bool preparePictureModel = true,
    int? productThumbPictureSize = null, bool prepareSpecificationAttributes = false,
    bool forceRedirectionAfterAddingToCart = false)


Have you considered just "calling" the partial view:
  @await Html.PartialAsync("_ProductSpecifications", Model.ProductSpecificationModel)


Hi, where can i find this Task ? or i need to implement it into productbox ?

u cant use
[code]  @await Html.PartialAsync("_ProductSpecifications", Model.ProductSpecificationModel)/code]
Because 'ProductOverviewModel' does not contain a definition for 'ProductSpecificationModel' and no accessible extension method 'ProductSpecificationModel' accepting a first argument of type 'ProductOverviewModel' could be found (are you missing a using directive or an assembly reference?)
This is only thing i can use
5 Monate weitere
Oh found it, but do i need to put it to true then ?