}
    }
    $images[] = $row;
}
$pdoFetch->addTime(!empty($getTags) ? 'Thumbnails and tags was retrieved' : 'Thumbnails was retrieved');
// Processing chunks
$output = array();
foreach ($images as $row) {
    $tpl = $pdoFetch->defineChunk($row);
    $output[] = empty($tpl) ? '<pre>' . $pdoFetch->getChunk('', $row) . '</pre>' : $pdoFetch->getChunk($tpl, $row, $pdoFetch->config['fastMode']);
}
$pdoFetch->addTime('Rows was templated');
// Return output
$log = '';
if ($modx->user->hasSessionContext('mgr') && !empty($showLog)) {
    $log .= '<pre class="ms2GalleryLog">' . print_r($pdoFetch->getTime(), 1) . '</pre>';
}
if (!empty($toSeparatePlaceholders)) {
    $output['log'] = $log;
    $modx->setPlaceholders($output, $toSeparatePlaceholders);
} else {
    if (count($output) === 1 && !empty($tplSingle)) {
        $output = $pdoFetch->getChunk($tplSingle, array_shift($images));
    } else {
        $output = implode($outputSeparator, $output);
        if (!empty($output)) {
            $arr = array_shift($images);
            $arr['rows'] = $output;
            if (!empty($tplOuter)) {
                $output = $pdoFetch->getChunk($tplOuter, $arr);
            }
Example #2
0
            $value = !empty($profile['extended'][$tmp]) ? $profile['extended'][$tmp] : '';
        } else {
            $value = $profile[$value];
        }
        $tmp = $miniShop2->order->add($key, $value);
        if ($tmp['success'] && !empty($tmp['data'][$key])) {
            $form[$key] = $tmp['data'][$key];
        }
    }
    if (empty($form[$key]) && !empty($order[$key])) {
        $form[$key] = $order[$key];
        unset($order[$key]);
    }
}
$form = array_merge($order, $form);
$form['errors'] = array();
if (!empty($_POST)) {
    $response = $miniShop2->order->getDeliveryRequiresFields();
    $requires = $response['data']['requires'];
    foreach ($_POST as $field => $val) {
        $validated = $miniShop2->order->validate($field, $val);
        if (in_array($field, $requires) && empty($validated)) {
            $form['errors'][$field] = 'error';
        }
    }
}
$output = empty($tplOuter) ? $pdoFetch->getChunk('', $form) : $pdoFetch->getChunk($tplOuter, $form);
if ($modx->user->hasSessionContext('mgr') && !empty($showLog)) {
    $output .= '<pre class="msOrderLog">' . print_r($pdoFetch->getTime(), 1) . '</pre>';
}
return $output;
Example #3
0
        $sources[$row['source']] = $source;
    } else {
        $source = $sources[$row['source']];
    }
    if (!empty($source) && $source instanceof modMediaSource && !empty($row['image'])) {
        $row['image'] = $source->getObjectUrl($row['image']);
    }
    $row['idx'] = $pdoFetch->idx++;
    $tpl = $pdoFetch->defineChunk($row);
    if (!empty($additionalPlaceholders)) {
        $row = array_merge($additionalPlaceholders, $row);
    }
    $output[] = !empty($tpl) ? $pdoFetch->getChunk($tpl, $row, $pdoFetch->config['fastMode']) : '<pre>' . $pdoFetch->getChunk('', $row) . '</pre>';
}
if ($modx->user->hasSessionContext('mgr') && !empty($showLog)) {
    $output['log'] = '<pre class="pdoUsersLog">' . print_r($pdoFetch->getTime(), 1) . '</pre>';
}
// Return output
if (!empty($toSeparatePlaceholders)) {
    $modx->setPlaceholders($output, $toSeparatePlaceholders);
} else {
    $output = implode($outputSeparator, $output);
    if (!empty($tplWrapper) && (!empty($wrapIfEmpty) || !empty($output))) {
        $output = $pdoFetch->getChunk($tplWrapper, array('output' => $output), $pdoFetch->config['fastMode']);
    }
    if (!empty($toPlaceholder)) {
        $modx->setPlaceholder($toPlaceholder, $output);
    } else {
        return $output;
    }
}
        $row['old_price'] = $miniShop2->formatPrice($row['old_price']);
        $row['weight'] = $miniShop2->formatWeight($row['weight']);
        $row['idx'] = $pdoFetch->idx++;
        $opt_time_start = microtime(true);
        $options = $modx->call('msProductData', 'loadOptions', array(&$modx, $row['id']));
        $row = array_merge($row, $options);
        $opt_time += microtime(true) - $opt_time_start;
        $tpl = $pdoFetch->defineChunk($row);
        $output[] .= empty($tpl) ? $pdoFetch->getChunk('', $row) : $pdoFetch->getChunk($tpl, $row, $pdoFetch->config['fastMode']);
    }
    $pdoFetch->addTime('Loaded options for products', $opt_time);
    $pdoFetch->addTime('Returning processed chunks');
}
$log = '';
if ($modx->user->hasSessionContext('mgr') && !empty($showLog)) {
    $log .= '<pre class="msProductsLog">' . print_r($pdoFetch->getTime(), 1) . '</pre>';
}
// Return output
if (!empty($toSeparatePlaceholders)) {
    $modx->setPlaceholders($output, $toSeparatePlaceholders);
    $modx->setPlaceholder($log, $toSeparatePlaceholders . 'log');
} else {
    if (empty($outputSeparator)) {
        $outputSeparator = "\n";
    }
    $output = is_array($output) ? implode($outputSeparator, $output) : $output;
    $output .= $log;
    if (!empty($tplWrapper) && (!empty($wrapIfEmpty) || !empty($output))) {
        $output = $pdoFetch->getChunk($tplWrapper, array('output' => $output), $pdoFetch->config['fastMode']);
    }
    if (!empty($toPlaceholder)) {
            $where = array_merge($where, $tmp);
        }
    }
    unset($scriptProperties['where']);
    $q = $modx->newQuery($class, $where);
    $q->select('id');
    if ($q->prepare() && $q->stmt->execute()) {
        $tmp = $q->stmt->fetchAll(PDO::FETCH_COLUMN);
        $ids = !empty($ids) ? array_intersect($ids, $tmp) : $tmp;
        $pdoFetch->addTime('Fetched ids for building filters: "' . implode(',', $ids) . '"');
    }
}
// ---------------------- Nothing to filter, exit
if (empty($ids)) {
    if ($modx->user->hasSessionContext('mgr') && !empty($showLog)) {
        $log = '<pre class="mFilterLog">' . print_r($pdoFetch->getTime(), 1) . '</pre>';
    } else {
        $log = '';
    }
    $output = array_merge($output, array('filters' => $modx->lexicon('mse2_err_no_filters'), 'results' => $modx->lexicon('mse2_err_no_results'), 'log' => $log));
    if (!empty($toSeparatePlaceholders)) {
        $modx->setPlaceholders($output, $toSeparatePlaceholders);
        return;
    } elseif (!empty($toPlaceholders)) {
        $modx->setPlaceholders($output, $toPlaceholders);
        return;
    } else {
        return $output['results'] . $log;
    }
}
// ---------------------- Checking for suggestions processing