product1[radio button list(property) of apple,banana,apricot]
product2[radio button list(property) of apple,banana,apricot] .....
Now the issue is i want to display these products on different pages and i want to filter it withrespect to the selected radio button list from the backend, so for instance if product 1 has a selected property of apple , then it comes under page 1 , similarly if the selected property of product 2 is banana , then it will be displayed on page 2 , hope it makes sense.
I assume that your products pages have their own document type. If not, you need to hardcode the parentId for the product pages.
The following is not tested.
@inherits umbraco.MacroEngines.DynamicNodeContext @*First look for a parameter in the macro so we know what producttype to look for*@ @{ var pt = Parameter.Level; <ul> @foreach(var product in Model.Descendants.Where("productType == pt")) { <li>@product.Name</li> } </ul> }
Using WHERE to perform filteration on radio button list
Hi ,
I have got a radiobuttonlist [apple,banana,mangoe]on which i have to perform filteration to display result , below is the code :
@inherits umbraco.MacroEngines.DynamicNodeContext
<div id="right-col">
<h2>
list of products</h2>
@foreach (var item in @Model.NodeById(1302).Children.Where("productType == \"apple\""))
{
<div class="testimonial">
<p>
@item.productContent
</p>
</div>
}
</div>
The above code is not working , what i want to display is the list of selected product
from radiobutton list, so for instance if apple is selected , only apple products
with details should be displayed, any suggestions where iam getting it wrong
I don't have a suggestion right away, but could you give some more info on how the content is structured?
Do you want to view products that has the propertyType "Apple"?
Are product types immediately under the specified node, or structured in to categorised folders?
Using `Descendants` should help in this case, if you're careful.
@foreach (var item in @Model.NodeById(1302).Descendants.Where("productType == \"apple\""))
well the tree is like :
Products
product1[radio button list(property) of apple,banana,apricot]
product2[radio button list(property) of apple,banana,apricot] .....
Now the issue is i want to display these products on different pages and i want to filter it withrespect to the selected radio button list from the backend, so for instance if product 1 has a selected property of apple , then it comes under page 1 , similarly if the selected property of product 2 is banana , then it will be displayed on page 2 , hope it makes sense.
Okay.
I assume that your products pages have their own document type. If not, you need to hardcode the parentId for the product pages.
The following is not tested.
How does that work? :-)
is working on a reply...