Ejemplo n.º 1
0
        } else {
            $_POST[$key] = addslashes($value);
        }
    }
    unset($key, $value);
}
//////////////////////////////////////////////////
$output = '';
if ($cartType == "empty") {
    $shopCart->emptySavedData();
    return;
} elseif (isset($_POST['shk-id'])) {
    $thisPage = $modx->documentIdentifier;
    $orderFormPageUrl = $modx->makeUrl($shkconf['orderFormPage'], '', '', 'full');
    $purchaseArray = $_POST;
    $shopCart->savePurchaseData($purchaseArray);
    $modx->sendRedirect($_SERVER['HTTP_REFERER'], 0, 'REDIRECT_HEADER');
} elseif (isset($_GET['shk_action'])) {
    $action = addslashes($_GET['shk_action']);
    switch ($action) {
        case "empty":
            $shopCart->emptySavedData();
            break;
        case "del":
            $item_index = isset($_GET['n']) && is_numeric($_GET['n']) ? $_GET['n'] : "";
            $shopCart->delArrayItem($item_index);
            break;
    }
    $modx->sendRedirect($_SERVER['HTTP_REFERER'], 0, 'REDIRECT_HEADER');
} elseif (isset($_POST['shk_recount'])) {
    if (!empty($_POST['count'])) {
Ejemplo n.º 2
0
     $defaultProp['tplPath'] = "assets/snippets/shopkeeper/chunks/" . substr($shkconf['lang'], 0, 2) . "/";
 }
 if (file_exists("lang/" . $shkconf['lang'] . "-" . str_replace('-', '', $charset) . ".php")) {
     $s_lang = $shkconf['lang'] . "-" . str_replace('-', '', $charset);
 } elseif (file_exists("lang/" . $shkconf['lang'] . ".php")) {
     $s_lang = $shkconf['lang'];
 } else {
     $s_lang = "russian";
 }
 $shkconf['lang'] == $s_lang;
 $thisPage = $_SERVER['HTTP_REFERER'];
 $action = $request['action'];
 $shopCart = new Shopkeeper($modx, array_merge($shkconf, $defaultProp));
 switch ($action) {
     case "fill_cart":
         $shopCart->savePurchaseData($request);
         $output = $shopCart->getCartContent($shkconf['orderFormPage'], $thisPage);
         break;
     case "empty":
         $shopCart->emptySavedData();
         $output = $shopCart->getCartContent($shkconf['orderFormPage'], $thisPage);
         break;
     case "delete":
         $shopCart->delArrayItem($request['index']);
         $output = $shopCart->getCartContent($shkconf['orderFormPage'], $thisPage);
         break;
     case "recount":
         $shopCart->recountDataArray($request['index'], $request['count'], false);
         $output = $shopCart->getCartContent($shkconf['orderFormPage'], $thisPage);
         break;
     case "refresh_cart":