Developer forum

Forum » Swift » Adding HidePrice to ProductSlider.cshtml

Adding HidePrice to ProductSlider.cshtml

Justin Sjouw Dynamicweb Employee
Justin Sjouw
Reply

Hi All,

I am trying to add an option to hide the price in the ProductSlider.cshtml. I added the checkbox to the ItemType with a name "HidePrice" and checked it on the Homepage

Next i added a variable to the top of ProductSlider.cshtml with the same logic as the HideTitle field:

    bool hideTitle = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString.Get("HideTitle")) ? Convert.ToBoolean(Dynamicweb.Context.Current.Request.QueryString.Get("HideTitle")) : false;
    bool hidePrice = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString.Get("HidePrice")) ? Convert.ToBoolean(Dynamicweb.Context.Current.Request.QueryString.Get("HidePrice")) : false;
 

Added HidePrice as a parameter for RenderSlider

@helper RenderSlider (bool hidePrice) {
 

And hide the price paragraph in the RenderSlider method:

                            @if (!hidePrice) {
                                <p class="h5 text-price">@product.Price.PriceFormatted</p>
                            }
 

If i set the hidePrice to true in the variable declaration on top, the price is hidden. But if I set it to false (and expect to get the value set on the ItemType) the price is never hidden.

So it seems the variable does not find the value of the ItemType? 

What am I missing?

Thanks,

Justin


Replies

 
Nicolai Pedersen
Reply

We will release this feature with Swift tomorrow...

BR Nicolai

 

You must be logged in to post in the forum