Categories use the category doctype, products the product doctype and package sizes, the package size doctype. The product doctype has a field(ultimate picker) that populates categories, so each product will be related to a category. Similarly, the package sizes also have a field that relates them to categories.
Now, each product has a field called 'package size' which ideally should be a checkbox list and should have the sizes specific to that category. I tried using the 'checkbox tree' datatype in uComponents to list the package sizes but this lists all the package sizes, not the ones specific to this product. It currently looks like this.
What I need is, if the product belongs to category called 'oils', then the package size should only display the nodes from 'oils'.
I would like to know If there is any xPath expression that can do this, something similar to below. Or any other suggestions are appreciated.
Yes it should be possible, as the token $currentPage can be used within the XPath Filter expression.
If the desired list of checkboxes on a product to select a pack size is flat, then perhaps the built-in XPath CheckBoxList would be a more appropirate datatype ? (It's XPath configuration behaves in the same way)
Are all the nodes within the PackageSizes tree of the same type ? is it just the top level Oils / Filters / Batteries .... nodes that have been tagged with a category, or has every package size been tagged ? can a product have more than one category ?
Thanks for the response. All the package size categories (oils, batteries...) has a doctype 'packageSizeCategory' and these are tagged with a category. The descendants of these package size categories have a common doctype called 'packageSize'. A product can have more than one category but if that is going to complicate things, I'll leave it for now and just assign a single category to a product.
Both the PackageSizeCategory and Product document-types use an XPath DropDownList data-type to select a category (XPath: //Category), where the alias for each is category
Filtering nodes in Umbraco uComponents Checkbox Tree
The umbraco website I'm working on has the below structure.
Categories use the category doctype, products the product doctype and package sizes, the package size doctype. The product doctype has a field(ultimate picker) that populates categories, so each product will be related to a category. Similarly, the package sizes also have a field that relates them to categories.
Now, each product has a field called 'package size' which ideally should be a checkbox list and should have the sizes specific to that category. I tried using the 'checkbox tree' datatype in uComponents to list the package sizes but this lists all the package sizes, not the ones specific to this product. It currently looks like this.
What I need is, if the product belongs to category called 'oils', then the package size should only display the nodes from 'oils'.
I would like to know If there is any xPath expression that can do this, something similar to below. Or any other suggestions are appreciated.
Hi Sri,
Yes it should be possible, as the token $currentPage can be used within the XPath Filter expression.
If the desired list of checkboxes on a product to select a pack size is flat, then perhaps the built-in XPath CheckBoxList would be a more appropirate datatype ? (It's XPath configuration behaves in the same way)
Are all the nodes within the PackageSizes tree of the same type ? is it just the top level Oils / Filters / Batteries .... nodes that have been tagged with a category, or has every package size been tagged ? can a product have more than one category ?
Hi Hendy,
Thanks for the response. All the package size categories (oils, batteries...) has a doctype 'packageSizeCategory' and these are tagged with a category. The descendants of these package size categories have a common doctype called 'packageSize'. A product can have more than one category but if that is going to complicate things, I'll leave it for now and just assign a single category to a product.
Hi Sri,
Here's an XPath expression that can be used with the XPath CheckBoxList data-type on a product to render a collection of associated package sizes:
Both the PackageSizeCategory and Product document-types use an XPath DropDownList data-type to select a category (XPath: //Category), where the alias for each is category
HTH,
Hendy
is working on a reply...