Hiding Price When Base is Zero

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
8 anos atrás
Hi All

I have a product with attributes. It has a price of zero on the product page and three attributes each with an override price. On the catalogue page it shows a price of zero.

Ideally I want to show the cheapest price of the three override prices, but I will settle for the price being hidden.

1. Is there a setting that will hide a zero price in these circumstances? Or should I just edit the template to hide if zero (if Model.ProductPrice.Price == 0)?

2. To get the cheapest price from the attribute combination override prices does anyone have a suggestion to an approach for this. I'm thinking of writing a small function that goes and gets them and just calling it in the template.

Thanks in advance
Phil
8 anos atrás
For your first question there is no default setting to hide a zero price and second you can define display order.First cheapest display order will 1 second will 2.
8 anos atrás
philipbrassington wrote:

On the catalogue page it shows a price of zero.


Change that to on the *category* page it shows a price of zero.

So the category is Tins of Paint. On this there are 10 different tins on paint. Some have a price and some have different sizes (2.5 litre and 5 litre). If the product has attributes then the price shows as zero, which just looks odd.
8 anos atrás
In case anyone is reading this with the same issue and for peer review:
To remove the price if zero I made the following change to _ProductBox.chtm
                @if (Model.ProductPrice.PriceValue != 0)
                {
                    <span class="price actual-price">@Model.ProductPrice.Price</span>
                }

To get the value from the attribute combinations I made a change to ControllerExtensions.cs | PrepareProductOverviewModels

On line 250 I put in an if statement if the minPossiblePrice == 0
if (minPossiblePrice == 0)
{
    minPossiblePrice = (product.ProductAttributeCombinations.Min(p => p.OverriddenPrice) ?? 0);
}
  
If someone can see an obvious flaw in my plan I'd appreciate them posting here to let me know.

Thanks
Phil
7 anos atrás
did you ever figure this out? I am using version 3.9 with product attributes. Every product shows $0.00 and I would like to do the same thing, with something like "Starting at $39.99"
7 anos atrás
Hi

This can't be done out of the box as far as I'm aware. I did exactly what I said in my previous post. Let me know if you need some help.

Thanks
Phil
7 anos atrás
Unfortunately I cannot find productbox.chtm with version 3.9! Thats why I asked. :(
7 anos atrás
I have found the productbox in the views\Shared folder, although I couldnt find the code you referenced.

   <div class="description">
            @Html.Raw(Model.ShortDescription)
        </div>
        <div class="add-info">
            @Html.Widget("productbox_addinfo_before", Model.Id)
            <div class="prices">
                @if (!String.IsNullOrEmpty(Model.ProductPrice.OldPrice))
                {
                    <span class="price old-price">@Model.ProductPrice.OldPrice</span>
                }
                <span class="price actual-price">@Model.ProductPrice.Price</span>
                @if (Model.ProductPrice.DisplayTaxShippingInfo)
                {
                    var inclTax = EngineContext.Current.Resolve<IWorkContext>().TaxDisplayType == TaxDisplayType.IncludingTax;
                    //tax info is already included in the price (incl/excl tax). that's why we display only shipping info here
                    //of course, you can modify appropriate locales to include VAT info there
                    <span class="tax-shipping-info">
                        @T(inclTax ? "Products.Price.TaxShipping.InclTax" : "Products.Price.TaxShipping.ExclTax", Url.RouteUrl("Topic", new { SeName = Html.GetTopicSeName("shippinginfo") }))
                    </span>
                }
                @if (!String.IsNullOrEmpty(Model.ProductPrice.BasePricePAngV))
                {
                    <div class="base-price-pangv">
                        @Model.ProductPrice.BasePricePAngV
                    </div>
                }
            </div>
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.