This file contains hidden or 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
| ## Имя элементов с типом group должно заканчиватся на _group_onwer | |
| class Helpers | |
| { | |
| public static function multiFields($data, $index = 0, $parent = []) | |
| { | |
| $prepare = []; | |
| if (is_array($data)) { | |
| foreach ($data as $key => $item) { |
This file contains hidden or 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
| <?php | |
| /* | |
| Создаем файлик, запускаэм, потом в плагине тип меняем на default | |
| */ | |
| define('MODX_API_MODE', true); | |
| include_once($_SERVER['DOCUMENT_ROOT'] . "/index.php"); | |
| $modx->db->connect(); |
This file contains hidden or 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
| public function getConfig($elements=[],$folder = '') | |
| { | |
| $folderPath = $folderName = ''; | |
| if(!empty($folder) ){ | |
| $folderPath = $folder.'/'; | |
| $folderName = $folder.'_'; | |
| } | |
| foreach (scandir($this->path.$folderPath) as $entry) { | |
| if($entry == '.' || $entry == '..'){ | |
| continue; |
This file contains hidden or 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
| <div class="field fields-block" data-field="<?= $name ?>"> | |
| <div class="group-title"> | |
| <?= $field['caption'] ?> | |
| </div> | |
| </div> | |
| <style> | |
| .fields-block .group-title { | |
| border: 2px dashed #ccc; | |
| padding: 15px; | |
| width: 100%; |
This file contains hidden or 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
| <?php | |
| use Helpers\Mailer; | |
| require_once MODX_BASE_PATH.'assets/lib/Helpers/Mailer.php'; | |
| $mailConfig = array( | |
| 'isHtml' => 1, | |
| 'to' => '[email protected]', | |
| 'subject' => 'Тема Письма', | |
| 'from' => $modx->getConfig('emailsender'), |
This file contains hidden or 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
| #### Проверяем основной артикул товара | |
| $productMainArticle = $doc->get('longtitle'); | |
| //если у товара есть артикул | |
| if(!empty($productMainArticle)){ | |
| //якщо в товара у основний артикул але у базі його немає | |
| if(empty($mainArticle)){ | |
| $insert[] = [ | |
| 'product_id'=>$productId, |
This file contains hidden or 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
| $ch = curl_init('https://www.gorgany.com/'); | |
| //кастомные заголовки | |
| curl_setopt($ch, CURLOPT_HTTPHEADER, [ | |
| 'Content-Type: application/json' | |
| ]); | |
| //не возвращать ответ в браузер | |
| curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); | |
| //base auth базовая авторизация | |
| curl_setopt($ch, CURLOPT_USERPWD, "$userName:$userPassword"); |
This file contains hidden or 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
| require_once MODX_BASE_PATH.'assets/lib/MODxAPI/modResource.php'; | |
| $R = $modx->getFullTableName('site_content'); | |
| $sql = "select id from $R where `template` in (5,21)"; | |
| $docs = $modx->db->makeArray($modx->db->query($sql)); | |
| foreach ($docs as $doc) { | |
| $obj = new modResource($modx); | |
| $obj->edit($doc['id']); |
This file contains hidden or 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
| <?php | |
| use PhpOffice\PhpSpreadsheet\IOFactory; | |
| use PhpOffice\PhpSpreadsheet\Spreadsheet; | |
| use PhpOffice\PhpSpreadsheet\Style\Border; | |
| use PhpOffice\PhpSpreadsheet\Style\Color; | |
| //создать лист и задать отступы | |
| $oSpreadsheet = new Spreadsheet(); | |
| $sheet = $oSpreadsheet->getActiveSheet(); | |
| $sheet->getPageMargins() |