I am setting up Magento FAQs to sort faq items into categories. The following collection is used to get all the active faq elements.
$collection = Mage :: getModel('flagbit_faq/faq')->getCollection() ->addStoreFilter(Mage :: app()->getStore()) ->addIsActiveFilter();
relationship table exists faq_category_item "
Table structure: -
category_id faq_id 1 1 2 2 1 3
So, I decided to join the two tables. In this I do not agree. What I tried below.
$tbl_faq_item = Mage::getSingleton('core/resource')->getTableName('faq_category_item'); $collection = Mage :: getModel('flagbit_faq/faq')->getCollection() ->getSelect() ->join(array('t2' => $tbl_faq_item),'main_table.faq_id = t2.faq_id','t2.category_id') ->addStoreFilter(Mage :: app()->getStore()) ->addIsActiveFilter();
What is wrong with this and how can I filter certain category items. Please share good links to explore the collections of Magento models.
Thank you in advance
source share