Beispiel #1
0
 public function deleteItem()
 {
     if (isset($_SESSION['kr_item'][$this->data['row']])) {
         //if (is_numeric($row_api_id)){
         if (isset($_SESSION['kr_item'][$this->data['row']]['row_api_id'])) {
             $row_api_id = $_SESSION['kr_item'][$this->data['row']]['row_api_id'];
             $ApiFunctions = new ApiFunctions();
             $ApiFunctions->deleteItemFromCart($row_api_id);
         }
         unset($_SESSION['kr_item'][$this->data['row']]);
     }
     $this->code = 1;
     $this->msg = "";
 }
Beispiel #2
0
            $merchant_token = Yii::app()->functions->getMerchantActivationToken($merchant_id);
            $confirmation_link = Yii::app()->getBaseUrl(true) . "/store/confirmorder/?id=" . $data['order_id'] . "&token={$merchant_token}";
            $final_tpl = smarty('receipt-number', Yii::app()->functions->formatOrderNumber($data['order_id']), $merchant_receipt_content);
            $final_tpl = smarty('customer-name', $data['full_name'], $final_tpl);
            $final_tpl = smarty('receipt', $receipt, $final_tpl);
            $final_tpl = smarty('confirmation-link', $confirmation_link, $final_tpl);
        } else {
            $final_tpl = $tpl;
        }
        $global_admin_sender_email = Yii::app()->functions->getOptionAdmin('global_admin_sender_email');
        if (empty($global_admin_sender_email)) {
            $global_admin_sender_email = $receipt_sender;
        }
        // fixed if email is multiple
        $merchant_notify_email = explode(",", $merchant_notify_email);
        if (is_array($merchant_notify_email) && count($merchant_notify_email) >= 1) {
            foreach ($merchant_notify_email as $merchant_notify_email_val) {
                sendEmail(trim($merchant_notify_email_val), $global_admin_sender_email, $merchant_receipt_subject, $final_tpl);
            }
        }
    }
    // send SMS
    Yii::app()->functions->SMSnotificationMerchant($merchant_id, $data, $data_raw);
    // SEND FAX
    Yii::app()->functions->sendFax($merchant_id, $_GET['id']);
}
$_SESSION['kr_receipt'] = array($data['order_id']);
if (isset($_SESSION['api_token'])) {
    $api = new ApiFunctions();
    $api->deleteToken($_SESSION['api_token']);
}
 public function actionApicheckout()
 {
     $data = $_GET;
     if (isset($data['token'])) {
         $ApiFunctions = new ApiFunctions();
         if ($res = $ApiFunctions->getCart($data['token'])) {
             $order = '';
             $merchant_id = $res[0]['merchant_id'];
             foreach ($res as $val) {
                 $temp = json_decode($val['raw_order'], true);
                 $temp_1 = '';
                 if (is_array($temp) && count($temp) >= 1) {
                     $temp_1['row'] = $val['id'];
                     $temp_1['row_api_id'] = $val['id'];
                     $temp_1['merchant_id'] = $val['merchant_id'];
                     $temp_1['currentController'] = "store";
                     foreach ($temp as $key => $value) {
                         $temp_1[$key] = $value;
                     }
                     $order[] = $temp_1;
                 }
             }
             //unset($_SESSION);
             $_SESSION['api_token'] = $data['token'];
             $_SESSION['currentController'] = "store";
             $_SESSION['kr_merchant_id'] = $merchant_id;
             $_SESSION['kr_delivery_options']['delivery_type'] = $data['delivery_type'];
             $_SESSION['kr_delivery_options']['delivery_date'] = $data['delivery_date'];
             $_SESSION['kr_delivery_options']['delivery_time'] = $data['delivery_time'];
             $_SESSION['kr_item'] = $order;
             $redirect = Yii::app()->getBaseUrl(true) . "/store/checkout";
             header("Location: " . $redirect);
             $this->render('error', array('message' => t("Please wait while we redirect you")));
         } else {
             $this->render('error', array('message' => t("Token not found")));
         }
     } else {
         $this->render('error', array('message' => t("Token is missing")));
     }
 }