diff --git a/Helper/Api.php b/Helper/Api.php index 5bde942..ebb3d72 100644 --- a/Helper/Api.php +++ b/Helper/Api.php @@ -118,14 +118,14 @@ public function getContingencyValues ($postData) $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $dir = $objectManager->get('Magento\Framework\App\Filesystem\DirectoryList'); - $mediaPath = $dir->getPath(\Magento\Framework\App\Filesystem\DirectoryList::MEDIA); + $varPath = $dir->getPath(\Magento\Framework\App\Filesystem\DirectoryList::VAR_DIR); - $intelipostMediaPath = $mediaPath . DIRECTORY_SEPARATOR . 'intelipost'; + $intelipostVarPath = $varPath . DIRECTORY_SEPARATOR . 'intelipost'; /* * calculate State Codification */ - $stateFile = $intelipostMediaPath . DIRECTORY_SEPARATOR . 'state_codification.json'; + $stateFile = $intelipostVarPath . DIRECTORY_SEPARATOR . 'state_codification.json'; $stateContent = json_decode (file_get_contents ($stateFile), true); $stateCode = null; @@ -146,7 +146,7 @@ public function getContingencyValues ($postData) * calculate Contingency Table */ $contingencyTable = $this->_scopeConfig->getValue ('carriers/intelipost/contingency_table'); - $tableFile = $intelipostMediaPath . DIRECTORY_SEPARATOR . $contingencyTable; + $tableFile = $intelipostVarPath . DIRECTORY_SEPARATOR . $contingencyTable; $tableContent = json_decode (file_get_contents ($tableFile), true); diff --git a/Model/Import.php b/Model/Import.php index 11b2ff8..9b64507 100644 --- a/Model/Import.php +++ b/Model/Import.php @@ -16,24 +16,24 @@ public function import($tableName) { $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $dir = $objectManager->get('Magento\Framework\App\Filesystem\DirectoryList'); - $mediaPath = $dir->getPath(\Magento\Framework\App\Filesystem\DirectoryList::MEDIA); + $varPath = $dir->getPath(\Magento\Framework\App\Filesystem\DirectoryList::VAR_DIR); $fileName = strpos ($tableName, '.json') !== false ? $tableName : $tableName . '.json'; $data = $this->curl_get_contents (self::FALLBACK_URL . $fileName); if ($data && strcmp ($data, 'Not Found')) { - $intelipostMediaPath = $mediaPath . DIRECTORY_SEPARATOR . 'intelipost'; - if (!is_dir ($intelipostMediaPath)) mkdir ($intelipostMediaPath, 0777, true); + $intelipostVarPath = $varPath . DIRECTORY_SEPARATOR . 'intelipost'; + if (!is_dir ($intelipostVarPath)) mkdir ($intelipostVarPath, 0755, true); - $filePath = $intelipostMediaPath . DIRECTORY_SEPARATOR . $fileName; + $filePath = $intelipostVarPath . DIRECTORY_SEPARATOR . $fileName; file_put_contents ($filePath, $data); if (strcmp ($fileName, 'state_codification')) { $data = $this->curl_get_contents(self::FALLBACK_URL . 'state_codification.json'); - $filePath = $intelipostMediaPath . DIRECTORY_SEPARATOR . 'state_codification.json'; + $filePath = $intelipostVarPath . DIRECTORY_SEPARATOR . 'state_codification.json'; file_put_contents ($filePath, $data); } } diff --git a/composer.json b/composer.json index 7ea4aa2..dd88743 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "intelipost/magento2-quote", "description": "Intelipost Quote", "type": "magento2-module", - "version": "1.3.4", + "version": "1.3.5", "authors": [ { "name": "Intelipost",