diff --git a/README.md b/README.md index e9c5e6a8a..588115f77 100755 --- a/README.md +++ b/README.md @@ -34,17 +34,23 @@ You are welcome to contribute to Engagement Cloud for Magento! You can either: - Fix a bug: please fork this repo and submit the Pull Request to our [Develop branch](https://github.com/dotmailer/dotmailer-magento-extension/tree/develop) Request a feature on our [roadmap](https://roadmap.dotdigital.com) +# V6.4.13 + +##### Bug Fixes +- We've fixed a bug that caused the catalog sync to skip products if invalid data keys were supplied. +- We've fixed a bug related to the use of `utf8_decode` in email templates (note this discontinues support for emojis in email subject lines). +- We've fixed a minor error thrown during the Engagement Cloud template sync. + # V6.4.12 ##### Improvements - - * We've improved the performance of the product sync process by setting a limit when querying products before import - * Resubscribed contacts weren't added back to the "subscriber" address book; they are now - * Configurable, grouped, and bundled products are now correctly synced to Engagement Cloud with the lowest relevant price of their children +- We've improved the performance of the product sync process by setting a limit when querying products before import +- Resubscribed contacts weren't added back to the "subscriber" address book; they are now +- Configurable, grouped, and bundled products are now correctly synced to Engagement Cloud with the lowest relevant price of their children ##### Bug Fixes - * We've fixed incorrect syntax in the Order model (#309) - * We've fixed an issue that caused errors within the Sweet Tooth (Smile.io) integration +- We've fixed incorrect syntax in the Order model (#309) +- We've fixed an issue that caused errors within the Sweet Tooth (Smile.io) integration # V6.4.11 diff --git a/code/Dotdigitalgroup/Email/Block/Adminhtml/Column/Renderer/Template.php b/code/Dotdigitalgroup/Email/Block/Adminhtml/Column/Renderer/Template.php deleted file mode 100755 index 119d620f9..000000000 --- a/code/Dotdigitalgroup/Email/Block/Adminhtml/Column/Renderer/Template.php +++ /dev/null @@ -1,23 +0,0 @@ -isDotmailerTemplate($row->getTemplateCode())) { - - return utf8_decode($row->getTemplateSubject()); - } - - return Mage::helper('adminhtml')->__($row->getTemplateSubject()); - } -} diff --git a/code/Dotdigitalgroup/Email/Block/Adminhtml/System/Email/Grid.php b/code/Dotdigitalgroup/Email/Block/Adminhtml/System/Email/Grid.php deleted file mode 100755 index bf8c33a46..000000000 --- a/code/Dotdigitalgroup/Email/Block/Adminhtml/System/Email/Grid.php +++ /dev/null @@ -1,75 +0,0 @@ -addColumn('template_id', - array( - 'header'=>Mage::helper('adminhtml')->__('ID'), - 'index'=>'template_id' - ) - ); - - $this->addColumn('code', - array( - 'header'=>Mage::helper('adminhtml')->__('Template Name'), - 'index'=>'template_code' - )); - - $this->addColumn('added_at', - array( - 'header'=>Mage::helper('adminhtml')->__('Date Added'), - 'index'=>'added_at', - 'gmtoffset' => true, - 'type'=>'datetime' - )); - - $this->addColumn('modified_at', - array( - 'header'=>Mage::helper('adminhtml')->__('Date Updated'), - 'index'=>'modified_at', - 'gmtoffset' => true, - 'type'=>'datetime' - )); - - $this->addColumn('subject', - array( - 'header'=>Mage::helper('adminhtml')->__('Subject'), - 'index'=>'template_subject', - 'renderer' => 'ddg_automation/adminhtml_column_renderer_template', - )); - /* - $this->addColumn('sender', - array( - 'header'=>Mage::helper('adminhtml')->__('Sender'), - 'index'=>'template_sender_email', - 'renderer' => 'adminhtml/system_email_template_grid_renderer_sender' - )); - */ - $this->addColumn('type', - array( - 'header'=>Mage::helper('adminhtml')->__('Template Type'), - 'index'=>'template_type', - 'filter' => 'adminhtml/system_email_template_grid_filter_type', - 'renderer' => 'adminhtml/system_email_template_grid_renderer_type' - )); - - $this->addColumn('action', - array( - 'header' => Mage::helper('adminhtml')->__('Action'), - 'index' => 'template_id', - 'sortable' => false, - 'filter' => false, - 'width' => '100px', - 'renderer' => 'adminhtml/system_email_template_grid_renderer_action' - )); - - return $this; - } -} - diff --git a/code/Dotdigitalgroup/Email/Model/Adminhtml/Email/Template.php b/code/Dotdigitalgroup/Email/Model/Adminhtml/Email/Template.php index f1bb931e6..eca46c56c 100755 --- a/code/Dotdigitalgroup/Email/Model/Adminhtml/Email/Template.php +++ b/code/Dotdigitalgroup/Email/Model/Adminhtml/Email/Template.php @@ -10,7 +10,7 @@ class Dotdigitalgroup_Email_Model_Adminhtml_Email_Template extends Mage_Adminhtm protected function _afterLoad() { //decompress the title - $this->setTemplateSubject(utf8_decode($this->getTemplateSubject())); + $this->setTemplateSubject($this->getTemplateSubject()); $templateText = $this->getTemplateText(); $transactionalHelper = Mage::helper('ddg/transactional'); if ($transactionalHelper->isStringCompressed($templateText)) { diff --git a/code/Dotdigitalgroup/Email/Model/Connector/Product.php b/code/Dotdigitalgroup/Email/Model/Connector/Product.php index 9a762b0fa..816e16ebf 100755 --- a/code/Dotdigitalgroup/Email/Model/Connector/Product.php +++ b/code/Dotdigitalgroup/Email/Model/Connector/Product.php @@ -146,6 +146,9 @@ public function __construct(Mage_Catalog_Model_Product $product) foreach ($options as $option) { $count = 0; $title = str_replace(' ', '', $option->getDefaultTitle()); + if (!$this->textIsValidForInsightDataKey($title)) { + continue; + } $selections = $option->getSelections(); $sOptions = array(); foreach ($selections as $selection) { @@ -176,6 +179,9 @@ public function __construct(Mage_Catalog_Model_Product $product) $label = strtolower( str_replace(' ', '', $productAttribute['label']) ); + if (!$this->textIsValidForInsightDataKey($label)) { + continue; + } $options = array(); foreach ($productAttribute['values'] as $attribute) { $options[$count]['option'] = $attribute['default_label']; @@ -341,4 +347,17 @@ private function formatPriceValues() '' ); } + + /** + * Ensure text matches insight data key restrictions + * https://support.dotmailer.com/hc/en-gb/articles/212214538-Using-Insight-data-developers-guide-#restrictkeys + * + * @param string $text + * + * @return false|int + */ + private function textIsValidForInsightDataKey($text) + { + return preg_match('/^[a-zA-Z_\\\\-][a-zA-Z0-9_\\\\-]*$/', $text); + } } diff --git a/code/Dotdigitalgroup/Email/Model/Email/Template.php b/code/Dotdigitalgroup/Email/Model/Email/Template.php index 450f65c5b..d7b43ee5e 100755 --- a/code/Dotdigitalgroup/Email/Model/Email/Template.php +++ b/code/Dotdigitalgroup/Email/Model/Email/Template.php @@ -155,7 +155,7 @@ protected function _beforeSave() protected function _afterLoad() { //decompress the subject - $this->setTemplateSubject(utf8_decode($this->getTemplateSubject())); + $this->setTemplateSubject($this->getTemplateSubject()); $templateText = $this->getTemplateText(); $transactionalHelper = Mage::helper('ddg/transactional'); //decompress the content body diff --git a/code/Dotdigitalgroup/Email/Model/Template.php b/code/Dotdigitalgroup/Email/Model/Template.php index 01e2df693..54dfa2da0 100755 --- a/code/Dotdigitalgroup/Email/Model/Template.php +++ b/code/Dotdigitalgroup/Email/Model/Template.php @@ -168,11 +168,6 @@ class Dotdigitalgroup_Email_Model_Template extends Mage_Core_Model_Abstract 'product_price_alert_template' => self::XML_PATH_DDG_TEMPLATE_PRODUCT_PRICE_ALERT ]; - /** - * @var array - */ - public $proccessedCampaings; - /** * Load email_template by code/name. * @@ -212,30 +207,31 @@ public function deleteTemplateByCode($templatecode) public function sync() { $result = ['store' => 'Stores : ', 'message' => 'Done.']; - $lastWebsiteId = '0'; $helper = Mage::helper('ddg'); + $processedCampaigns = []; + /** @var Mage_Core_Model_Store $store */ foreach (Mage::app()->getStores(true) as $store) { - //store not enabled to sync - if (! $helper->isStoreEnabled($store)) { + + if (!$helper->isStoreEnabled($store)) { continue; } - //reset the campaign ids for each website + $websiteId = $store->getWebsiteId(); - if ($websiteId != $lastWebsiteId) { - $this->proccessedCampaings = []; - $lastWebsiteId = $websiteId; + if (empty($processedCampaigns[$websiteId])) { + $processedCampaigns[$websiteId] = []; } + foreach($this->templateConfigIdToDotmailerConfigPath as $configTemplateId => $dotConfigPath) { $campaignId = $store->getConfig($dotConfigPath); $configPath = $this->templateConfigMapping[$configTemplateId]; $emailTemplateId = $store->getConfig($configPath); - if ($campaignId && $emailTemplateId && ! in_array($campaignId, $this->proccessedCampaings)) { + if ($campaignId && $emailTemplateId && !in_array($campaignId, $processedCampaigns[$websiteId])) { $this->syncEmailTemplate($campaignId, $emailTemplateId, $store); $result['store'] .= ', ' . $store->getCode(); - $this->proccessedCampaings[$campaignId] = $campaignId; + $processedCampaigns[$websiteId][$campaignId] = $campaignId; } } } @@ -279,7 +275,7 @@ public function saveTemplate($template, $dmCampaign, $campaignId, $origTemplateC try { $template->setTemplateCode($templateName) ->setOrigTemplateCode($origTemplateCode) - ->setTemplateSubject(utf8_encode($dmCampaign->subject)) + ->setTemplateSubject($dmCampaign->subject) ->setTemplateText($dmCampaign->processedHtmlContent) ->setTemplateType(Mage_Core_Model_Template::TYPE_HTML) ->setTemplateSenderName($dmCampaign->fromName) @@ -313,7 +309,7 @@ private function updateTemplateById($dmCampaign, $campaignId, $templateId, $orig ->setTemplateSenderName($dmCampaign->fromName) ->setTemplateText($dmCampaign->processedHtmlContent) ->setTemplateType(Mage_Core_Model_Template::TYPE_HTML) - ->setTemplateSubject(utf8_encode($dmCampaign->subject)) + ->setTemplateSubject($dmCampaign->subject) ->setTemplateSenderEmail($dmCampaign->fromAddress->email); $template->save(); @@ -355,4 +351,4 @@ public function saveTemplateWithConfigPath($templateConfigPath, $campaignId, $sc return $this->saveTemplate($template, $dmCampaign, $campaignId, $templateConfigPath); } -} \ No newline at end of file +} diff --git a/code/Dotdigitalgroup/Email/etc/config.xml b/code/Dotdigitalgroup/Email/etc/config.xml index 3f8fd6b77..8b9ef48a0 100755 --- a/code/Dotdigitalgroup/Email/etc/config.xml +++ b/code/Dotdigitalgroup/Email/etc/config.xml @@ -2,7 +2,7 @@ - 6.4.12 + 6.4.13 @@ -158,11 +158,6 @@ Dotdigitalgroup_Email_Block - - - Dotdigitalgroup_Email_Block_Adminhtml_System_Email_Grid - - diff --git a/code/Dotdigitalgroup/Email/etc/system.xml b/code/Dotdigitalgroup/Email/etc/system.xml index 7777b38b6..83f8a1002 100755 --- a/code/Dotdigitalgroup/Email/etc/system.xml +++ b/code/Dotdigitalgroup/Email/etc/system.xml @@ -2300,7 +2300,7 @@ 1 - + select ddg_automation/adminhtml_source_campaigns ddg_automation/adminhtml_backend_template diff --git a/composer.json b/composer.json index 76caeb123..ad3fb71b5 100755 --- a/composer.json +++ b/composer.json @@ -4,12 +4,6 @@ "license":"OSL-3.0", "homepage":"https://github.com/dotmailer/dotmailer-magento-extension", "description":"Marketing automation for magento.", - "authors":[ - { - "name":"Calin Diacon", - "email":"calin.diacon@dotmailer.com" - } - ], "require":{ "magento-hackathon/magento-composer-installer":"*" }