-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release 6.4.16 see readme.md Related work items: #68184, #79713, #86248, #87169, #88046, #88048, #88049, #88050, #88372
- Loading branch information
Showing
14 changed files
with
640 additions
and
536 deletions.
There are no files selected for viewing
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
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
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
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
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); | ||
} | ||
} |
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
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; | ||
} | ||
} |
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
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
Oops, something went wrong.