Пример #1
0
$mod_config_table = $dbprefix . "manager_shopkeeper_config";
if ($charset == "UTF-8") {
    header('Content-Type: text/html; charset=utf-8');
} elseif ($charset == "windows-1251") {
    header('Content-Type: text/html; charset=windows-1251');
}
define('SHOPKEEPER_PATH', "snippets/shopkeeper/");
require_once "classes/class.shopkeeper.php";
function str2bool($str)
{
    return $str && $str != 'false' ? true : false;
}
if (isset($request['action'])) {
    //параметры по умолчанию
    $snippetProp = $modx->db->getValue($modx->db->select("properties", $modx->getFullTablename('site_snippets'), "name = 'Shopkeeper'"));
    $defaultProp = $modx->parseProperties($snippetProp);
    $shkconf = array();
    $shkconf['shkPath'] = realpath(dirname(__FILE__));
    $shkconf['lang'] = isset($request['lang']) ? $request['lang'] : $manager_language;
    $shkconf['cartType'] = isset($request['cart_type']) ? $request['cart_type'] : 'full';
    $shkconf['cartTpl'] = isset($request['cart_tpl']) ? $request['cart_tpl'] : "@FILE:chunk_shopCart.tpl";
    $shkconf['cartRowTpl'] = isset($request['cart_row_tpl']) ? $request['cart_row_tpl'] : "@FILE:chunk_shopCartRow.tpl";
    $shkconf['additDataTpl'] = isset($request['addit_data_tpl']) ? $request['addit_data_tpl'] : '';
    $shkconf['priceTV'] = isset($request['price_tv']) ? $request['price_tv'] : 'price';
    $shkconf['linkAllow'] = isset($request['link_allow']) ? str2bool($request['link_allow']) : ($linkAllow = true);
    $shkconf['noCounter'] = isset($request['nocounter']) ? str2bool($request['nocounter']) : false;
    $shkconf['changePrice'] = isset($request['change_price']) ? str2bool($request['change_price']) : false;
    $shkconf['orderFormPage'] = isset($request['order_page']) ? $request['order_page'] : '';
    $shkconf['currency'] = isset($request['currency']) ? $request['currency'] : '';
    $shkconf['charset'] = $charset;
    if (empty($defaultProp['tplPath'])) {