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 | |
| switch($modx->event->name){ | |
| case 'OnFileManagerUpload': | |
| $source = & $scriptProperties['source']; | |
| if(!$source->hasErrors()){ | |
| /* | |
| Запрещаем загрузку в корень, точнее удаляем новый файл, |
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
| CREATE TABLE new_tbl AS | |
| SELECT | |
| 2bp_customer.*, 2bp_address.company, 2bp_address.address_1, 2bp_address.address_2, 2bp_address.city, 2bp_address.postcode, 2bp_address.country_id, 2bp_address.zone_id | |
| FROM | |
| 2bp_customer LEFT JOIN 2bp_address USING(customer_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 | |
| ini_set("memory_limit", "512M"); | |
| set_time_limit(120); | |
| // Указываем ID родителя (в данном примере - 76) для выборки всех дочерних ресурсов с вложенностью 10 | |
| $child = $modx->getChildIds(76, 10, array('context' => 'web')); | |
| // print join($child, ','); | |
| // return; | |
| $collection = $modx->getIterator('modResource', array( | |
| 'id:IN' => $child, | |
| //'class_key' => 'msProduct', |
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 | |
| ini_set("max_execution_time", 0); | |
| ignore_user_abort(true); | |
| $current_prefix = $modx->config['table_prefix']; | |
| $new_prefix = 'My_Prefix234_'; | |
| $stmt = $modx->query("SHOW TABLES"); | |
| $tables = $stmt->fetchAll(PDO::FETCH_NUM); |
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 | |
| $eventName = $modx->event->name; | |
| switch($eventName) { | |
| // case 'OnWebPageInit': | |
| // if ($modx->context->get('key') == 'mgr') {return;} | |
| // $modx->lexicon->load($modx->cultureKey . ':minishop2:default'); | |
| // break; | |
| case 'OnParseDocument': | |
| if ($modx->context->get('key') == 'mgr') {return;} |
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 | |
| ini_set('max_execution_time', 0); | |
| ignore_user_abort(true); | |
| $c = 'modResource'; | |
| $q = $modx->newQuery($c); | |
| $q->where(array('class_key' => 'msCategory')); | |
| $q->sortby('id'); | |
| $q->select(array( | |
| "{$c}.*", | |
| )); |
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
| {'!AjaxForm' | snippet : [ | |
| 'snippet' => 'FormIt', | |
| 'form' => 'orderFormTpl', | |
| 'emailTpl' => 'orderEmailTpl', | |
| 'hooks' => 'email', | |
| 'emailFrom' => $_modx->config.emailsender, | |
| 'emailFromName' => $_modx->config.site_name, | |
| 'emailSubject' => 'Заявка на подбор оборудования {$_modx->config.site_name}', | |
| 'emailTo' => $_modx->config.emailsender, | |
| 'validate' => 'name:required,phone:oneOfTwoFields,email:oneOfTwoFields,link:blank', |
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
| {'!UpdateProfile' | snippet : [ | |
| 'allowedExtendedFields' => 'subscribed', | |
| ]} | |
| <input type="hidden" name="subscribed" value="0"> | |
| <input type="checkbox" [[!+subscribed:FormItIsChecked=`1`]] id="subscribed" name="subscribed" value="1"/> | |
| <label for="subscribed">Подписка на рассылку и акции</label> |
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
| {'!pdoResources' | snippet : [ | |
| 'class' => 'msOrder', | |
| 'select' => '{ | |
| "msOrder":"*", | |
| "OrderStatus":"OrderStatus.name as status_name", | |
| "Delivery":"Delivery.name as delivery_name", | |
| "Payment":"Payment.name as payment_name" | |
| }', | |
| 'leftJoin' => '{ | |
| "OrderStatus": { |
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 | |
| print '<pre>'; | |
| $query = $this->modx->newQuery('msProduct'); | |
| $query->setClassAlias('Product'); | |
| $query->leftJoin('msProductData','Data', '`Product`.`id` = `Data`.`id`'); | |
| $query->select($this->modx->getSelectColumns('msProduct','Product','')); | |
| $query->select($this->modx->getSelectColumns('msProductData','Data','data.')); | |
| $query->where(array( | |
| '`Data`.`vendor`' => 5, |