0

I'm trying to join a category with an event.

Here's what I have so far:

<?php
$rootCategoryId = Mage::app()->getStore()->getRootCategoryId();
$categoryModel = Mage::getModel('catalog/category');
$categories = $categoryModel->getCollection()
                ->addAttributeToSelect(array('name'))
                ->addAttributeToFilter('parent_id', array('eq' => $rootCategoryId))
                ->addAttributeToFilter('is_active', array('eq' => 1));
$categories->joinTable('catalogevent/event', 'entity_id=category_id');

The error I receive is:

Fatal error: Call to undefined method Mage_Catalog_Model_Resource_Category_Flat_Collection::joinTable()

Any help is greatly appreciated. I get a similar error trying to use joinField and joinAttribute.

0

1 Answer 1

2

Try

$rootCategoryId = Mage::app()->getStore()->getRootCategoryId();
$categoryModel = Mage::getModel('catalog/category');
                ->getCollection()
                ->addAttributeToSelect(array('name'))
                ->addAttributeToFilter('parent_id', array('eq' => $rootCategoryId))
                ->addAttributeToFilter('is_active', array('eq' => 1));
$categoryModel->getSelect()->join('catalogevent/event', 'entity_id=category_id');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.