_prepareMailData($data), $suffix); return $this; } /** * Send notification to user * * @param array $data * @param string $suffix * @return App_ECommerce_Order_Abstract_View */ public function sendUserNotification($data, $suffix = '') { unset($data['adminAdditionalNote']); App_ECommerce_Order_MailAdapter::sendUserNotification($this->_prepareMailData($data), $suffix); return $this; } /** * @param array $data * @return array * @throws Qs_Exception */ protected function _prepareMailData(array $data) { throw new Qs_Exception('_prepareMailData() not implemented'); } protected function _setViewHeader($item) { $item = array( 'tpl' => $this->getTemplate('view-header.tpl'), 'itemName' => $this->getConfig('itemName'), 'orderId' => $item['id'] ); $this->_addItem($item); return $this; } protected function _doPrint() { $this->_printVersion = true; $this->_doc->setLayoutTemplate('PrintDoc/index.tpl'); $this->_doc->setBodyTemplate('PrintDoc/Body/default.tpl'); $this->_doc->addScript('js/print.js'); $this->_doc->setHeader($this->getConfig('itemName')); return $this->_doView(); } protected function _getViewForm(array $options = array()) { return $this->_getFormInstance('view', $options); } protected function _doUpdate() { if (null === $this->_getDataObj()->getData()) { $this->_setBackError(static::MSG_DATA_UNAVAILABLE); $this->_doBack(); } if ($this->_isLocked()) { $this->_setBackAttention($this->_createMessage(static::MSG_LOCKED, $this->_getLocker())); $this->_doBack(); } $form = $this->_getViewForm(); if ($form->validate()) { $this->_initFromForm($form); if (false === $this->_getDataObj()->update()) { $this->_setBackErrors($this->_getDataObj()->getErrors()); } else { $this->_postUpdate(); $this->_unlock(); $this->_setBackMessage(static::MSG_UPDATED); } $this->_doBack(); } else { $this->_addFormItem($form); } return $this; } /** * Direct render order cart information * * @param int $id Order id * @param bool $isAdminEmail * @return string */ public function renderOrderCart($id, $isAdminEmail) { $smarty = $this->_doc->getSmarty(); $this->_getDataObj()->clearData(); $this->_getDataObj()->setPrimaryKey($id); $item = $this->_getDataObj()->getData(); $item['templatePath'] = array('ECommerce/Order') + (array)$this->_getTemplatePath(); $item['isAdminEmail'] = $isAdminEmail; $smarty->assign('DOC', $this->_doc); $itemObj = new Qs_Doc_Item($item); $smarty->assign('item', $itemObj); return $smarty->fetch($itemObj->getTemplate('cart-information-render.tpl')); } protected function _getLog() { if (null === $this->_log) { parent::_getLog(); $this->_log->setAction('view', 'Viewed %itemName% #%id%'); $this->_log->setAction('edit', 'Headed to edit %itemName% #%id%'); $this->_log->setAction('insert', 'Added new %itemName% #%id%'); $this->_log->setAction('update', 'Updated %itemName% #%id%'); $this->_log->setAction('delete', 'Deleted %itemName% #%id%'); $this->_log->setAction('print', 'Headed to print %itemName% #%id%'); $this->_log->setAction('applyPromoCode', 'Used a Client Code'); $this->_log->setAction('applyGiftCard', 'Used a Gift Card'); } return $this->_log; } }