Skip to content

Instantly share code, notes, and snippets.

View but1head's full-sized avatar
🔥

Nikita Radionov but1head

🔥
View GitHub Profile
<?php
class mstoFilters extends mse2FiltersHandler{
public function getMstoValues(array $fields, array $ids){
$this->modx->getService('msto', 'msto', $this->modx->getOption('msto_core_path', null, $this->modx->getOption('core_path') . 'components/msto/') . 'model/msto/');
$filters = array();
$q = $this->modx->newQuery('mstoOffer');
$q->where(array(
'product_id:IN' => $ids,
));
  1. Создаем плагин в modx. События: OnManagerPageBeforeRender, msOnCreateOrder
switch($modx->event->name) {
  // подключение js обработчика в менеджере
  case 'OnManagerPageBeforeRender':
    $modx->controller->addLastJavascript('/path/ms2-mgr-mnj.js');
    break;
  // отправка заказа в nodejs (nodejs отправит администраторам)
  case 'msOnCreateOrder':		
    $modnodejs = $modx->getService('modnodejs');		
@but1head
but1head / api.php
Created April 1, 2018 15:38
мини рест для modx на slim
<?php
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;
require '........../autoload.php'; // путь к композеру
define('MODX_API_MODE', true);
require $_SERVER["DOCUMENT_ROOT"].'/index.php';
@but1head
but1head / mongoose-integer-id.js
Last active September 22, 2020 13:05
Mongoose / mongo short integer id
// counter collection
const Counter = new Schema({
value: { type: Number, default: 0 },
model: { type: String, required: true },
}, {
timestamps: false,
versionKey: false,
});
// increment function