Skip to content

Commit

Permalink
Merged PR 12766: Release V6.4.13
Browse files Browse the repository at this point in the history
- 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.

Related work items: #85166, #85311, #85616
  • Loading branch information
adeelq committed Mar 27, 2019
2 parents f6db1ef + 00c3c33 commit e4702bf
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 136 deletions.
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

This file was deleted.

75 changes: 0 additions & 75 deletions code/Dotdigitalgroup/Email/Block/Adminhtml/System/Email/Grid.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
19 changes: 19 additions & 0 deletions code/Dotdigitalgroup/Email/Model/Connector/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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'];
Expand Down Expand Up @@ -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);
}
}
2 changes: 1 addition & 1 deletion code/Dotdigitalgroup/Email/Model/Email/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 13 additions & 17 deletions code/Dotdigitalgroup/Email/Model/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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;
}
}
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -355,4 +351,4 @@ public function saveTemplateWithConfigPath($templateConfigPath, $campaignId, $sc

return $this->saveTemplate($template, $dmCampaign, $campaignId, $templateConfigPath);
}
}
}
7 changes: 1 addition & 6 deletions code/Dotdigitalgroup/Email/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<config>
<modules>
<Dotdigitalgroup_Email>
<version>6.4.12</version>
<version>6.4.13</version>
</Dotdigitalgroup_Email>
</modules>
<frontend>
Expand Down Expand Up @@ -158,11 +158,6 @@
<ddg_automation>
<class>Dotdigitalgroup_Email_Block</class>
</ddg_automation>
<adminhtml>
<rewrite>
<system_email_template_grid>Dotdigitalgroup_Email_Block_Adminhtml_System_Email_Grid</system_email_template_grid>
</rewrite>
</adminhtml>
</blocks>
<events>
<admin_system_config_changed_section_connector_api_credentials>
Expand Down
2 changes: 1 addition & 1 deletion code/Dotdigitalgroup/Email/etc/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2300,7 +2300,7 @@
<show_in_store>1</show_in_store>
</newsletter_title>
<newsletter_subscription_success_email_template translate="label" module="ddg">
<label>Succces Email Templates</label>
<label>Success Email Templates</label>
<frontend_type>select</frontend_type>
<source_model>ddg_automation/adminhtml_source_campaigns</source_model>
<backend_model>ddg_automation/adminhtml_backend_template</backend_model>
Expand Down
6 changes: 0 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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":"*"
}
Expand Down

0 comments on commit e4702bf

Please sign in to comment.