Last active
August 29, 2015 13:56
-
-
Save deivisonarthur/9083709 to your computer and use it in GitHub Desktop.
Como enviar template customizada pelo magento e como setar variáveis na template. Outra opção é como criar invoice auto e ou apos pagamento no modulo de pagamento enviando email de invoice
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function sendCustomMail($CustomerName, $email, $increment_id, $template) { | |
// Load from magento config.. | |
$sender = Array('name' => Mage::getStoreConfig('trans_email/ident_sales/name'), 'email' => Mage::getStoreConfig('trans_email/ident_sales/email') ); | |
$storeId = Mage::app()->getStore()->getId(); | |
$translate = Mage::getSingleton('core/translate'); | |
$datetime = new DateTime(); | |
$dtcancel = $datetime->format('d/m/Y H:i:s'); | |
// Add some custom variables here to pass into the template. | |
$emailTemplateVariables['CustomerName'] = $CustomerName; | |
$emailTemplateVariables['increment_id'] = $increment_id; | |
$emailTemplateVariables['CreatedCancel'] = $dtcancel; | |
$emailTemplateVariables['store_url'] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); | |
Mage::getModel('core/email_template') | |
->sendTransactional($template, $sender, $email, $username, $emailTemplateVariables, $storeId); | |
$translate->setTranslateInline(true); | |
} | |
// Dispara email de cancelamento para o cliente - ID da template de cancelamento é 15 | |
$this->sendCustomMail($order->getCustomerName(),$order->getCustomerEmail(),$order->getIncrementId(),"15"); | |
/* | |
Pode passar objeto dessa forma :O | |
array( | |
'rastreamento' => $rastreamento, | |
'order' => $rastreamento->getOrder() | |
) | |
Assim lê na template assim: {{var order.increment_id}} ou {{htmlescape var=$order.getCustomerName()}} | |
*/ |
Variaveis nas templates: http://go.magento.com/support/kb/entry/name/defining-transactional-variables/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Create invoice online: http://inchoo.net/ecommerce/magento/how-to-create-magento-invoice-from-order/