本文整理汇总了PHP中Mage_Core_Model_Email_Template::getData方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Email_Template::getData方法的具体用法?PHP Mage_Core_Model_Email_Template::getData怎么用?PHP Mage_Core_Model_Email_Template::getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Email_Template
的用法示例。
在下文中一共展示了Mage_Core_Model_Email_Template::getData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterSave
public function afterSave(Mage_Core_Model_Email_Template $template)
{
if (true !== Mage::registry('aitemails_template_save_noaddconfig')) {
$template_data = $template->getData();
$this->_addToConfig($template, $template_data['orig_template_code']);
}
$oReq = Mage::app()->getFrontController()->getRequest();
/**
* saving attachments
*/
if ($data = $oReq->getPost('aitemails')) {
if (isset($data['aitattachment'])) {
$_deleteItems = array();
foreach ($data['aitattachment'] as $aitattachmentItem) {
if ($aitattachmentItem['is_delete'] == '1') {
if ($aitattachmentItem['aitattachment_id']) {
$_deleteItems[] = $aitattachmentItem['aitattachment_id'];
}
} else {
$aitattachmentModel = Mage::getModel('aitemails/aitattachment');
$files = array();
if (isset($aitattachmentItem['file'])) {
$files = Zend_Json::decode($aitattachmentItem['file']);
}
$aitattachmentModel->setData($aitattachmentItem)->setAttachmentType($aitattachmentItem['type'])->setTemplateId($template->getId())->setStoreId(0);
/* If file is new - its id = 0 */
if ($aitattachmentItem['aitattachment_id'] != 0) {
$aitattachmentModel->setAttachmentId($aitattachmentItem['aitattachment_id']);
}
if ($aitattachmentModel->getAttachmentType() == Mage_Downloadable_Helper_Download::LINK_TYPE_FILE) {
$aitattachmentFileName = Mage::helper('downloadable/file')->moveFileFromTmp($aitattachmentModel->getBaseTmpPath(), $aitattachmentModel->getBasePath(), $files);
$aitattachmentModel->setAttachmentFile($aitattachmentFileName);
}
$aitattachmentModel->save();
}
}
if ($_deleteItems) {
Mage::getResourceModel('aitemails/aitattachment')->deleteItems($_deleteItems);
}
}
}
}