Error when using partial view :ProductVariant_SKU_Man_Stock

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Hace 12 años
Hi , I am trying to use the partial view ProductVariant_SKU_Man_Stock in the _Productbox.cshtml but it comes up with the error:
The model item passed into the dictionary is of type 'System.Collections.Generic.List`1[Nop.Web.Models.Catalog.ProductModel+ProductVariantModel]', but this dictionary requires a model item of type 'Nop.Web.Models.Catalog.ProductModel+ProductVariantModel'.

below is the _Productbox.cshtml:

@model Nop.Web.Models.Catalog.ProductModel
<div class="product-item">
    <h2 class="product-title">
    @Model.Name
    </h2>
<div class="description">
          @Html.Partial("_ProductVariant_SKU_Man_Stock",Model.ProductVariantModels)
        @Html.Raw(Model.FullDescription) <br />
        @Model.Size
    </div>
    <div class="add-info">
        <div class="prices">
            @Html.Partial("_ProductPrice", Model.ProductPrice)
        </div>
        <div class="buttons">
           @* <input type="button" value="@T("Products.Details")" class="productlistproductdetailbutton" onclick="setLocation('@Url.RouteUrl("Product", new { productId = Model.Id, SeName = Model.SeName })')" />
    *@        @if (!Model.ProductPrice.DisableBuyButton)
            {
                <br />
                <input type="button" value="@T("ShoppingCart.AddToCart")" class="productlistaddtocartbutton" onclick="setLocation('@(@Url.RouteUrl("AddProductToCart", new { productId = Model.Id }))')" />
            }
        </div>
    </div>
</div>

Is there any other way of doing it coz i need sku and manufacture to display in this view.

Any help or suggested will be highly appreciated , Regards
Hace 12 años
Hi Creative:  

Did you ever get an answer to this?  If so, can you share?  I'm looking to do the exact same thing.  Thanks!

-T
Hace 11 años
Hi

anyone any ideas ?  I want to do a similair thing, I would like to show the stock levels


Thanks
Hace 11 años
Well i created a new model which merges all models into one so that i can use all the properties of a product which include manufacture details and sku etc .. and then call that in a view, check my website :http://www.quadratech.co.uk/c/34/anticoagulation

you can see the list of products , where image is manufacture image and sku is used as a code, size and description is coming from product variant while analyte is an specification attribute.
Hace 11 años
Spire wrote:
Hi

anyone any ideas ?  I want to do a similair thing, I would like to show the stock levels


Thanks


You mean stock quantity/availability of each product
Hace 11 años
Hi

Yes I want to show stock quantity/avalaiblity in the product overview for each product, so I don't have to drill down to product detail, to see the stock quantity/availiblity.

I only plan on having the default variant per product.

Thanks
Hace 11 años
creative3k wrote:
Well i created a new model which merges all models into one so that i can use all the properties of a product which include manufacture details and sku etc .. and then call that in a view, check my website :http://www.quadratech.co.uk/c/34/anticoagulation


That would work for me, if I could show the stock quantity/avalibilty instead of the SKU which I do not use for this particular application, the manufacture would be a nice bounus.

I will have to look at doing that.

I suspect it will be a steep learning curve as I am a MVC novice, but at least I have a direction to go :)

Unless anyone has an easier solution ?

Thanks
Hace 11 años
Spire wrote:
Well i created a new model which merges all models into one so that i can use all the properties of a product which include manufacture details and sku etc .. and then call that in a view, check my website :http://www.quadratech.co.uk/c/34/anticoagulation


That would work for me, if I could show the stock quantity/avalibilty instead of the SKU which I do not use for this particular application, the manufacture would be a nice bounus.

I will have to look at doing that.

I suspect it will be a steep learning curve as I am a MVC novice, but at least I have a direction to go :)

Unless anyone has an easier solution ?

Thanks


I think you need to know the basics of mvc first , http://www.asp.net/mvc  , thats the best place to learn , when i started working on nopcommerce 10 months back , i had no knowledge of mvc , i started digging into it , by working on controllers and model , understanding entitfy framework , interfaces , i guess the product model consist of product quantity entity , therefore you dont need to do any modification , just call that property in your view  and you will be fine.
Hace 11 años
Spire wrote:
Well i created a new model which merges all models into one so that i can use all the properties of a product which include manufacture details and sku etc .. and then call that in a view, check my website :http://www.quadratech.co.uk/c/34/anticoagulation


That would work for me, if I could show the stock quantity/avalibilty instead of the SKU which I do not use for this particular application, the manufacture would be a nice bounus.

I will have to look at doing that.

I suspect it will be a steep learning curve as I am a MVC novice, but at least I have a direction to go :)

Unless anyone has an easier solution ?

Thanks


ProductVariantModel consist of StockAvailablity entity, u need to call that model.

just create a partial view name _ProductStockLevel:
@model Nop.Web.Models.Catalog.ProductModel.ProductVariantModel
@Html.Raw(Model.StockAvailablity)
                                  
And call this view in the productbox view like:
@Html.Partial("_ProductStockLevel", Model.ProductVariantModel)

Hope this helps
Hace 11 años
creative3k wrote:

ProductVariantModel consist of StockAvailablity entity, u need to call that model.

just create a partial view name _ProductStockLevel:
@model Nop.Web.Models.Catalog.ProductModel.ProductVariantModel
@Html.Raw(Model.StockAvailablity)
                                  
And call this view in the productbox view like:
@Html.Partial("_ProductStockLevel", Model.ProductVariantModel)

Hope this helps


Hi

sounds like a plan I will give it a go, thanks for your help

I have been watching videos most of the day, trying to get a grip on MVC so I will how I get on

Thanks
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.