Skip to content

Commit

Permalink
Merge branch '2.1.x' into 2.2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Aurélien FOUCRET committed Nov 30, 2016
2 parents e9e669a + 9d1cb1b commit 0fe19de
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<script type="text/javascript">
<!--
<?php foreach ($variables as $varName => $value) : ?>
smileTracker.addPageVar('<?php /* @noEscape */ echo $this->escapeJsQuote($varName)?>', '<?php /* @noEscape */ echo $this->escapeJsQuote($value)?>')
smileTracker.addPageVar('<?php /* @noEscape */ echo $this->escapeJsQuote($varName)?>', '<?php /* @noEscape */ echo $block->stripTags($this->escapeJsQuote($value), null, true) ?>')
<?php endforeach; ?>
//-->
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,20 @@ public function beforeSave($object)
$attributeCode = $this->getAttributeCode();
$attributeData = $object->getData($attributeCode);

$rule = $this->ruleFactory->create();
if ($attributeData !== null) {
$rule = $this->ruleFactory->create();

if ($attributeData !== null && is_object($attributeData)) {
$rule = $attributeData;
} elseif ($attributeData !== null && is_array($attributeData)) {
$rule->loadPost($attributeData);
}
if (is_object($attributeData)) {
$rule = $attributeData;
} elseif (is_array($attributeData)) {
$rule->loadPost($attributeData);
} elseif (is_string($attributeData)) {
$attributeData = unserialize($attributeData);
$rule->getConditions()->loadArray($attributeData);
}

$object->setData($attributeCode, serialize($rule->getConditions()->asArray()));
$object->setData($attributeCode, serialize($rule->getConditions()->asArray()));
}

return $this;
}
Expand Down

0 comments on commit 0fe19de

Please sign in to comment.