New function for Magento: get a Category tree's products collection


Suppose my website has the following category tree:


- sub_cat_1_1 (id = 1234)

- subsub_cat_1_1_1

- subsubsub_cat_1_1_1

- subsub_cat_1_1_2

- sub_cat_1_2

- sub_cat_1_3


- sub_cat_2_1

- subsub_cat_2_1_1

- sub_cat_2_2

well, what I need is a function (let's call it getSubcatTree(id) ) which once is called passing a certain category ID as a parameter, it returns the whole products collection belonging to that category's tree (with the given category as starting node)

Still considering the above example, I should call the function like this:

getSubcatTree(1234) ,

and it should returns me a products collection consisting of all the products located in any subcategory (and recursively on their sub-subcategories) down from the given node.

This means all the products located in :

- subsub_cat_1_1_1

- subsubsub_cat_1_1_1

- subsub_cat_1_1_2


A function - let's call it for example getManuCollection(collection) - which returns a collection of all the names of the brands of a given products collection (passed as a parameter).

In the end, I should use the getSubcatTree(id) to get a products collection and then pass this to the getManuCollection(collection) to retrieve the same products collection's brands.

Of course those collections should work exactly like a normal Magento products/attribute collection.

Taidot: Joomla

Näytä lisää: magento category tree, category tree magento, magento current category, magento product category, category magento, magento products category, magento categories, magento function, magento collection tree, magento products category tree, magento tree category, current category magento, magento product collection, magento category tree products, category function magento, magento collection, magento category products, magento category tree collection, magento category tree node, magento getsubcattree, function magento, magento category functions, products category magento, magento category collection, magento categorytree

Tietoa työnantajasta:
( 8 arvostelua ) Busto Arsizio, Italy

Projektin tunnus: #418208