I totally begin with Magento during my training period. I've been working on a project for two weeks now and sometimes I can't figure out how to proceed.
I'm gonna try to represent my categories tree :
- accessories
* visors
* communication systems
* other
- helmets
* a lot of subcategories and subcategories...
My actual problem is : I'm in one of the accessories subcategory (for example visors). I added a form with a select
allowing to choose a helmet model. When the select
is submitted, I'd like to display the list of visors related to the chosen helmet model (that is actually a virtual product
).
I can get the current category ID (in this case, visors) and the virtual product ID (so the helmet model). But I can't figure out how to display related products by both product ID and category ID.
I tried stuff like this :
$relatedProducts = Mage::getModel('catalog/product_link')
->getCollection()
->addCategoryFilter($myCurrentCat)
->addFieldToFilter('product_id',$myVirtualProductId)
->addFieldToFilter('link_type_id','1');
But it seems not to work.
Any help is welcome. Thanks.
EDIT : 10 days after I asked this question, I still don't know how to solve my problem. If anyone could help, even a little, just a clue...