/**
  * Returns the unit output by post (unit) ID.
  */
 private function _getOutputByID($iPostID)
 {
     $_aUnitOptions = AmazonAutoLinks_Option::getUnitOptionsByPostID($iPostID);
     /**
      * The auto-insert sets the 'id' as array storing multiple ids. But this method is called per ID so the ID should be discarded.
      */
     $_aSetArgs = $this->aArgs;
     unset($_aSetArgs['id']);
     $_aUnitOptions = $_aSetArgs + $_aUnitOptions + array('unit_type' => null, 'id' => $iPostID);
     // if the unit gets deleted, auto-insert causes an error for not finding the options
     switch ($_aUnitOptions['unit_type']) {
         case 'category':
             $_oAALCat = new AmazonAutoLinks_Unit_Category($_aUnitOptions);
             return $_oAALCat->getOutput();
         case 'tag':
             $_oAALTag = new AmazonAutoLinks_Unit_Tag($_aUnitOptions);
             return $_oAALTag->getOutput();
         case 'search':
             $_oAALSearch = new AmazonAutoLinks_Unit_Search($_aUnitOptions);
             return $_oAALSearch->getOutput();
         case 'item_lookup':
             $_oAALSearch = new AmazonAutoLinks_Unit_Search_ItemLookup($_aUnitOptions);
             return $_oAALSearch->getOutput();
         case 'similarity_lookup':
             $_oAALSearch = new AmazonAutoLinks_Unit_Search_SimilarityLookup($_aUnitOptions);
             return $_oAALSearch->getOutput();
         default:
             return "<!-- " . AmazonAutoLinks_Commons::$strPluginName . ': ' . __('Could not identify the unit type. Please make sure to update the auto-insert definition if you have deleted the unit.', 'amazon-auto-links') . " -->";
     }
 }