on ‎2018 Nov 27 9:23 AM
Request clarification before answering.
Hi Amit, It really depends on what do you mean by "main category".
If this is a top-level category from a supercategory tree, than you can access it by traversing the tree up to the root (until supercategories==null). But if you mean "main category" = the default category from multiple categories the product is assigned to, I'm affraid there is no such concept OOTB and you need to extend your product model to explicitly point one of the categories to be the "main".
In one of our projects we extended the products attributes in items.xml to include an additional field "mainCategory" and assigned the first category from supercategories collection to that field if it was empty or the value specified by the user if he/she did provide one.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.