Sorry for my late reply - hell of a day been setting up my web server ready to take to the data centre :D
I am not sure I understand, but could you have a "6 pack" product variant that was £12. If someone bought a quantity of 4 of the "6 pack" product variant then the total column would be £48. I'm probably confusing the matter - In our db our pack size vary's on size but has a wholesale price that remains the same. If we take the variants out completely. The qty of packs added gives the total sum of the price / sub total!! Ill have to test the procedures with the data.
If you don't mind asking you another question I have asked on the forum, but I having a problem with a view for product display.
I have created a productpop that for the life of me over the last few months I can't get to display... Here is the code I have generated alongside Nop two!
Nop.Web - Controller - Catalog Controller
public ActionResult _Productpopup(int productId)
{
var product = _productService.GetProductById(productId);
//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;
//pictures
model.DefaultPictureZoomEnabled = _mediaSetting.DefaultPictureZoomEnabled;
var pictures = _pictureService.GetPicturesByProductId(product.Id);
if (pictures.Count > 0)
{
//default picture
model.DefaultPictureModel = new PictureModel()
{
ImageUrl = _pictureService.GetPictureUrl(pictures.FirstOrDefault(), _mediaSetting.ProductDetailsPictureSize),
FullSizeImageUrl = _pictureService.GetPictureUrl(pictures.FirstOrDefault()),
Title = string.Format(_localizationService.GetResource("Media.Product.ImageLinkTitleFormat"), model.Name),
AlternateText = string.Format(_localizationService.GetResource("Media.Product.ImageAlternateTextFormat"), model.Name),
};
//all pictures
foreach (var picture in pictures)
{
model.PictureModels.Add(new PictureModel()
{
ImageUrl = _pictureService.GetPictureUrl(picture, _mediaSetting.ProductThumbPictureSizeOnProductDetailsPage),
FullSizeImageUrl = _pictureService.GetPictureUrl(picture),
Title = string.Format(_localizationService.GetResource("Media.Product.ImageLinkTitleFormat"), model.Name),
AlternateText = string.Format(_localizationService.GetResource("Media.Product.ImageAlternateTextFormat"), model.Name),
});
}
}
else
{
//no images. set the default one
model.DefaultPictureModel = new PictureModel()
{
ImageUrl = _pictureService.GetDefaultPictureUrl(_mediaSetting.ProductDetailsPictureSize),
FullSizeImageUrl = _pictureService.GetDefaultPictureUrl(),
Title = string.Format(_localizationService.GetResource("Media.Product.ImageLinkTitleFormat"), model.Name),
AlternateText = string.Format(_localizationService.GetResource("Media.Product.ImageAlternateTextFormat"), model.Name),
};
}
//check whether we have at leat one variant
if (model.ProductVariantModels.Count == 0)
return RedirectToAction("Index", "Home");
//save as recently viewed
_recentlyViewedProductsService.AddProductToRecentlyViewedList(product.Id);
return PartialView();
}
}
Nop Web - Views - Catalog - _ProductPopup
@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>
In
Nop Web - Views - Catalog - _ProductBox I have adjusted the following code highlighted, now I had it work but I upgraded Nop and for some reason I can't get it to work...
@model Nop.Web.Models.Catalog.ProductModel
<div class="product-item">
<h2 class="product-title">
<a href="@Url.RouteUrl("Product", new { productId = Model.Id, SeName = Model.SeName, CCCStockCode = Model.CCCStockCode, CCCWholesalePrice = Model.CCCWholesalePrice, CCCPack = Model.CCCPack, CCCWeight = Model.CCCWeight, CCCRetailPrice = Model.CCCRetailPrice, CCCRetailBarcode = Model.CCCRetailBarcode, CCCSourceBarcode = Model.CCCSourceBarcode, CCCQTYPacksPerLayer = Model.CCCQTYPacksPerLayer, CCCQTYLayersPerPallet = Model.CCCQTYLayersPerPallet, CCCQTYTotalPerPallet = Model.CCCQTYTotalPerPallet})">@Model.Name</a>
</h2>
<div class="picture">
<a href="javascript:window.open(@Html.Action("_Productpopup", new { productId = Model.Id, SeName = Model.SeName, CCCStockCode = Model.CCCStockCode, CCCWholesalePrice = Model.CCCWholesalePrice, CCCPack = Model.CCCPack, CCCWeight = Model.CCCWeight, CCCRetailPrice = Model.CCCRetailPrice, CCCRetailBarcode = Model.CCCRetailBarcode, CCCSourceBarcode = Model.CCCSourceBarcode, CCCQTYPacksPerLayer = Model.CCCQTYPacksPerLayer, CCCQTYLayersPerPallet = Model.CCCQTYLayersPerPallet, CCCQTYTotalPerPallet = Model.CCCQTYTotalPerPallet })"
title="@Model.DefaultPictureModel.Title"> <img alt="@Model.DefaultPictureModel.AlternateText" src="@Model.DefaultPictureModel.ImageUrl" title="@Model.DefaultPictureModel.Title"class="product-popup" />
</a>
</div>
<div class="description">
@Html.Raw(Model.ShortDescription)
</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="@(Model.ProductPrice.AvailableForPreOrder ? T("ShoppingCart.PreOrder") : T("ShoppingCart.AddToCart"))" class="productlistaddtocartbutton" onclick="setLocation('@Url.RouteUrl("AddProductToCart", new { productId = Model.Id })')" />
}
</div>
</div>
</div>
Object reference not set to an instance of an object. Always!!! Any idea's what I am missing
For the life of me I get it to popup thank god I'm bald.. Appreciate all help..
Richard.