/** * Object constructor. * * @param array $params * @param string $type Product type (simple, configurable, etc.) * @throws Exception * @return void */ public final function __construct(array $params) { if ($this->isSuitable()) { if (!isset($params[0]) || !isset($params[1]) || !is_object($params[0]) || !$params[0] instanceof Mage_ImportExport_Model_Import_Entity_Product) { Mage::throwException(Mage::helper('importexport')->__('Invalid parameters')); } $this->_entityModel = $params[0]; $this->_type = $params[1]; foreach ($this->_messageTemplates as $errorCode => $message) { $this->_entityModel->addMessageTemplate($errorCode, $message); } $this->_initAttributes(); } }
/** * Initialization of error message templates * * @return Mage_ImportExport_Model_Import_Entity_Product_Option */ protected function _initMessageTemplates() { // @codingStandardsIgnoreStart $this->_productEntity->addMessageTemplate(self::ERROR_INVALID_STORE, $this->_helper('Mage_ImportExport_Helper_Data')->__('Invalid custom option store.')); $this->_productEntity->addMessageTemplate(self::ERROR_INVALID_TYPE, $this->_helper('Mage_ImportExport_Helper_Data')->__('Invalid custom option type.')); $this->_productEntity->addMessageTemplate(self::ERROR_EMPTY_TITLE, $this->_helper('Mage_ImportExport_Helper_Data')->__('Empty custom option title.')); $this->_productEntity->addMessageTemplate(self::ERROR_INVALID_PRICE, $this->_helper('Mage_ImportExport_Helper_Data')->__('Invalid custom option price.')); $this->_productEntity->addMessageTemplate(self::ERROR_INVALID_MAX_CHARACTERS, $this->_helper('Mage_ImportExport_Helper_Data')->__('Invalid custom option maximum characters value.')); $this->_productEntity->addMessageTemplate(self::ERROR_INVALID_SORT_ORDER, $this->_helper('Mage_ImportExport_Helper_Data')->__('Invalid custom option sort order.')); $this->_productEntity->addMessageTemplate(self::ERROR_INVALID_ROW_PRICE, $this->_helper('Mage_ImportExport_Helper_Data')->__('Invalid custom option value price.')); $this->_productEntity->addMessageTemplate(self::ERROR_INVALID_ROW_SORT, $this->_helper('Mage_ImportExport_Helper_Data')->__('Invalid custom option value sort order.')); $this->_productEntity->addMessageTemplate(self::ERROR_AMBIGUOUS_NEW_NAMES, $this->_helper('Mage_ImportExport_Helper_Data')->__('Custom option with such title already declared in source file.')); $this->_productEntity->addMessageTemplate(self::ERROR_AMBIGUOUS_OLD_NAMES, $this->_helper('Mage_ImportExport_Helper_Data')->__('There are several existing custom options with such name.')); $this->_productEntity->addMessageTemplate(self::ERROR_AMBIGUOUS_TYPES, $this->_helper('Mage_ImportExport_Helper_Data')->__('Custom options have different types.')); // @codingStandardsIgnoreEnd return $this; }