当前位置: 首页>>代码示例>>PHP>>正文


PHP Cart::getOrderTotal方法代码示例

本文整理汇总了PHP中Cart::getOrderTotal方法的典型用法代码示例。如果您正苦于以下问题:PHP Cart::getOrderTotal方法的具体用法?PHP Cart::getOrderTotal怎么用?PHP Cart::getOrderTotal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cart的用法示例。


在下文中一共展示了Cart::getOrderTotal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initContent

 /**
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     parent::initContent();
     $id_cart = Tools::GetValue('id_cart');
     $cart = new Cart((int) $id_cart);
     $liqpay = new Liqpay();
     $total = $cart->getOrderTotal(true, 3);
     $liqpay->validateOrder(intval($cart->id), Configuration::get('PS_OS_PREPARATION'), $total, $liqpay->displayName);
     $currency = new Currency((int) $cart->id_currency);
     $private_key = Configuration::get('LIQPAY_PRIVATE_KEY');
     $public_key = Configuration::get('LIQPAY_PUBLIC_KEY');
     $amount = number_format($cart->getOrderTotal(true, Cart::BOTH), 1, '.', '');
     $currency = $currency->iso_code == 'RUR' ? 'RUB' : $currency->iso_code;
     $order_id = '000' . $id_cart;
     $description = 'Order #' . $order_id;
     $result_url = 'http://' . htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . __PS_BASE_URI__ . 'index.php?controller=history';
     $server_url = 'http://' . htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . $liqpay->getPath() . 'validation.php';
     $type = 'buy';
     $version = '3';
     $language = Configuration::get('PS_LOCALE_LANGUAGE') == 'en' ? 'en' : 'ru';
     $data = base64_encode(json_encode(array('version' => $version, 'public_key' => $public_key, 'amount' => $amount, 'currency' => $currency, 'description' => $description, 'order_id' => $order_id, 'type' => $type, 'language' => $language)));
     $signature = base64_encode(sha1($private_key . $data . $private_key, 1));
     $this->context->smarty->assign(compact('data', 'signature'));
     $this->setTemplate('redirect.tpl');
 }
开发者ID:litalex,项目名称:plugin-prestashop,代码行数:28,代码来源:redirect.php

示例2: postProcess

 public function postProcess()
 {
     $sid = Configuration::get('TWOCHECKOUTPP_SID');
     $secret_word = Configuration::get('TWOCHECKOUTPP_SECRET');
     $credit_card_processed = $_REQUEST['credit_card_processed'];
     $order_number = $_REQUEST['order_number'];
     $cart_id = $_REQUEST['merchant_order_id'];
     $cart = new Cart($cart_id);
     $checkout = new twocheckoutpp();
     if (Configuration::get('TWOCHECKOUTPP_CURRENCY') > 0) {
         $amount = number_format($cart->getOrderTotal(true, 3), 2, '.', '');
         $currency_from = Currency::getCurrency($cart->id_currency);
         $currency_to = Currency::getCurrency(Configuration::get('TWOCHECKOUTPP_CURRENCY'));
         $amount = Tools::ps_round($amount / $currency_from['conversion_rate'], 2);
         $total = number_format(Tools::ps_round($amount *= $currency_to['conversion_rate'], 2), 2, '.', '');
     } else {
         $total = number_format($cart->getOrderTotal(true, 3), 2, '.', '');
     }
     //Check the hash
     $compare_string = $secret_word . $sid . $order_number . $total;
     $compare_hash1 = strtoupper(md5($compare_string));
     $compare_hash2 = $_REQUEST['key'];
     if ($compare_hash1 == $compare_hash2) {
         $customer = new Customer($cart->id_customer);
         $total = (double) $cart->getOrderTotal(true, Cart::BOTH);
         $checkout->validateOrder($cart_id, _PS_OS_PAYMENT_, $total, $checkout->displayName, '', array(), NULL, false, $customer->secure_key);
         $order = new Order($checkout->currentOrder);
         Tools::redirect('index.php?controller=order-confirmation&id_cart=' . (int) $cart->id . '&id_module=' . (int) $this->module->id . '&id_order=' . $checkout->currentOrder);
     } else {
         echo 'Hash Mismatch! Please contact the seller directly for assistance.</br>';
         echo 'Total: ' . $total . '</br>';
         echo '2CO Total: ' . $_REQUEST['total'];
     }
 }
开发者ID:stefanikolov,项目名称:prestashop-2checkout-api,代码行数:34,代码来源:validation.php

示例3: postProcess

 /**
  * @see FrontController::postProcess()
  */
 public function postProcess()
 {
     parse_str($_POST['optData'], $optData);
     $id_cart = (int) $optData['cartId'];
     $cart = new Cart($id_cart);
     if ($cart->id_customer == 0 || $cart->id_address_delivery == 0 || $cart->id_address_invoice == 0 || !$this->module->active) {
         die('Cannot create order for this cart.');
     }
     $customer = new Customer($cart->id_customer);
     if (!Validate::isLoadedObject($customer)) {
         die('No customer for this order.');
     }
     $currency = new Currency((int) $cart->id_currency);
     $paid_amount = $_POST['amount'];
     $order_amount = $cart->getOrderTotal(true, Cart::BOTH);
     $apiHash = $_SERVER['HTTP_API_HASH'];
     $query = http_build_query($_POST);
     $hash = hash_hmac("sha512", $query, $this->module->secret_key);
     if ($apiHash == $hash && $paid_amount == $order_amount) {
         //success
         $this->module->validateOrder($cart->id, Configuration::get('PS_OS_PAYMENT'), $paid_amount, $this->module->displayName, 'Invoice Code: ' . $_POST['invoiceCode'], array(), (int) $currency->id, false, $customer->secure_key);
     } else {
         //failed transaction
     }
 }
