Hi!
I am trying to place the " Price + quantity+ add to cart" button to the ProductTemplate.VariantsInGrid just down below the "share" .
Here is the script of the page
@model Nop.Web.Models.Catalog.ProductModel
@using Nop.Core;
@using Nop.Core.Domain.Common;
@using Nop.Core.Infrastructure;
@using Nop.Web;
@using Nop.Web.Framework.UI;
@using Nop.Web.Models.Catalog;
@{
Layout = "~/Views/Shared/_ColumnsTwo.cshtml";
//title, meta
Html.AddTitleParts(!String.IsNullOrEmpty(Model.MetaTitle) ? Model.MetaTitle : Model.Name);
Html.AddMetaDescriptionParts(Model.MetaDescription);
Html.AddMetaKeywordParts(Model.MetaKeywords);
var canonicalUrlsEnabled = EngineContext.Current.Resolve<SeoSettings>().CanonicalUrlsEnabled;
if (canonicalUrlsEnabled)
{
var productUrl = Url.RouteUrl("Product", new { productId = Model.Id, SeName = Model.SeName }, this.Request.Url.Scheme);
Html.AddCanonicalUrlParts(productUrl);
}
}
@{
//errors
var errors = new List<string>();
foreach (var modelState in ViewData.ModelState.Values)
{
foreach (var error in modelState.Errors)
{
errors.Add(error.ErrorMessage);
}
}
}
@if (errors.Count > 0)
{
var addToCartWarningsSb = new System.Text.StringBuilder();
for (int i = 0; i < errors.Count; i++)
{
addToCartWarningsSb.Append(errors[i]);
if (i != errors.Count - 1)
{
addToCartWarningsSb.Append("\\n");
}
}
//display errors
<script type="text/javascript">
$(document).ready(function () {
alert('@Html.Raw(addToCartWarningsSb.ToString())');
});
</script>
}
<!--product breadcrumb-->
@Html.Action("ProductBreadcrumb", "Catalog", new { productId = Model.Id })
<div class="clear">
</div>
<div class="product-details-page">
@using (Html.BeginRouteForm("Product", new { productId = Model.Id, SeName = Model.SeName }, FormMethod.Post))
{
<div class="product-essential">
<div class="product-details-info">
<!--product pictures-->
@Html.Partial("_ProductDetailsPictures", Model)
<div class="overview">
<h1 class="productname">
@Model.Name
</h1>
<br />
<div class="shortdescription">
@Html.Raw(Model.ShortDescription)
</div>
<div class="clear">
</div>
<!--product manufactures-->
@Html.Action("ProductManufacturers", "Catalog", new { productId = Model.Id })
<div class="clear">
</div>
<!--product reviews-->
@Html.Action("ProductReviewOverview", "Catalog", new { productId = Model.Id })
<div class="clear">
</div>
@if (errors.Count > 0)
{
//display errors
<span class="error">
@for (int i = 0; i < errors.Count; i++)
{
@errors[i]
if (i != errors.Count - 1)
{
<text><br /></text>
}
}
</span>
<div class="clear">
</div>
}
<br />
@Html.Action("ProductEmailAFriendButton", "Catalog", new { productId = Model.Id })
<text> </text>
@Html.Action("CompareProductsButton", "Catalog", new { productId = Model.Id })
<div class="clear">
</div>
@Html.Action("ShareButton", "Catalog")
</div>
-------------------------------------------------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////////////
I would kike to add the code here for Price + Quantity + Add To Cart
//////////////////////////////////////////////////////////////////////////////////
--------------------------------------------------------------------------------------------------
<div class="fulldescription">
@Html.Raw(Model.FullDescription)
</div>
</div>
</div>
<div class="clear">
</div>
<div class="product-collateral">
<!--product variants-->
<div class="product-variant-list">
@foreach (var variant in Model.ProductVariantModels)
{
var dataDictVariant = new ViewDataDictionary();
dataDictVariant.TemplateInfo.HtmlFieldPrefix = string.Format("variant_{0}", variant.Id);
@Html.Partial("_ProductVariantLine", variant, dataDictVariant)
}
</div>
<div class="clear">
</div>
<div>
@Html.Action("ProductSpecifications", "Catalog", new { productId = Model.Id })
</div>
<div class="clear">
</div>
<div>
@Html.Action("ProductTags", "Catalog", new { productId = Model.Id })
</div>
<div class="clear">
</div>
<div>
@Html.Action("ProductsAlsoPurchased", "Catalog", new { productId = Model.Id })
</div>
<div class="clear">
</div>
<div>
@Html.Action("RelatedProducts", "Catalog", new { productId = Model.Id })
</div>
</div>
}
</div>
----------------------------------------------------------------------------------------------------------------------
I found the code for it
<div class="clear">
</div>
@{
var dataDictPrice = new ViewDataDictionary();
dataDictPrice.TemplateInfo.HtmlFieldPrefix = string.Format("price_{0}", Model.Id);
@Html.Partial("_ProductVariantPrice", Model.ProductVariantPrice, dataDictPrice)
}
@{
var dataDictAddToCart = new ViewDataDictionary();
dataDictAddToCart.TemplateInfo.HtmlFieldPrefix = string.Format("addtocart_{0}", Model.Id);
@Html.Partial("_ProductVariantAddToCart", Model.AddToCart, dataDictPrice)
}
I have try every way but can't make it to work. can some one give me a clue.
cuz I am newbies to asp.net and nopcommerce. any detail help would be appreciated.
Thank you.