diff --git a/Block/Adminhtml/Checks.php b/Block/Adminhtml/Checks.php index eb3370b..a43ecd7 100644 --- a/Block/Adminhtml/Checks.php +++ b/Block/Adminhtml/Checks.php @@ -24,7 +24,7 @@ class Checks extends Template const STATUS_OK = 3; const PHP_MIN_VERSION = '7.0'; - const MAGENTO_MIN_VERSION = '2.2.3'; + const MAGENTO_MIN_VERSION = '2.1.17'; const HUB_LATEST_VERSION_FILE = 'https://raw.githubusercontent.com/contactlab/magento2-hub/master/etc/module.xml'; protected $_moduleResource; diff --git a/Helper/Data.php b/Helper/Data.php index 4c0a1c9..b183e9a 100644 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -15,7 +15,6 @@ use Magento\Catalog\Helper\Image as ImageHelper; use Magento\Framework\UrlInterface; use Magento\Catalog\Api\CategoryRepositoryInterface; -use Magento\Framework\Serialize\Serializer\Json; class Data extends AbstractHelper @@ -64,7 +63,6 @@ class Data extends AbstractHelper protected $_imageHelper; protected $_urlBuilder; protected $_categoryRepository; - protected $_serializer; public function __construct( @@ -77,8 +75,7 @@ public function __construct( Address $address, ImageHelper $imageHelper, UrlInterface $urlBuilder, - CategoryRepositoryInterface $categoryRepository, - Json $serializer = null + CategoryRepositoryInterface $categoryRepository ) { $this->_resourceConfig = $resourceConfig; @@ -90,8 +87,6 @@ public function __construct( $this->_imageHelper = $imageHelper; $this->_urlBuilder = $urlBuilder; $this->_categoryRepository = $categoryRepository; - $this->_serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance() - ->get(Json::class); parent::__construct($context); } @@ -107,7 +102,7 @@ public function log($text) } return $this; } - + protected function _isLogEnabled($storeId = null) { return (bool)$this->scopeConfig->getValue(self::CONTACTLAB_HUB_LOG_ENABLED, @@ -233,7 +228,7 @@ public function getRemoteIpAddress($customerId = null) } - + public function sendAbandonedCartToNotSubscribed($storeId = null) { return (bool)$this->scopeConfig->getValue(self::CONTACTLAB_HUB_ABANDONED_CART_TO_NOT_SUBSCRIBED, @@ -394,11 +389,11 @@ public function getExternalId($customer) public function getCustomerExtraProperties($customer, $type = 'extended') { $extraProperties = array(); - $attributesMap = $this->_serializer->unserialize($this->scopeConfig->getValue( + $attributesMap = json_decode($this->scopeConfig->getValue( self::CONTACTLAB_HUB_CUSTOMER_EXTRA_PROPERTIES_ATTRIBUTE_MAP, ScopeInterface::SCOPE_STORE, $customer->getStoreId() - )); + ), true); foreach ($attributesMap as $map) { if($type == $map['hub_type']) @@ -499,7 +494,7 @@ public function getObjProduct($product) if($product->getImage()) { $productImage = $this->_urlBuilder->getBaseUrl(['_type' => UrlInterface::URL_TYPE_MEDIA]) - . 'catalog/product' . $product->getImage(); + . 'catalog/product' . $product->getImage(); } else { diff --git a/Model/Adminhtml/System/Config/Backend/Map/Customer.php b/Model/Adminhtml/System/Config/Backend/Map/Customer.php index be2d8f7..c5f8e9e 100644 --- a/Model/Adminhtml/System/Config/Backend/Map/Customer.php +++ b/Model/Adminhtml/System/Config/Backend/Map/Customer.php @@ -1,27 +1,4 @@ getValue(); - unset($_value[static::XML_PATH_HUB_FIELD_ATTRIBUTE][-1]); - $startOne = array_combine(range(1, count($_value[static::XML_PATH_HUB_FIELD_ATTRIBUTE])), - array_values($_value[static::XML_PATH_HUB_FIELD_ATTRIBUTE])); - $_value[static::XML_PATH_HUB_FIELD_ATTRIBUTE] = $startOne; - $this->setValue($_value); - - parent::beforeSave(); - } -} -*/ - namespace Contactlab\Hub\Model\Adminhtml\System\Config\Backend\Map; @@ -33,7 +10,6 @@ public function beforeSave() use Magento\Framework\Model\Context; use Magento\Framework\Model\ResourceModel\AbstractResource; use Magento\Framework\Registry; -use Magento\Framework\Serialize\Serializer\Json; /** * Class CountryCreditCard @@ -45,11 +21,6 @@ class Customer extends Value */ protected $mathRandom; - /** - * @var \Magento\Framework\Serialize\Serializer\Json - */ - private $serializer; - /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry @@ -59,7 +30,6 @@ class Customer extends Value * @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection * @param array $data - * @param \Magento\Framework\Serialize\Serializer\Json $serializer */ public function __construct( Context $context, @@ -69,12 +39,9 @@ public function __construct( Random $mathRandom, AbstractResource $resource = null, AbstractDb $resourceCollection = null, - array $data = [], - Json $serializer = null + array $data = [] ) { $this->mathRandom = $mathRandom; - $this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance() - ->get(Json::class); parent::__construct($context, $registry, $config, $cacheTypeList, $resource, $resourceCollection, $data); } @@ -90,7 +57,7 @@ public function beforeSave() { unset($value['__empty']); } - $this->setValue($this->serializer->serialize($value)); + $this->setValue(json_encode($value)); return $this; } @@ -102,7 +69,7 @@ public function beforeSave() public function afterLoad() { if ($this->getValue()) { - $value = $this->serializer->unserialize($this->getValue()); + $value = json_decode($this->getValue(), true); if (is_array($value)) { $this->setValue($value); } diff --git a/composer.json b/composer.json index 9a93164..c23ba73 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ }, "type": "magento2-module", - "version": "1.6.0", + "version": "1.7.0", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/etc/module.xml b/etc/module.xml index 188f48d..f3af385 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -1,7 +1,7 @@ - +