/**
  * Add the permalink data before loading the collection
  *
  * @return $this
  */
 protected function _beforeLoad()
 {
     parent::_beforeLoad();
     if (!$this->getFlag('skip_permalink_generation')) {
         if ($sql = $this->getResource()->getPermalinkSqlColumn()) {
             $this->getSelect()->columns(array('permalink' => $sql));
         }
     }
     if (!$this->hasPostTypeFilter()) {
         if ($this->getFlag('source') instanceof Fishpig_Wordpress_Model_Term) {
             if ($postTypes = Mage::helper('wordpress/app')->getPostTypes()) {
                 $supportedTypes = array();
                 foreach ($postTypes as $postType) {
                     if ($postType->isTaxonomySupported($this->getFlag('source')->getTaxonomy())) {
                         $supportedTypes[] = $postType->getPostType();
                     }
                 }
                 $this->addPostTypeFilter($supportedTypes);
             }
         }
     }
     if (count($this->_postTypes) === 1) {
         if ($this->_postTypes[0] === '*') {
             $this->_postTypes = array();
         }
     }
     if (count($this->_postTypes) === 0) {
         $this->addFieldToFilter('post_type', array('in' => array_keys(Mage::helper('wordpress/app')->getPostTypes())));
     } else {
         $this->addFieldToFilter('post_type', array('in' => $this->_postTypes));
     }
     return $this;
 }
 /**
  * If post type filter not set, set one
  *
  * @return $this
  */
 protected function _beforeLoad()
 {
     parent::_beforeLoad();
     if (!$this->hasPostTypeFilter()) {
         $this->_postTypes[] = $this->getNewEmptyItem()->getPostType();
     }
     if (count($this->_postTypes) === 1) {
         $this->addFieldToFilter('post_type', $this->_postTypes[0]);
     } else {
         $this->addFieldToFilter('post_type', array('in' => $this->_postTypes));
     }
     return $this;
 }