Skip to content

Instantly share code, notes, and snippets.

@versedi
Last active October 7, 2016 06:26
Show Gist options
  • Save versedi/0cddb6d6f787b7033057748083c66dbe to your computer and use it in GitHub Desktop.
Save versedi/0cddb6d6f787b7033057748083c66dbe to your computer and use it in GitHub Desktop.
FIX-Magento-Untranslated-NonStyled-Newsletter-Subscription-Unsubscription-Emails-InlineCss-Not-Rendered-From-Backend.php
<?php
// app/code/core/Mage/Core/Model/Email/Template/Abtract.php
//example on sendUnsubscriptionEmail but has to be done everywhere.
/**
* Sends out unsubsciption email
*
* @return Mage_Newsletter_Model_Subscriber
*/
public function sendUnsubscriptionEmail()
{
if ($this->getImportMode()) {
return $this;
}
if(!Mage::getStoreConfig(self::XML_PATH_UNSUBSCRIBE_EMAIL_TEMPLATE)
|| !Mage::getStoreConfig(self::XML_PATH_UNSUBSCRIBE_EMAIL_IDENTITY)
) {
return $this;
}
$translate = Mage::getSingleton('core/translate');
/* @var $translate Mage_Core_Model_Translate */
$translate->setTranslateInline(false);
$email = Mage::getModel('core/email_template');
// We need to initialize setDesignConfig to ensure the inline css
// is rendered from frontend area.
$email->setDesignConfig(array(
'area' => 'frontend',
'store' => $this->getStoreId()
));
$email->sendTransactional(
Mage::getStoreConfig(self::XML_PATH_UNSUBSCRIBE_EMAIL_TEMPLATE),
Mage::getStoreConfig(self::XML_PATH_UNSUBSCRIBE_EMAIL_IDENTITY),
$this->getEmail(),
$this->getName(),
array('subscriber'=>$this)
);
$translate->setTranslateInline(true);
return $this;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment