ls -l
| <?php | |
| /** @var $_DocLister DocLister */ | |
| /** @var $data array */ | |
| $placeholders = $data['placeholders']; | |
| $categoryTpl = $_DocLister->getCFGDef('categoryTpl'); | |
| $products = explode('<!--product-->',$placeholders['dl.wrap']); | |
| $products = array_filter($products); | |
| $groups = []; |
| <?php | |
| /** | |
| * default config | |
| */ | |
| global $_lang; | |
| return [ | |
| 'General' => [ | |
| 'default' => true, |
| public static function prepare(array $data = array(), DocumentParser $modx, $_DocLister, prepare_DL_Extender $_extDocLister){ | |
| return $data; | |
| } | |
| //FormLister preare нельзять анонимно только название функции или метода | |
| function setSubject(DocumentParser $modx,array $data,\FormLister\Form $Fl,string $name) | |
| { | |
| } | |
| <?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() |
| 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']); |
| $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"); |
| #### Проверяем основной артикул товара | |
| $productMainArticle = $doc->get('longtitle'); | |
| //если у товара есть артикул | |
| if(!empty($productMainArticle)){ | |
| //якщо в товара у основний артикул але у базі його немає | |
| if(empty($mainArticle)){ | |
| $insert[] = [ | |
| 'product_id'=>$productId, |
| <?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'), |