I need some help as I am humbly stuck - again!!
I want to pass a partial view for a product display using a popup instead of product display page. Here is the Outlining steps I have undertaken. To produce this action / view but as I mentioned I am stuck and I would appreciate all help!! As when I try to pass the view - as you will see in the code below nothing happens.
1. Nop.Web.Controllers.Catalog.cs
Using the orignal source code provided by Nop Commerce and partially my own I have updated and created a new public action.
public ActionResult _Productpopup(int productId)
{
var product = _productService.GetProductById(productId);
if (product == null || product.Deleted || !product.Published)
return RedirectToAction("Index", "Home");
//prepare the model
var model = PrepareProductDetailsPageModel(product);
//CCCStockCode
model.CCCStockCode = product.CCCStockCode;
////CCCPack
model.CCCPack = product.CCCPack;
////CCCLane
model.CCCLane = product.CCCLane;
////CCCRRP
model.CCCWholesalePrice = product.CCCWholesalePrice;
////CCCRetailPrice
model.CCCRetailPrice = product.CCCRetailPrice;
////CCCMRP
model.CCCMRP = product.CCCMRP;
////CCCQTYINSTOCK
model.CCCQTYINSTOCK = product.CCCQTYINSTOCK;
////CCCBay
model.CCCBay = product.CCCBay;
////CCCSourceBarcode
model.CCCSourceBarcode = product.CCCSourceBarcode;
////CCCRetailBarcode
model.CCCRetailBarcode = product.CCCRetailBarcode;
////CCCWeight
model.CCCWeight = product.CCCWeight;
////CCCQTYPacksPerLayer
model.CCCQTYPacksPerLayer = product.CCCQTYPacksPerLayer;
////CCCQTYLayersPerPallet
model.CCCQTYLayersPerPallet = product.CCCQTYLayersPerPallet;
//CCCQTYLayersPerPallet
model.CCCQTYTotalPerPallet = product.CCCQTYTotalPerPallet;
return PartialView();
}
Nop.Web.Views.Catalog. _Productpopup.cshtl
As you can see I have used the _RootPopup shared view after digging through the orignal source code provided and I'm using Nop.Model.Product.cs
@model Nop.Web.Models.Catalog.ProductModel
@{
Layout = "~/Views/Shared/_RootPopup.cshtml";
}
<div class="product-popup">
<div class="product-details-infopopup">
<!--product pictures-->
<div class="popup-picture">
@Html.Partial("_ProductDetailsPictures", Model)
</div>
<div class="overview">
<div class="productname">
@Model.Name
<div class="shortdescription">
@Html.Raw(Model.ShortDescription)
</div>
<div class="stockcode">
@Model.CCCStockCode
</div>
<div class="wholesaleprice">
@Model.CCCWholesalePrice
</div>
<div class="pack">
@Model.CCCPack
</div>
<div class="weight">
@Model.CCCWeight
</div>
<div class="retailprice">
@Model.CCCRetailPrice
</div>
<div class="retailbarcode">
@Model.CCCRetailBarcode
</div>
<div class="sourcebarcode">
@Model.CCCSourceBarcode
</div>
<div class="packsperlayer">
@Model.CCCQTYPacksPerLayer
</div>
<div class="layersperpallet">
@Model.CCCQTYLayersPerPallet
</div>
<div class="totalperpallet">
@Model.CCCQTYTotalPerPallet
</div>
</div>
<div class="product-close-button">
<input type="button" value="Close" onclick='close()' />
</div>
</div>
</div>
</div>
Nop.Web.Views._Productbox.cshtml
From the image provided in the view Instead of returning the product display page I would like a pop up to display the product information/data -with no Jquery just a javascript:window.open popup.
<div class="picture">
<a href="javascript:window.open(@Url.RouteUrl("Product", new { productId = Model.Id, SeName = Model.SeName })"
title="@Model.DefaultPictureModel.Title"> <img alt="@Model.DefaultPictureModel.AlternateText" src="@Model.DefaultPictureModel.ImageUrl" title="@Model.DefaultPictureModel.Title"class="product-popup" />
</a>
</div>
When I click on the image nothing happen's.
Hopefully someone can advise me on what I am missing.
All help highly regarded
Thank you
Richard