开发者ID:inpay,项目名称:InPay-prestashop-plugin,代码行数:28,代码来源:validation.php

示例4: initContent

 public function initContent()
 {
     $payu = new PayU();
     $id_cart = Tools::getValue('id_cart');
     $id_payu_session = $this->context->cookie->__get('payu_order_id');
     if (Tools::getValue('error')) {
         Tools::redirect('order.php?error=' . Tools::getValue('error'), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently');
     }
     $payu->id_cart = $id_cart;
     $payu->payu_order_id = $id_payu_session;
     $order_payment = $payu->getOrderPaymentBySessionId($payu->payu_order_id);
     $id_order = (int) $order_payment['id_order'];
     $payu->id_cart = (int) $order_payment['id_cart'];
     // if order not validated yet
     $cart_id = $payu->id_cart;
     if ($id_order == 0 && $order_payment['status'] == PayU::PAYMENT_STATUS_NEW) {
         $cart = new Cart($payu->id_cart);
         $cart_id = $cart->id;
         $payu->validateOrder($cart->id, (int) Configuration::get('PAYU_PAYMENT_STATUS_PENDING'), $cart->getOrderTotal(true, Cart::BOTH), $payu->displayName, 'PayU cart ID: ' . $cart_id . ', sessionId: ' . $payu->payu_order_id, null, (int) $cart->id_currency, false, $cart->secure_key, Context::getContext()->shop->id ? new Shop((int) Context::getContext()->shop->id) : null);
         $payu->id_order = $payu->current_order = $payu->{'currentOrder'};
         $payu->updateOrderPaymentStatusBySessionId(PayU::PAYMENT_STATUS_INIT);
     }
     $id_order = $payu->getOrderIdBySessionId($id_payu_session);
     if (!empty($id_order)) {
         $payu->id_order = $id_order;
         $payu->updateOrderData();
     }
     Tools::redirect('index.php?controller=order-confirmation&id_cart=' . $cart_id, __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently');
 }
开发者ID:bonekost,项目名称:plugin_prestashop,代码行数:29,代码来源:success.php

示例5: checkTotalToPaid

 private function checkTotalToPaid($amountPaid, $currency)
 {
     if (!$currency instanceof Currency) {
         if (Validate::isInt($currency)) {
             $currency = new Currency((int) $currency);
         } else {
             $currencyCode = $currency;
             if (!($currency = PowaTagPayment::getCurrencyByIsoCode($currency))) {
                 $currency = $currencyCode;
             }
         }
     }
     if (!PowaTagValidate::currencyEnable($currency)) {
         $this->addError(sprintf($this->module->l('Currency is not enable : %s'), isset($currency->iso_code) ? $currency->iso_code : $currency), PowaTagErrorType::$CURRENCY_NOT_SUPPORTED);
         return false;
     }
     //We change context currency to be sure that calculs are made with correct currency
     $context = Context::getContext();
     $context->currency = $currency;
     $context->country = $this->getCountry($this->datas->customer->shippingAddress->country->alpha2Code);
     $price_cart = $this->cart->getOrderTotal(true, Cart::BOTH, null, Configuration::get('POWATAG_SHIPPING'));
     if (abs($price_cart - $amountPaid) >= 0.01) {
         $msg = "Cart: " . $price_cart . " != Payment: " . $amountPaid;
         $this->addError($this->module->l('Amount paid is not same as the cart: ' . $msg), PowaTagErrorType::$INTERNAL_ERROR);
         if (PowaTagAPI::apiLog()) {
             PowaTagLogs::initAPILog('Amount paid is not same as the cart', PowaTagLogs::ERROR, $msg);
         }
         return false;
     }
     return true;
 }
开发者ID:powa,项目名称:prestashop-extension,代码行数:31,代码来源:PowaTagPayment.php

示例6: createOrder

 /**
  * @param $order_payment
  * @param $payu
  * @param $response
  * @return mixed
  */
 private function createOrder($order_payment, Payu $payu, $response)
 {
     $cart = new Cart($order_payment['id_cart']);
     $payu->validateOrder($cart->id, (int) Configuration::get('PAYU_PAYMENT_STATUS_PENDING'), $cart->getOrderTotal(true, Cart::BOTH), $payu->displayName, 'PayU cart ID: ' . $cart->id . ', orderId: ' . $payu->payu_order_id, null, (int) $cart->id_currency, false, $cart->secure_key, Context::getContext()->shop->id ? new Shop((int) Context::getContext()->shop->id) : null);
     $id_order = $payu->current_order = $payu->currentOrder;
     SimplePayuLogger::addLog('notification', __FUNCTION__, 'Status zamówienia PayU: ' . PayU::PAYMENT_STATUS_NEW, $response->order->orderId);
     $payu->updateOrderPaymentStatusBySessionId(PayU::PAYMENT_STATUS_INIT);
     return $id_order;
 }
开发者ID:bonekost,项目名称:plugin_prestashop,代码行数:15,代码来源:notification.php

示例7: initContent

 /**
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     parent::initContent();
     $id_cart = Tools::GetValue('id_cart');
     // получаем get id_cart
     $cart = new Cart((int) $id_cart);
     // Объект корзины
     $onpay = new onpay();
     //Объект onpay
     $total = $cart->getOrderTotal(true, 3);
     //Цена заказа расчёт
     $onpay->validateOrder(intval($cart->id), _PS_OS_PREPARATION_, $total, $onpay->displayName);
     //Создание заказа с статусом ожидаем оплату
     $currency = new Currency((int) $cart->id_currency);
     //получение данные о валюте
     $this->context->smarty->assign(array('login' => Configuration::get('ONPAY_LOGIN'), 'f' => Configuration::get('ONPAY_FORM'), 'id' => (int) $id_cart, 'price' => number_format($cart->getOrderTotal(true, Cart::BOTH), 1, '.', ''), 'currency' => $currency->iso_code == 'RUB' ? 'RUR' : $currency->iso_code, 'md5' => md5('fix;' . number_format($cart->getOrderTotal(true, Cart::BOTH), 1, '.', '') . ';' . ($currency->iso_code == 'RUB' ? 'RUR' : $currency->iso_code) . ';' . (int) $id_cart . ';yes;' . Configuration::get('ONPAY_API_IN_KEY')), 'url_success' => 'http://' . htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . __PS_BASE_URI__ . 'index.php?controller=history', 'this_path' => $this->_path));
     $this->setTemplate('redirect.tpl');
     // Подключение шаблона смарти
 }
开发者ID:armenium,项目名称:prestashop,代码行数:22,代码来源:redirect.php

示例8: initContent

 public function initContent()
 {
     parent::initContent();
     if (Tools::getValue('id_cart')) {
         $cart = new Cart((int) Tools::getValue('id_cart'));
         $this->context->smarty->assign(array('total' => Tools::displayPrice($cart->getOrderTotal())));
         return $this->setTemplate('confirmation.tpl');
     } else {
         return $this->setTemplate('error.tpl');
     }
 }
开发者ID:victorlr7,项目名称:pagamastarde-prestashop,代码行数:11,代码来源:confirmation.php

示例9: postProcess

 public function postProcess()
 {
     $cartId = Tools::getValue('id_cart', false);
     if (!$cartId) {
         Tools::redirect('index.php?controller=order-confirmation');
     }
     $cart = new Cart((int) $cartId);
     if (!$cart->orderExists()) {
         $this->module->validateOrder($cart->id, Configuration::get('PS_OS_CANCELED'), $cart->getOrderTotal(), $this->module->displayName, 'Order cancelled by Aplazame cancel_url', null, null, false, Tools::getValue('key', false));
     }
     $orderId = Order::getOrderByCartId($cart->id);
     Tools::redirect('index.php?controller=order-confirmation&id_cart=' . $cart->id . '&id_module=' . $this->module->id . '&id_order=' . $orderId . '&key=' . $cart->secure_key);
 }
开发者ID:aplazame,项目名称:prestashop,代码行数:13,代码来源:cancel.php

示例10: initContent

 /**
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     parent::initContent();
     $code = Tools::getValue('paymentcode');
     $cart = (int) Tools::substr($code, 0, 8);
     $this->nimblepayment_client_secret = Configuration::get('NIMBLEPAYMENT_CLIENT_SECRET');
     $cart = new Cart($cart);
     $order_num = Tools::substr($code, 0, 8);
     $total_url = $cart->getOrderTotal(true, Cart::BOTH) * 100;
     $paramurl = $order_num . md5($order_num . $this->nimblepayment_client_secret . $total_url);
     if ($paramurl == $code) {
         $total = $cart->getOrderTotal(true, Cart::BOTH);
         $extra_vars = array();
         $extra_vars['transaction_id'] = $this->context->cookie->nimble_transaction_id;
         //transaction_id in session
         $this->context->cookie->__set('nimble_transaction_id', '');
         //reset cookie
         $nimble = new nimblepayment();
         $nimble->validateOrder($cart->id, _PS_OS_PAYMENT_, $total, $nimble->displayName, null, $extra_vars, null, false, $cart->secure_key);
         $customer = new Customer($cart->id_customer);
         Tools::redirect('index.php?controller=order-confirmation&id_cart=' . $cart->id . '&id_module=' . $nimble->module->id . '&id_order=' . $nimble->module->currentOrder . '&key=' . $customer->secure_key);
     }
 }
开发者ID:joseic,项目名称:nimblepayment,代码行数:26,代码来源:paymentok.php

示例11: Cookie

 function verif_champ($post)
 {
     $return = false;
     $conf = Configuration::getMultiple(array('ATOS_MERCHAND_ID'));
     $cookie = new Cookie('ps');
     $id_cart = $cookie->id_cart;
     $cart = new Cart($id_cart);
     $id_currency = intval($cart->id_currency);
     $currency = new Currency(intval($id_currency));
     $montant = number_format(Tools::convertPrice($cart->getOrderTotal(true, 3), $currency), 2, '.', '');
     if (strpos($montant, '.')) {
         $montant = $montant * 100;
     }
     $montant = str_replace('.', '', $montant);
     if ($post['amount'] == $montant && $post['id_cart'] == $id_cart) {
         $return = true;
     }
     //return $return;
     return true;
 }
开发者ID:jichangfeng67,项目名称:eeeRo,代码行数:20,代码来源:call_request.php

示例12: postProcess

 public function postProcess()
 {
     if (Tools::isSubmit('cart_id') == false || Tools::isSubmit('secure_key') == false) {
         return false;
     }
     $cart_id = Tools::getValue('cart_id');
     $secure_key = Tools::getValue('secure_key');
     $cart = new Cart((int) $cart_id);
     $customer = new Customer((int) $cart->id_customer);
     /**
      * Since it's an example we are validating the order right here,
      * You should not do it this way in your own module.
      */
     $payment_status = Configuration::get('PS_OS_PAYMENT');
     // Default value for a payment that succeed.
     $message = null;
     // You can add a comment directly into the order so the merchant will see it in the BO.
     /**
      * Converting cart into a valid order
      */
     $module_name = $this->module->displayName;
     $currency_id = (int) Context::getContext()->currency->id;
     $this->module->validateOrder($cart_id, $payment_status, $cart->getOrderTotal(), $module_name, $message, array(), $currency_id, false, $secure_key);
     /**
      * If the order has been validated we try to retrieve it
      */
     $order_id = Order::getOrderByCartId((int) $cart->id);
     if ($order_id && $secure_key == $customer->secure_key) {
         /**
          * The order has been placed so we redirect the customer on the confirmation page.
          */
         $module_id = $this->module->id;
         Tools::redirect('index.php?controller=order-confirmation&id_cart=' . $cart_id . '&id_module=' . $module_id . '&id_order=' . $order_id . '&key=' . $secure_key);
     } else {
         /**
          * An error occured and is shown on a new page.
          */
         $this->errors[] = $this->module->l('An error occured. Please contact the merchant to have more informations');
         return $this->setTemplate('error.tpl');
     }
 }
开发者ID:evgrishin,项目名称:egyapaye,代码行数:41,代码来源:confirmation.php

示例13: postProcess

    /**
     *
     * @see FrontController::postProcess()
     */
    public function postProcess()
    {
        // Disconnect User from cart
        HipayClass::unsetCart();
        // block 3s because
        sleep(3);
        // récupération des informations en GET ou POST venant de la page de paiement
        $cart_id = Tools::getValue('orderId');
        $transac = Tools::getValue('reference');
        $context = Context::getContext();
        // --------------------------------------------------------------------------
        // vérification si les informations ne sont pas = à FALSE
        if (!$cart_id) {
            // récupération du dernier panier via son compte client
            $sql = 'SELECT `id_cart`
					FROM `' . _DB_PREFIX_ . 'cart`
					WHERE `id_customer` = ' . $context->customer->id . '
					ORDER BY date_upd DESC';
            $result = Db::getInstance()->getRow($sql);
            $cart_id = isset($result['id_cart']) ? $result['id_cart'] : false;
            if ($cart_id) {
                $objCart = new Cart((int) $cart_id);
            }
        } else {
            // load cart
            $objCart = new Cart((int) $cart_id);
        }
        // load order for id_order
        $order_id = Order::getOrderByCartId($cart_id);
        if ($order_id && !empty($order_id) && $order_id > 0) {
            // load transaction by id_order
            $sql = 'SELECT DISTINCT(op.transaction_id)
					FROM `' . _DB_PREFIX_ . 'order_payment` op
					INNER JOIN `' . _DB_PREFIX_ . 'orders` o ON o.reference = op.order_reference
					WHERE o.id_order = ' . $order_id;
            $result = Db::getInstance()->getRow($sql);
        }
        $transaction = isset($result['transaction_id']) ? $result['transaction_id'] : 0;
        $context->smarty->assign(array('id_order' => $order_id, 'total' => $objCart->getOrderTotal(true), 'transaction' => $transaction, 'currency' => $context->currency->iso_code, 'email' => $context->customer->email));
        $this->setTemplate('payment_accept.tpl');
    }
开发者ID:hipay,项目名称:hipay-fullservice-sdk-prestashop,代码行数:45,代码来源:accept.php

示例14: initContent

 public function initContent()
 {
     if (!Tools::getValue('redirect')) {
         $module_name = $this->module->displayName;
         $currency_id = (int) Context::getContext()->currency->id;
         $json = file_get_contents('php://input');
         $data = json_decode($json, true);
         /*$json = Tools::file_get_contents('php://input');
           $data = Tools::json_decode($json, true);*/
         $order_id = $data["data"]["order_id"];
         $cart_id = $order_id;
         if ($data["event"] == 'charge.created') {
             $cart = new Cart((int) $cart_id);
             $customer = new Customer((int) $cart->id_customer);
             $secure_key = $customer->secure_key;
             $payment_status = Configuration::get('PS_OS_PAYMENT');
             $message = null;
             $this->module->validateOrder($cart_id, $payment_status, $cart->getOrderTotal(), $module_name, $message, array(), $currency_id, false, $secure_key);
             Tools::redirect('index.php?controller=order-confirmation&id_cart=' . $cart->id . '&id_module=' . $this->module->id . '&id_order=' . $this->module->currentOrder . '&key=' . $secure_key);
         }
     }
 }
开发者ID:victorlr7,项目名称:pagamastarde-prestashop,代码行数:22,代码来源:validation.php

示例15: dirname

/*
Tester le header de la requette HTTP
*/
include dirname(__FILE__) . '/../../config/config.inc.php';
include dirname(__FILE__) . '/smtsps.php';
$errors = '';
$result = false;
$smt = new SmtSps();
$ref = $_GET['Reference'];
$act = $_GET['Action'];
$par = $_GET['Param'];
$temp = explode("TN-", $ref);
$id = str_replace("CMD", "", $temp[0]);
$id = intval($id) - 22002;
$cart = new Cart($id);
$Value = floatval($cart->getOrderTotal(true, 3));
$decimals = log10(abs($Value));
$decimals = -(intval(min($decimals, 0)) - 3);
$format = "%." . $decimals . "f";
$montant = sprintf($format, $Value);
switch ($act) {
    case "DETAIL":
        $tampon = "Reference=" . $ref . "&Action=" . $act . "&Reponse=" . $montant;
        break;
    case "ERREUR":
        //	$smt->validateOrder($id, _PS_OS_ERROR_, 0, $smt->displayName, $smt->l('erreur ').$act);
        $tampon = "Reference=" . $ref . "&Action=" . $act . "&Reponse=OK";
        break;
    case "ACCORD":
        $tampon = "Reference=" . $ref . "&Action=" . $act . "&Reponse=OK";
        $extra['transaction_id'] = $par;
开发者ID:nacef-labidi,项目名称:smt4presta,代码行数:31,代码来源:notification.php


注:本文中的Cart::getOrderTotal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。