Skip to content

Commit

Permalink
Merged PR 14096: Release 6.4.16
Browse files Browse the repository at this point in the history
Release 6.4.16 see readme.md

Related work items: #68184, #79713, #86248, #87169, #88046, #88048, #88049, #88050, #88372
  • Loading branch information
sertlab committed Jun 7, 2019
2 parents d59d633 + 8f0a206 commit 7b48a3a
Show file tree
Hide file tree
Showing 14 changed files with 640 additions and 536 deletions.
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Engagement Cloud for Magento
==========================================

Full support documentation and setup guides available here - https://support.dotmailer.com/hc/en-gb/categories/202610368-Magento
Full support documentation and setup guides available here - https://support.dotdigital.com/hc/en-gb/sections/360000722920-Engagement-Cloud-for-Magento

This module uses modman

Expand All @@ -17,6 +17,14 @@ modman clone https://github.com/dotmailer/dotmailer-magento-extension.git
Don't forget to enable symlinks in:
`System->Configuration->Advanced->Developer->Template Settings`

Note: Following patch SUPEE-9767 (https://magento.com/security/patches/supee-9767) enabling symlinks via the admin panel is no longer supported. This can be done by running the following SQL query:

```
INSERT INTO `core_config_data` (`scope`, `scope_id`, `path`, `value`)
VALUES ('default', '0', 'dev/template/allow_symlink', '1')
ON DUPLICATE KEY UPDATE `value` = '1'
```

Facts
-----
- community & enterprise version.
Expand All @@ -34,6 +42,18 @@ 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.16

##### Improvements
- We've improved the coverage of catalog sync by allowing selected custom attributes to be included in the synced data.
- In catalog sync, we are now syncing scoped (store and website) values for products, instead of only the default-level values.
- We resolved some code duplication in the dynamic content blocks.

##### Bug Fixes

- We are now cleaning any custom transactional data keys prior to import, removing invalid (non-alphanumeric) characters, but not skipping records as before.
- The Magento core review module is now decoupled from our contact sync.

# V6.4.15

##### Improvements
Expand Down
24 changes: 3 additions & 21 deletions code/Dotdigitalgroup/Email/Block/Basket.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<?php

use Dotdigitalgroup_Email_Block_ProductImageTrait as ProductImageTrait;

class Dotdigitalgroup_Email_Block_Basket extends Mage_Core_Block_Template
{
use ProductImageTrait;

/**
* @var Mage_Sales_Model_Quote
Expand Down Expand Up @@ -138,27 +141,6 @@ protected function getDynamicStyle()
return $dynamicStyle;
}

/**
* @param $product
* @return Mage_Catalog_Helper_Image
*/
public function getProductImage($product)
{
$helper = Mage::helper('ddg');
if ($helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_PRODUCT_IMAGE)
&& $product->getTypeId() == "simple"
) {
$parentIds = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId());
if (!empty($parentIds)) {
/** @var Mage_Catalog_Model_Product $parentProduct */
$parentProduct = Mage::getModel('catalog/product')->load($parentIds[0]);
return $this->helper('catalog/image')->init($parentProduct, 'small_image')->resize(85);
}
}

return $this->helper('catalog/image')->init($product, 'small_image')->resize(85);
}

/**
* @param $product
* @param string $code
Expand Down
24 changes: 3 additions & 21 deletions code/Dotdigitalgroup/Email/Block/Edc.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<?php

use Dotdigitalgroup_Email_Block_ProductImageTrait as ProductImageTrait;

class Dotdigitalgroup_Email_Block_Edc extends Mage_Core_Block_Template
{
use ProductImageTrait;

/**
* @var
Expand Down Expand Up @@ -524,25 +527,4 @@ protected function getProductsToDisplay($items, $limit, $mode, $type)

return $productsToDisplay;
}

/**
* @param $product Mage_Catalog_Model_Product
* @return Mage_Catalog_Helper_Image
*/
public function getProductImage($product)
{
$helper = Mage::helper('ddg');
if ($helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_PRODUCT_IMAGE)
&& $product->getTypeId() == "simple"
) {
$parentIds = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId());
if (!empty($parentIds)) {
/** @var Mage_Catalog_Model_Product $parentProduct */
$parentProduct = Mage::getModel('catalog/product')->load($parentIds[0]);
return $this->helper('catalog/image')->init($parentProduct, 'small_image')->resize(135);
}
}

return $this->helper('catalog/image')->init($product, 'small_image')->resize(135);
}
}
27 changes: 27 additions & 0 deletions code/Dotdigitalgroup/Email/Block/ProductImageTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

