/** * Initialize model comments and return comment collection * * @return Mage_Sales_Model_Mysql4_Order_Comment_Collection_Abstract */ public function getComments() { if (is_null($this->_commentCollection)) { $entity = $this->getEntity(); if ($entity instanceof Mage_Sales_Model_Order_Invoice) { $collectionClass = 'sales/order_invoice_comment_collection'; } else { if ($entity instanceof Mage_Sales_Model_Order_Creditmemo) { $collectionClass = 'sales/order_creditmemo_comment_collection'; } else { if ($entity instanceof Mage_Sales_Model_Order_Shipment) { $collectionClass = 'sales/order_shipment_comment_collection'; } else { Mage::throwException(Mage::helper('sales')->__('Invalid entity model')); } } } $this->_commentCollection = Mage::getResourceModel($collectionClass); $this->_commentCollection->setParentFilter($entity)->setCreatedAtOrder()->addVisibleOnFrontFilter(); } return $this->_commentCollection; }
protected function _construct() { parent::_construct(); $this->_init('sales/order_invoice_comment'); }
protected function _construct() { parent::_construct(); $this->_init('sales/order_creditmemo_comment'); }