Need to show price between qty and add to cart V2.60

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 years ago
Hi all,

I need to show the price between the qty field and the "add to cart" button on the product detail page.

I opened ProductTemplate.SingleVariant.cshtml and found the following code:


@{
                        var dataDictPrice = new ViewDataDictionary();
                        dataDictPrice.TemplateInfo.HtmlFieldPrefix = string.Format("price_{0}", defaultProductVariant.Id);
                                        @Html.Partial("_ProductVariantPrice", defaultProductVariant.ProductVariantPrice, dataDictPrice)
                            
                        var dataDictAddToCart = new ViewDataDictionary();
                        dataDictAddToCart.TemplateInfo.HtmlFieldPrefix = string.Format("addtocart_{0}", defaultProductVariant.Id);
                                        @Html.Partial("_ProductVariantAddToCart", defaultProductVariant.AddToCart, dataDictAddToCart)  
                        
                                        
                    }



The price is coming from one file and the qty field + the "add to cart" button is coming from another. How can I do what I need to do?

I am using version 2.60

Thanks a lot.
11 years ago
I'm not sure it's possible without customization.

Create a new file (something like "_ProductVariantPriceAndAddToCart.cshtml") and combine these ones into it. In this case you can place any control where you need.
11 years ago
a.m. wrote:
I'm not sure it's possible without customization.

Create a new file (something like "_ProductVariantPriceAndAddToCart.cshtml") and combine these ones into it. In this case you can place any control where you need.


And how would I call the file? What "model" should I pass?

Thanks.
11 years ago
LAM-ECOM wrote:
What "model" should I pass?

Pass the entire ProductVariantModel and then use appropriate properties in the new view.

LAM-ECOM wrote:
And how would I call the file?

The same way as it's done for all other partial views
@Html.Partial("_ProductVariantPriceAndAddToCart", defaultProductVariant, dataDictPrice) 
11 years ago
a.m. wrote:
What "model" should I pass?
Pass the entire ProductVariantModel and then use appropriate properties in the new view.

And how would I call the file?
Te same way as it's done for all other partial views
@Html.Partial("_ProductVariantPriceAndAddToCart", defaultProductVariant, dataDictPrice) 


It worked like a charm!

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