trait Dotdigitalgroup_Email_Block_ProductImageTrait
{
/**
* Trait method for Block classes which fetches a product (or parent product) image
*
* @param $product Mage_Catalog_Model_Product
* @return Mage_Catalog_Helper_Image
*/
public function getProductImage($product)
{
$helper = Mage::helper('ddg');
if ($helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_PRODUCT_IMAGE)
&& $product->getTypeId() == "simple"
) {
$parentIds = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId());
if (!empty($parentIds)) {
/** @var Mage_Catalog_Model_Product $parentProduct */
$parentProduct = Mage::getModel('catalog/product')->load($parentIds[0]);
return $this->helper('catalog/image')->init($parentProduct, 'small_image')->resize(135);
}
}

return $this->helper('catalog/image')->init($product, 'small_image')->resize(135);
}
}
53 changes: 53 additions & 0 deletions code/Dotdigitalgroup/Email/Helper/Keyvalidator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

class Dotdigitalgroup_Email_Helper_Keyvalidator
{
const ENGAGEMENT_CLOUD_PERMISSIBLE_KEY_PATTERN = '/[^A-Za-z0-9-_]/';

/**
* @param array $label
* @param string $replaceSpaceWith
* @param string $suffix
*
* @return string
*/
public function cleanLabel($label, $replaceSpaceWith, $suffix)
{
$label = str_replace(
' ',
$replaceSpaceWith,
$label
);
if ($this->hasInvalidPatternForInsightDataKey($label)) {
$label = $this->stripInvalidCharactersAndIdentify($label, $replaceSpaceWith, $suffix);
}
return $label;
}

/**
* @param string $label
*
* https://support.dotdigital.com/hc/en-gb/articles/212214538-Using-Insight-data-developers-guide-#restrictkeys
*
* @return false|int
*/
public function hasInvalidPatternForInsightDataKey($label)
{
return preg_match(self::ENGAGEMENT_CLOUD_PERMISSIBLE_KEY_PATTERN, $label);
}

/**
* Remove invalid characters and append a suffix to avoid possible key collisions.
*
* @param string $label
* @param string $replaceSpaceWith
* @param string $suffix
*
* @return string
*/
private function stripInvalidCharactersAndIdentify($label, $replaceSpaceWith, $suffix)
{
$safeLabel = preg_replace(self::ENGAGEMENT_CLOUD_PERMISSIBLE_KEY_PATTERN, '', $label);
return $safeLabel.$replaceSpaceWith.$suffix;
}
}
7 changes: 6 additions & 1 deletion code/Dotdigitalgroup/Email/Model/Apiconnector/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ public function setCustomerData(Mage_Customer_Model_Customer $customer)
*/
public function setReviewCollection()
{
if(!Mage::helper('ddg/moduleChecker')->isReviewModuleAvailable()) {
return;
}

$customerId = $this->object->getId();
$collection = Mage::getModel('review/review')->getCollection()
->addCustomerFilter($customerId)
Expand All @@ -138,8 +142,9 @@ public function setReviewCollection()
}

/**
* @return mixed
* @return int
*/

public function getReviewCount()
{
return $this->reviewCollection->getSize();
Expand Down
11 changes: 5 additions & 6 deletions code/Dotdigitalgroup/Email/Model/Catalog.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ protected function _exportCatalog($storeId)
);

foreach ($productCollection as $product) {
$product->setStoreId($storeId);
$connectorProduct = Mage::getModel('ddg_automation/connector_product', $product);
$connectorProduct = Mage::getModel('ddg_automation/connector_product')
->setProduct($product, $storeId);
$connectorProducts[] = $connectorProduct;
}

Expand All @@ -224,11 +224,9 @@ protected function _exportInSingle($storeId, $collectionName, $websiteId)
$products = $this->_getProductsToExport($storeId, true);
if ($products) {
foreach ($products as $product) {
$product->setStoreId($storeId);
$connectorProduct = Mage::getModel(
'ddg_automation/connector_product', $product
);

//register in queue with importer
$check = Mage::getModel('ddg_automation/importer')
->registerQueue(
Expand Down Expand Up @@ -285,7 +283,8 @@ protected function _getProductsToExport($store, $modified = false)
->addAttributeToFilter('entity_id', array('in' => $productIds))
->addCategoryIds()
->addOptionsToResult()
->addUrlRewrite();
->addUrlRewrite()
->setStoreId($store);

//visibility filter
if ($visibility = Mage::getStoreConfig(
Expand Down Expand Up @@ -528,4 +527,4 @@ public function handleConfigSaveAfter(Varien_Event_Observer $observer)

return $this;
}
}
}
Loading

0 comments on commit 7b48a3a

Please sign in to comment.