devshb
Senior Member
United Kingdom
1904 Posts |
Posted - August 13 2008 : 04:54:40
|
It's surprisingly complicated, because a product can be in multiple category branches, and a branch can have multiple levels, so it's not as simple as it looks. As a product can in theory be attached to loads of different categories, each solution would probably be slightly different depending on how the site uses categories.
You could get a custom-built function created which pulls back the relevant categories; it'd be a relatively simple to do coding-wise, it's just a case of working out how you'd want the logic to work regarding the branches/levels.
I'd be curious to know whether anyone else would want this done, and if so how would they want the logic to work (given the multiple branch/level aspect) ?
It's quite easy to code (assuming it's just a simple category list rather than complex lowest-level-only breadcrumbs; see below), and we could easily create a little addon for it, but I'd like to get some feedback from vpasp merchants/developers here so people can give their 2 cents' worth for how they'd want it to work.
ie something like a template-field where you pass across the catalogid and it then shows you a list of the category links which point to that product, but which levels/categories would you want it to display and in what kind of format?
eg end up with something like this in your product-based templates: [linkedcategoriesforproduct catalogid]
Ideally I think you'd want to show the lowest-level categories only, and in breadcrumbs format, so that you can click on any part of the breadcrumb. ie you'd get something like this:
tv > sony > plasma av equipment > special offers > sony and you'd be able to click on any portion of either of those breadcrumbs and you'd get the relevant products/subcategories.
This is the kind of logic we used for breadcrumbs on our asp-generator addon, but finding the full breadcrumbs of all the relevant branches, and making sure it only displays the lowest level, is quite complex and takes a lot of time in the database, so it's ok on our asp-generated pages (because it generates the breadcrumbs when you generate the pages rather than while you're browsing), but could cause a big overhead if doing at browse-time.
Our "related categories" addon (BYZ121) has a function within it which gets the breadcrumb arrays for a given category code, and a function which displays the breadcrumbs for those arrays, but at the moment it only uses that to show "related categories" rather than as a template-field in its own right, but we could add another template-field to it to use different logic; I think that addon (BYZ121) would be the best place to put it if we were to code it up because it's along the same lines as the original use of the addon.
Simon Barnaby Developer [email protected] www.BigYellowZone.com Web Design, Online Marketing and VPASP addons |
Edited by - devshb on August 13 2008 05:35:20 |
|
|