public function process()
 {
     $result = array();
     $queryAll = array('class' => $this->classKey, 'where' => $this->modx->toJSON(['key' => 'tags']), 'select' => $this->modx->toJSON(['value' => 'msProductOption.value']), 'groupby' => 'msProductOption.value', 'limit' => 0, 'fastMode' => true, 'sortby' => 'msProductOption.value', 'sortdir' => 'ASC', 'return' => 'data');
     $this->pdoFetch->setConfig($queryAll);
     $tagsAll = $this->pdoFetch->run();
     $tagsAll = array_map(function ($tag) {
         return array('id' => $tag['value'], 'text' => $tag['value']);
     }, $tagsAll);
     $result['all'] = $tagsAll;
     if ($this->pid !== '0') {
         $queryProduct = array('class' => $this->classKey, 'where' => $this->modx->toJSON(['product_id' => $this->pid, 'key' => 'tags']), 'select' => $this->modx->toJSON(['value' => 'msProductOption.value']), 'groupby' => 'msProductOption.value', 'limit' => 0, 'fastMode' => true, 'sortby' => 'msProductOption.value', 'sortdir' => 'ASC', 'return' => 'data');
         $this->pdoFetch->setConfig($queryProduct);
         $tagsProduct = $this->pdoFetch->run();
         $tagsProduct = array_map(function ($tag) {
             return $tag['value'];
         }, $tagsProduct);
         $result['product'] = $tagsProduct;
     }
     return $this->success('', $result);
 }
$vendorColumns = $modx->getSelectColumns('msVendor', 'Vendor', 'vendor.', array('id'), true);
$orderProductColumns = $modx->getSelectColumns('msOrderProduct', 'msOrderProduct', '', array('id'), true);
// Tables for joining
$leftJoin = '{"class":"msProduct","alias":"msProduct","on":"msProduct.id=msOrderProduct.product_id"},{"class":"msProductData","alias":"Data","on":"msProduct.id=Data.id"},{"class":"msVendor","alias":"Vendor","on":"Data.vendor=Vendor.id"}';
if (!empty($thumbsLeftJoin)) {
    $leftJoin .= $thumbsLeftJoin;
}
$select = '"msProduct":"' . $resourceColumns . '","Data":"' . $dataColumns . '","OrderProduct":"' . $orderProductColumns . '","Vendor":"' . $vendorColumns . '"';
if (!empty($thumbsSelect)) {
    $select .= ',' . implode(',', $thumbsSelect);
}
$default = array('class' => 'msOrderProduct', 'where' => '{"msOrderProduct.order_id":"' . $id . '"}', 'leftJoin' => '[' . $leftJoin . ']', 'select' => '{' . $select . '}', 'sortby' => 'id', 'sortdir' => 'ASC', 'groupby' => 'msOrderProduct.id', 'fastMode' => false, 'limit' => 0, 'return' => 'data', 'nestedChunkPrefix' => 'minishop2_');
// Merge all properties and run!
$scriptProperties['tpl'] = $scriptProperties['tplRow'];
$pdoFetch->setConfig(array_merge($default, $scriptProperties));
$rows = $pdoFetch->run();
/* @var msOrderProduct $row */
foreach ($rows as $row) {
    $outer['cart_count'] += $row['count'];
    $row['old_price'] = $miniShop2->formatPrice($row['original_price'] != $row['price'] ? $row['original_price'] : $row['old_price']);
    $row['price'] = $miniShop2->formatPrice($row['price']);
    $row['cost'] = $miniShop2->formatPrice($row['cost']);
    $row['weight'] = $miniShop2->formatWeight($row['weight']);
    // Additional properties of product
    $options = !is_array($row['options']) ? $modx->fromJSON($row['options']) : $row['options'];
    if (!empty($options) && is_array($options)) {
        foreach ($options as $key => $value) {
            $row['option.' . $key] = $value;
        }
    }
    $row['idx'] = $pdoFetch->idx++;
    }
}
$cart = $miniShop2->cart->get();
$status = $miniShop2->cart->status();
$order = $miniShop2->order->get();
if (empty($status['total_count'])) {
    return !empty($tplEmpty) ? $pdoFetch->getChunk($tplEmpty) : '';
}
$deliveryColumns = $modx->getSelectColumns('msDelivery', 'msDelivery', 'delivery_');
$paymentColumns = $modx->getSelectColumns('msPayment', 'msPayment', 'payment_');
// Default parameters
$default = array('class' => 'msDelivery', 'where' => '{"active":1}', 'select' => '{"msDelivery":"all"}', 'sortby' => 'rank', 'sortdir' => 'ASC', 'return' => 'data', 'fastMode' => false, 'nestedChunkPrefix' => 'minishop2_');
// Merge all properties and run!
$pdoFetch->addTime('Query parameters are prepared.');
$pdoFetch->setConfig(array_merge($default, $scriptProperties));
$deliveries = $pdoFetch->run();
$pdoFetch->addTime('Fetched deliveries.');
$arrays = array('deliveries' => array(), 'payments' => array());
if (!empty($deliveries)) {
    foreach ($deliveries as $di => $delivery) {
        $did = $delivery['id'];
        if (empty($order['delivery']) && $di == 0) {
            $miniShop2->order->add('delivery', $did);
            $order = $miniShop2->order->get();
        }
        $delivery['payments'] = array();
        $pdoFetch->config = array_merge($pdoFetch->config, array('class' => 'msPayment', 'innerJoin' => '[{"class":"msDeliveryMember","alias":"Member","on":"Member.delivery_id=' . $delivery['id'] . ' AND Member.payment_id=msPayment.id"}]', 'select' => '{"msPayment":"all"}'));
        $pdoFetch->addTime('Fetched payments for delivery ' . $delivery['name'] . '.');
        $payments = $pdoFetch->run();
        if (!empty($payments)) {
            foreach ($payments as $pi => $payment) {