/** * Initialize model comments and return comment collection * * @return Mage_Sales_Model_Resource_Order_Comment_Collection_Abstract */ public function getComments() { if (is_null($this->_commentCollection)) { $entity = $this->getEntity(); if ($entity instanceof Mage_Sales_Model_Order_Invoice) { $collectionClass = 'Mage_Sales_Model_Resource_Order_Invoice_Comment_Collection'; } else { if ($entity instanceof Mage_Sales_Model_Order_Creditmemo) { $collectionClass = 'Mage_Sales_Model_Resource_Order_Creditmemo_Comment_Collection'; } else { if ($entity instanceof Mage_Sales_Model_Order_Shipment) { $collectionClass = 'Mage_Sales_Model_Resource_Order_Shipment_Comment_Collection'; } else { Mage::throwException(Mage::helper('Mage_Sales_Helper_Data')->__('Invalid entity model')); } } } $this->_commentCollection = Mage::getResourceModel($collectionClass); $this->_commentCollection->setParentFilter($entity)->setCreatedAtOrder()->addVisibleOnFrontFilter(); } return $this->_commentCollection; }
/** * Model initialization * */ protected function _construct() { parent::_construct(); $this->_init('sales/order_invoice_comment'); }
/** * Model initialization * */ protected function _construct() { parent::_construct(); $this->_init('Mage_Sales_Model_Order_Invoice_Comment', 'Mage_Sales_Model_Resource_Order_Invoice_Comment'); }
/** * Model initialization * */ protected function _construct() { parent::_construct(); $this->_init('sales/order_creditmemo_comment'); }