1
0
mirror of synced 2024-12-02 18:26:06 +03:00
bitrix-module/intaro.retailcrm/lib/controller/customexportprops.php

57 lines
1.6 KiB
PHP
Raw Normal View History

2024-11-06 19:30:00 +03:00
<?php
namespace Intaro\RetailCrm\Controller;
use Bitrix\Main\Engine\Controller;
use Bitrix\Main\Result;
use Bitrix\Main\Error;
/**
* @category Integration
* @package Intaro\RetailCrm\Controller
* @author RetailCRM <integration@retailcrm.ru>
* @license MIT
* @link http://retailcrm.ru
* @see http://retailcrm.ru/docs
*/
class CustomExportProps extends Controller
{
public function saveAction()
{
$request = $this->getRequest()->getInput();
$response = new Result();
if ($request === null) {
$response->setStatus(new Error('Ошибка'));
}
$requestData = json_decode($this->getRequest()->getInput(), true);
$properties = $requestData['properties'];
$profileId = $requestData['profileId'];
2024-11-06 19:30:00 +03:00
foreach ($properties as $catalogId => $propertyArray) {
$newPropertiesString = '';
foreach ($propertyArray as $property) {
$newPropertiesString .= PHP_EOL . $property['code'] . ' = ' . $property['title'];
}
$filePath = sprintf(
'%s/%s_profileId_%s_catalogId_%s.txt',
2024-11-06 19:30:00 +03:00
$_SERVER['DOCUMENT_ROOT'] . '/local',
'icml_property_retailcrm',
$profileId,
2024-11-06 19:30:00 +03:00
$catalogId
);
$saveResult = file_put_contents($filePath, $newPropertiesString, FILE_APPEND);
}
if (!$saveResult) {
$response->setStatus(new Error('Ошибка'));
}
// return $response->setStatus(Result::SUCCESS);
}
public function deleteAction()
{
}
}