/** * Ensures that only posts and not pages are returned * WP stores posts and pages in the same DB table * */ protected function _initSelect() { parent::_initSelect(); $this->getSelect()->join(array('taxonomy' => $this->getTable('wordpress/term_taxonomy')), '`main_table`.`term_id` = `taxonomy`.`term_id`', array('term_taxonomy_id', 'taxonomy', 'description', 'count', 'parent')); // Reverse the order. This then matches the WP order $this->getSelect()->order('term_id DESC'); return $this; }
/** * After loading the collection, unserialize data * * @return $this */ protected function _afterLoad() { parent::_afterLoad(); foreach ($this->_items as $item) { $item->loadSerializedData(); } return $this; }
/** * Ensures that only posts and not pages are returned * WP stores posts and pages in the same DB table * */ protected function _initSelect() { parent::_initSelect(); $this->getSelect()->join(array('taxonomy' => $this->getTable('wordpress/term_taxonomy')), '`main_table`.`term_id` = `taxonomy`.`term_id`', array('term_taxonomy_id', 'taxonomy', 'description', 'count', 'parent')); // Reverse the order. This then matches the WP order if (Mage::getResourceSingleton('wordpress/term')->tableHasTermOrderField()) { $this->getSelect()->order('term_order ASC'); } $this->getSelect()->order('term_id DESC'); return $this; }
/** * Ensure that is any pages are in the collection, they are correctly cast * * @return $this */ protected function _afterLoad() { foreach ($this->_items as $itemId => $object) { if ($object->getPostType() === 'page') { $page = Mage::getModel('wordpress/page')->load($itemId); if ($page->getId()) { $this->_items[$itemId] = $page; } else { unset($this->_items[$itemId]); } } } return parent::_afterLoad(); }
/** * Ensures that only posts and not pages are returned * WP stores posts and pages in the same DB table * */ protected function _initSelect() { parent::_initSelect(); $this->getSelect()->where("`main_table`.`post_type`=?", $this->_getPostType()); return $this; }
/** * Ensure that is any pages are in the collection, they are correctly cast * * @return $this */ protected function _afterLoad() { parent::_afterLoad(); $this->getResource()->preparePosts($this->_items); return $this; }