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


PHP Order::getOrderByCartId方法代码示例

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


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

示例1: initContent

 public function initContent()
 {
     if ($id_cart = Tools::getValue('id_cart')) {
         $myCart = new Cart($id_cart);
         if (!Validate::isLoadedObject($myCart)) {
             $myCart = $this->context->cart;
         }
     } else {
         $myCart = $this->context->cart;
     }
     $total_to_pay = $myCart->getOrderTotal(true, Cart::BOTH);
     $currency_rub = new Currency(Currency::getIdByIsoCode('RUB'));
     if ($myCart->id_currency != $currency_rub->id) {
         $currency = new Currency($myCart->id_currency);
         $total_to_pay = $total_to_pay / $currency->conversion_rate * $currency_rub->conversion_rate;
     }
     $total_to_pay = number_format($total_to_pay, 2, '.', '');
     if ($postvalidate = Configuration::get('robokassa_postvalidate')) {
         $order_number = $myCart->id;
     } else {
         if (!($order_number = Order::getOrderByCartId($myCart->id))) {
             $this->module->validateOrder((int) $myCart->id, Configuration::get('PL_OS_WAITPAYMENT'), $myCart->getOrderTotal(true, Cart::BOTH), $this->module->displayName, NULL, array(), NULL, false, $myCart->secure_key);
             $order_number = $this->module->currentOrder;
         }
     }
     $customer = new Customer($myCart->id_customer);
     $signature = md5(Configuration::get('robokassa_login') . ':' . $total_to_pay . ':' . $order_number . ':' . Configuration::get('robokassa_password1'));
     $this->context->smarty->assign(array('robokassa_login' => Configuration::get('robokassa_login'), 'robokassa_demo' => Configuration::get('robokassa_demo'), 'signature' => strtoupper($signature), 'email' => $customer->email, 'postvalidate' => $postvalidate, 'order_number' => $order_number, 'total_to_pay' => $total_to_pay, 'this_path_ssl' => Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . 'modules/' . $this->name . '/'));
     return $this->setTemplate('redirect.tpl');
 }
开发者ID:WhisperingTree,项目名称:etagerca,代码行数:30,代码来源:redirect.php

示例2: initContent

 public function initContent()
 {
     parent::initContent();
     $ordernumber = Tools::getValue('InvId');
     $this->context->smarty->assign('ordernumber', $ordernumber);
     if (Configuration::get('robokassa_postvalidate')) {
         if (!$ordernumber) {
             robokassa::validateAnsver($this->module->l('Cart number is not set'));
         }
         $cart = new Cart((int) $ordernumber);
         if (!Validate::isLoadedObject($cart)) {
             robokassa::validateAnsver($this->module->l('Cart does not exist'));
         }
         if (!($ordernumber = Order::getOrderByCartId($cart->id))) {
             $this->setTemplate('waitingPayment.tpl');
         }
     }
     if (!$ordernumber) {
         robokassa::validateAnsver($this->module->l('Order number is not set'));
     }
     $order = new Order((int) $ordernumber);
     if (!Validate::isLoadedObject($order)) {
         robokassa::validateAnsver($this->module->l('Order does not exist'));
     }
     $customer = new Customer((int) $order->id_customer);
     if ($customer->id != $this->context->cookie->id_customer) {
         robokassa::validateAnsver($this->module->l('You are not logged in'));
     }
     if ($order->hasBeenPaid()) {
         Tools::redirectLink(__PS_BASE_URI__ . 'order-confirmation.php?key=' . $customer->secure_key . '&id_cart=' . (int) $order->id_cart . '&id_module=' . (int) $this->module->id . '&id_order=' . (int) $order->id);
     } else {
         $this->setTemplate('waitingPayment.tpl');
     }
 }
开发者ID:WhisperingTree,项目名称:etagerca,代码行数:34,代码来源:success.php

示例3: preProcess

 public function preProcess()
 {
     parent::preProcess();
     $this->id_cart = (int) Tools::getValue('id_cart', 0);
     /* check if the cart has been made by a Guest customer, for redirect link */
     if (Cart::isGuestCartByCartId($this->id_cart)) {
         $redirectLink = 'guest-tracking.php';
     } else {
         $redirectLink = 'history.php';
     }
     $this->id_module = (int) Tools::getValue('id_module', 0);
     $this->id_order = Order::getOrderByCartId((int) $this->id_cart);
     $this->secure_key = Tools::getValue('key', false);
     if (!$this->id_order or !$this->id_module or !$this->secure_key or empty($this->secure_key)) {
         Tools::redirect($redirectLink . (Tools::isSubmit('slowvalidation') ? '?slowvalidation' : ''));
     }
     $order = new Order((int) $this->id_order);
     if (!Validate::isLoadedObject($order) or $order->id_customer != self::$cookie->id_customer or $this->secure_key != $order->secure_key) {
         Tools::redirect($redirectLink);
     }
     $module = Module::getInstanceById((int) $this->id_module);
     if ($order->payment != $module->displayName) {
         Tools::redirect($redirectLink);
     }
 }
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:25,代码来源:OrderConfirmationController.php

示例4: init

 /**
  * Initialize order confirmation controller
  * @see FrontController::init()
  */
 public function init()
 {
     parent::init();
     $this->id_cart = (int) Tools::getValue('id_cart', 0);
     $is_guest = false;
     /* check if the cart has been made by a Guest customer, for redirect link */
     if (Cart::isGuestCartByCartId($this->id_cart)) {
         $is_guest = true;
         $redirectLink = 'index.php?controller=guest-tracking';
     } else {
         $redirectLink = 'index.php?controller=history';
     }
     $this->id_module = (int) Tools::getValue('id_module', 0);
     $this->id_order = Order::getOrderByCartId((int) $this->id_cart);
     $this->secure_key = Tools::getValue('key', false);
     $order = new Order((int) $this->id_order);
     if ($is_guest) {
         $customer = new Customer((int) $order->id_customer);
         $redirectLink .= '&id_order=' . $order->reference . '&email=' . urlencode($customer->email);
     }
     if (!$this->id_order || !$this->id_module || !$this->secure_key || empty($this->secure_key)) {
         Tools::redirect($redirectLink . (Tools::isSubmit('slowvalidation') ? '&slowvalidation' : ''));
     }
     $this->reference = $order->reference;
     if (!Validate::isLoadedObject($order) || $order->id_customer != $this->context->customer->id || $this->secure_key != $order->secure_key) {
         Tools::redirect($redirectLink);
     }
     $module = Module::getInstanceById((int) $this->id_module);
     if ($order->payment != $module->displayName) {
         Tools::redirect($redirectLink);
     }
 }
开发者ID:jicheng17,项目名称:vipinsg,代码行数:36,代码来源:OrderConfirmationController.php

示例5: updateStatus

 public function updateStatus(&$resp)
 {
     $this->log_on = Configuration::get('YA_P2P_LOGGING_ON');
     if ($resp->status == 'success') {
         $cart = $this->context->cart;
         if ($cart->id > 0) {
             if ($cart->orderExists()) {
                 $ord = new Order((int) Order::getOrderByCartId($cart->id));
                 $id_order = $ord->id;
             } else {
                 $ord = $this->module->validateOrder($cart->id, Configuration::get('PS_OS_PAYMENT'), $cart->getOrderTotal(true, Cart::BOTH), $this->module->displayName . " Банковская карта", null, array(), null, false, $cart->secure_key);
                 $id_order = $this->module->currentOrder;
             }
             if ($ord) {
                 $history = new OrderHistory();
                 $history->id_order = $id_order;
                 $history->changeIdOrderState(Configuration::get('PS_OS_PAYMENT'), $id_order);
                 $history->addWithemail(true);
             }
         }
         if ($this->log_on) {
             $this->module->logSave('payment_card: #' . $this->module->currentOrder . ' ' . $this->module->l('Order success'));
         }
         Tools::redirect($this->context->link->getPageLink('order-confirmation') . '&id_cart=' . $this->context->cart->id . '&id_module=' . $this->module->id . '&id_order=' . $this->module->currentOrder . '&key=' . $this->context->cart->secure_key);
     }
 }
开发者ID:V1dun,项目名称:yandex-money-cms-prestashop,代码行数:26,代码来源:paymentcard.php

示例6: initContent

 public function initContent()
 {
     $this->display_column_left = false;
     $this->display_column_right = false;
     parent::initContent();
     global $smarty;
     if (isset($_GET['order_id'])) {
         $cart = Cart::getCartByOrderId($_GET['order_id']);
         if ($cart == null) {
             die;
         }
     } else {
         global $cart;
     }
     $address = new Address((int) $cart->id_address_invoice);
     $customer = new Customer((int) $cart->id_customer);
     $amount = $cart->getOrderTotal(true, Cart::BOTH);
     $przelewy24 = new Przelewy24();
     $currencies = $przelewy24->getCurrency(intval($cart->id_currency));
     $currency = $currencies[0];
     if (isset($currency['decimals']) && $currency['decimals'] == '0') {
         if (Configuration::get('PS_PRICE_ROUND_MODE') != null) {
             switch (Configuration::get('PS_PRICE_ROUND_MODE')) {
                 case 0:
                     $amount = ceil($amount);
                     break;
                 case 1:
                     $amount = floor($amount);
                     break;
                 case 2:
                     $amount = round($amount);
                     break;
             }
         }
     }
     $amount = number_format($amount, 2, '.', '') * 100;
     $s_sid = md5(time());
     Db::getInstance()->Execute('INSERT INTO `' . _DB_PREFIX_ . 'przelewy24_amount` ' . '(`s_sid`,`i_id_order`,`i_amount`) ' . 'VALUES("' . $s_sid . '",' . $cart->id . ',' . $amount . ')');
     $s_lang = new Country((int) $address->id_country);
     $order = Order::getOrderByCartId($cart->id);
     if ($order == null) {
         $s_descr = '';
         $validationRequired = true;
     } else {
         $s_descr = 'Zamówienie: ' . $order;
         $validationRequired = false;
     }
     $url = 'secure.przelewy24.pl';
     if (Configuration::get('P24_TEST_MODE') == 1) {
         if (Configuration::get('P24_TEST_MODE_TRANSACTION') == 1) {
             $url = 'sandbox.przelewy24.pl';
         } else {
             $url = 'sandbox.przelewy24.pl';
             $s_descr = 'TEST_ERR102';
         }
     }
     $smarty->assign(array('productsNumber' => $cart->nbProducts(), 'ps_version' => _PS_VERSION_, 'p24_url' => $url, 'p24_session_id' => $cart->id . '|' . $s_sid, 'p24_id_sprzedawcy' => Configuration::get('P24_ID_SPRZEDAWCY'), 'p24_kwota' => $amount, 'p24_opis' => $s_descr, 'p24_klient' => $customer->firstname . ' ' . $customer->lastname, 'p24_adres' => $address->address1 . " " . $address->address2, 'p24_kod' => $address->postcode, 'p24_miasto' => $address->city, 'p24_language' => strtolower($s_lang->iso_code), 'p24_kraj' => $s_lang->iso_code, 'p24_email' => $customer->email, 'p24_metoda' => Tools::getValue('payment_method'), 'p24_return_url_ok' => $this->context->link->getModuleLink('przelewy24', 'paymentSuccessful'), 'p24_return_url_error' => $this->context->link->getModuleLink('przelewy24', 'paymentFailed'), 'p24_validationRequired' => $validationRequired));
     $this->setTemplate('paymentConfirmation.tpl');
 }
开发者ID:MacFlay,项目名称:Presta-Domowy,代码行数:59,代码来源:paymentConfirmation.php

示例7: validateOrderPay

    public function validateOrderPay($id_cart, $id_order_state, $amount_paid, $extraCosts, $payment_method = 'Unknown', $message = null, $extra_vars = array(), $currency_special = null, $dont_touch_amount = false, $secure_key = false, Shop $shop = null)
    {
        $statusPending = Configuration::get('PAYNL_WAIT');
        $statusPaid = Configuration::get('PAYNL_SUCCESS');
        // Als er nog geen order van dit cartid is, de order valideren.
        $orderId = Order::getOrderByCartId($id_cart);
        if ($orderId == false) {
            if ($id_order_state == $statusPaid) {
                if ($extraCosts != 0) {
                    $id_order_state_tmp = $statusPending;
                } else {
                    $id_order_state_tmp = $statusPaid;
                }
            } else {
                $id_order_state_tmp = $id_order_state;
            }
            $result = parent::validateOrder($id_cart, $id_order_state_tmp, $amount_paid, $payment_method, $message, $extra_vars, $currency_special, $dont_touch_amount, $secure_key, $shop);
            $orderId = $this->currentOrder;
            if ($extraCosts == 0 && $id_order_state_tmp == $statusPaid) {
                //Als er geen extra kosten zijn, en de order staat op betaald zijn we klaar
                return $result;
            }
        }
        if ($orderId && $id_order_state == $statusPaid) {
            $order = new Order($orderId);
            $shippingCost = $order->total_shipping;
            $newShippingCosts = $shippingCost + $extraCosts;
            $extraCostsExcl = round($extraCosts / (1 + 21 / 100), 2);
            if ($extraCosts != 0) {
                //als de order extra kosten heeft, moeten deze worden toegevoegd.
                $order->total_shipping = $newShippingCosts;
                $order->total_shipping_tax_excl = $order->total_shipping_tax_excl + $extraCostsExcl;
                $order->total_shipping_tax_incl = $newShippingCosts;
                $order->total_paid_tax_excl = $order->total_paid_tax_excl + $extraCostsExcl;
                $order->total_paid_tax_incl = $order->total_paid_real = $order->total_paid = $order->total_paid + $extraCosts;
            }
            $result = $order->addOrderPayment($amount_paid, $payment_method, $extra_vars['transaction_id']);
            if (number_format($order->total_paid_tax_incl, 2) !== number_format($amount_paid, 2)) {
                $id_order_state = Configuration::get('PS_OS_ERROR');
            }
            //paymentid ophalen
            $orderPayment = OrderPayment::getByOrderId($order->id);
            $history = new OrderHistory();
            $history->id_order = (int) $order->id;
            $history->changeIdOrderState((int) $id_order_state, $order, $orderPayment);
            $res = Db::getInstance()->getRow('
			SELECT `invoice_number`, `invoice_date`, `delivery_number`, `delivery_date`
			FROM `' . _DB_PREFIX_ . 'orders`
			WHERE `id_order` = ' . (int) $order->id);
            $order->invoice_date = $res['invoice_date'];
            $order->invoice_number = $res['invoice_number'];
            $order->delivery_date = $res['delivery_date'];
            $order->delivery_number = $res['delivery_number'];
            $order->update();
            $history->addWithemail();
        }
        return $result;
    }
开发者ID:paynl,项目名称:prestashop-plugin,代码行数:58,代码来源:paynl_paymentmethods.php

示例8: initContent

 public function initContent()
 {
     parent::initContent();
     $log_on = Configuration::get('YA_ORG_LOGGING_ON');
     if (Tools::getValue('label')) {
         $data = explode('_', Tools::getValue('label'));
     } else {
         $data = explode('_', Tools::getValue('customerNumber'));
     }
     if (!empty($data) && isset($data[1])) {
         $ordernumber = $data['1'];
         $this->context->smarty->assign('ordernumber', $ordernumber);
         $this->context->smarty->assign('time', date('Y-m-d H:i:s '));
         if (!$ordernumber) {
             if ($log_on) {
                 $this->module->logSave('yakassa_success: Error ' . $this->module->l('Cart number is not specified'));
             }
             $this->setTemplate('error.tpl');
         } else {
             $cart = new Cart((int) $ordernumber);
             $qty = $cart->nbProducts();
             $this->context->smarty->assign('nbProducts', $qty);
             if (!Validate::isLoadedObject($cart) || $qty < 1) {
                 if ($log_on) {
                     $this->module->logSave('yakassa_success: Error ' . $this->module->l('Shopping cart does not exist'));
                 }
                 $this->setTemplate('error.tpl');
             } else {
                 $ordernumber = (int) $cart->id;
                 if (!$ordernumber) {
                     if ($log_on) {
                         $this->module->logSave('yakassa_success: Error ' . $this->module->l('Order number is not specified'));
                     }
                     $this->setTemplate('error.tpl');
                 } else {
                     $order = new Order((int) Order::getOrderByCartId($cart->id));
                     $customer = new Customer((int) $order->id_customer);
                     if ($order->hasBeenPaid()) {
                         if ($log_on) {
                             $this->module->logSave('yakassa_success: #' . $order->id . ' ' . $this->module->l('Order paid'));
                         }
                         Tools::redirectLink(__PS_BASE_URI__ . 'order-confirmation.php?key=' . $customer->secure_key . '&id_cart=' . (int) $order->id_cart . '&id_module=' . (int) $this->module->id . '&id_order=' . (int) $order->id);
                     } else {
                         if ($log_on) {
                             $this->module->logSave('yakassa_success: #' . $order->id . ' ' . $this->module->l('Order wait payment'));
                         }
                         $this->setTemplate('waitingPayment.tpl');
                     }
                 }
             }
         }
     } else {
         if ($log_on) {
             $this->module->logSave('yakassa_success: Error ' . $this->module->l('Cart number is not specified'));
         }
         $this->setTemplate('error.tpl');
     }
 }
开发者ID:KPG1,项目名称:yandex-money-cms-prestashop,代码行数:58,代码来源:success.php

示例9: renderView

    public function renderView()
    {
        if (!($cart = $this->loadObject(true))) {
            return;
        }
        $customer = new Customer($cart->id_customer);
        $this->context->cart = $cart;
        $this->context->customer = $customer;
        $products = $cart->getProducts();
        $customized_datas = Product::getAllCustomizedDatas((int) $cart->id);
        Product::addCustomizationPrice($products, $customized_datas);
        $summary = $cart->getSummaryDetails();
        $currency = new Currency($cart->id_currency);
        /* Display order information */
        $id_order = (int) Order::getOrderByCartId($cart->id);
        $order = new Order($id_order);
        if ($order->getTaxCalculationMethod() == PS_TAX_EXC) {
            $total_products = $summary['total_products'];
            $total_discounts = $summary['total_discounts_tax_exc'];
            $total_wrapping = $summary['total_wrapping_tax_exc'];
            $total_price = $summary['total_price_without_tax'];
            $total_shipping = $summary['total_shipping_tax_exc'];
        } else {
            $total_products = $summary['total_products_wt'];
            $total_discounts = $summary['total_discounts'];
            $total_wrapping = $summary['total_wrapping'];
            $total_price = $summary['total_price'];
            $total_shipping = $summary['total_shipping'];
        }
        foreach ($products as $k => &$product) {
            if ($order->getTaxCalculationMethod() == PS_TAX_EXC) {
                $product['product_price'] = $product['price'];
                $product['product_total'] = $product['total'];
            } else {
                $product['product_price'] = $product['price_wt'];
                $product['product_total'] = $product['total_wt'];
            }
            $image = array();
            if (isset($product['id_product_attribute']) && (int) $product['id_product_attribute']) {
                $image = Db::getInstance()->getRow('SELECT id_image
																FROM ' . _DB_PREFIX_ . 'product_attribute_image
																WHERE id_product_attribute = ' . (int) $product['id_product_attribute']);
            }
            if (!isset($image['id_image'])) {
                $image = Db::getInstance()->getRow('SELECT id_image
																FROM ' . _DB_PREFIX_ . 'image
																WHERE id_product = ' . (int) $product['id_product'] . ' AND cover = 1');
            }
            $product_obj = new Product($product['id_product']);
            $product['qty_in_stock'] = StockAvailable::getQuantityAvailableByProduct($product['id_product'], isset($product['id_product_attribute']) ? $product['id_product_attribute'] : null, (int) $order->id_shop);
            $image_product = new Image($image['id_image']);
            $product['image'] = isset($image['id_image']) ? ImageManager::thumbnail(_PS_IMG_DIR_ . 'p/' . $image_product->getExistingImgPath() . '.jpg', 'product_mini_' . (int) $product['id_product'] . (isset($product['id_product_attribute']) ? '_' . (int) $product['id_product_attribute'] : '') . '.jpg', 45, 'jpg') : '--';
        }
        $this->tpl_view_vars = array('products' => $products, 'discounts' => $cart->getCartRules(), 'order' => $order, 'cart' => $cart, 'currency' => $currency, 'customer' => $customer, 'customer_stats' => $customer->getStats(), 'total_products' => $total_products, 'total_discounts' => $total_discounts, 'total_wrapping' => $total_wrapping, 'total_price' => $total_price, 'total_shipping' => $total_shipping, 'customized_datas' => $customized_datas);
        return parent::renderView();
    }
开发者ID:rrameshsat,项目名称:Prestashop,代码行数:56,代码来源:AdminCartsController.php

示例10: initContent

 public function initContent()
 {
     parent::initContent();
     if (Tools::getIsset('collection_id') && Tools::getValue('collection_id') != 'null') {
         // payment variables
         $payment_statuses = array();
         $payment_ids = array();
         $payment_types = array();
         $payment_method_ids = array();
         $card_holder_names = array();
         $four_digits_arr = array();
         $statement_descriptors = array();
         $status_details = array();
         $transaction_amounts = 0;
         $collection_ids = split(',', Tools::getValue('collection_id'));
         foreach ($collection_ids as $collection_id) {
             $mercadopago = $this->module;
             $mercadopago_sdk = $mercadopago->mercadopago;
             $result = $mercadopago_sdk->getPayment($collection_id);
             $payment_info = $result['response']['collection'];
             $id_cart = $payment_info['external_reference'];
             $cart = new Cart($id_cart);
             $payment_statuses[] = $payment_info['status'];
             $payment_ids[] = $payment_info['id'];
             $payment_types[] = $payment_info['payment_type'];
             $payment_method_ids[] = $payment_info['payment_method_id'];
             $transaction_amounts += $payment_info['transaction_amount'];
             if ($payment_info['payment_type'] == 'credit_card') {
                 $card_holder_names[] = $payment_info['cardholder']['name'];
                 $four_digits_arr[] = '**** **** **** ' . $payment_info['last_four_digits'];
                 $statement_descriptors[] = $payment_info['statement_descriptor'];
                 $status_details[] = $payment_info['status_detail'];
             }
         }
         if (Validate::isLoadedObject($cart)) {
             $order_id = Order::getOrderByCartId($cart->id);
             $order = new Order($order_id);
             $uri = __PS_BASE_URI__ . 'order-confirmation.php?id_cart=' . $order->id_cart . '&id_module=' . $mercadopago->id . '&id_order=' . $order->id . '&key=' . $order->secure_key;
             $uri .= '&payment_status=' . $payment_statuses[0];
             $uri .= '&payment_id=' . join(" / ", $payment_ids);
             $uri .= '&payment_type=' . join(" / ", $payment_types);
             $uri .= '&payment_method_id=' . join(" / ", $payment_method_ids);
             $uri .= '&amount=' . $transaction_amounts;
             if ($payment_info['payment_type'] == 'credit_card') {
                 $uri .= '&card_holder_name=' . join(" / ", $card_holder_names);
                 $uri .= '&four_digits=' . join(" / ", $four_digits_arr);
                 $uri .= '&statement_descriptor=' . $statement_descriptors[0];
                 $uri .= '&status_detail=' . $status_details[0];
             }
             Tools::redirectLink($uri);
         }
     } else {
         error_log('External reference is not set. Order placement has failed.');
     }
 }
开发者ID:GrupoGirat,项目名称:cart-prestashop,代码行数:55,代码来源:standardreturn.php

示例11: postProcess

 /**
  * @see FrontController::postProcess()
  */
 public function postProcess()
 {
     // Log requests from Privat API side in Debug mode.
     if (Configuration::get('PRIVAT24_DEBUG_MODE')) {
         $logger = new FileLogger();
         $logger->setFilename(_PS_ROOT_DIR_ . '/log/' . $this->module->name . '_' . date('Ymd_His') . '_response.log');
         $logger->logError($_POST);
     }
     $payment = array();
     parse_str(Tools::getValue('payment'), $payment);
     $hash = sha1(md5(Tools::getValue('payment') . $this->module->merchant_password));
     if ($payment && $hash === Tools::getValue('signature')) {
         if ($payment['state'] == 'ok') {
             $state = Configuration::get('PRIVAT24_WAITINGPAYMENT_OS');
             $cart_id = (int) $payment['order'];
             $order = new Order(Order::getOrderByCartId($cart_id));
             if (!Validate::isLoadedObject($order)) {
                 PrestaShopLogger::addLog('Privat24: cannot get order by cart id ' . $cart_id, 3);
                 die;
             }
             if ($order->getCurrentState() != $state) {
                 PrestaShopLogger::addLog(sprintf('Privat24: order id %s current state %s !== expected state %s', $order->id, $order->getCurrentState(), $state), 3);
                 die;
             }
             // Check paid currency and paid amount.
             $id_currency = Currency::getIdByIsoCode($payment['ccy']);
             if (!$id_currency) {
                 PrestaShopLogger::addLog(sprintf('Privat24: order id %s cannot get currency id by iso code: %s', $order->id, $payment['ccy']), 3);
                 die;
             }
             if ($order->id_currency != $id_currency) {
                 PrestaShopLogger::addLog(sprintf('Privat 24: order id %s, order currency id %s does not match with %s', $order->id, $order->id_currency, $id_currency), 3);
                 die;
             }
             if ((double) $order->total_paid != (double) $payment['amt']) {
                 PrestaShopLogger::addLog(sprintf('Privat 24: order id %s order total paid %s does not match %s', $order->id, $order->total_paid, $payment['amt']), 3);
                 die;
             }
             $order_history = new OrderHistory();
             $order_history->id_order = $order->id;
             $order_history->changeIdOrderState(_PS_OS_PAYMENT_, $order->id);
             $order_history->addWithemail();
             $this->setPaymentTransaction($order, $payment);
             $this->module->paymentNotify($order, $payment);
             PrestaShopLogger::addLog(sprintf('Privat24 payment accepted: order id: %s, amount: %s, ref: %s', $order->id, $payment['amt'], $payment['ref']), 1);
         } else {
             PrestaShopLogger::addLog(sprintf('Privat24 payment failed: state: %s, order: %s, ref: %s', $payment['state'], $payment['order'], $payment['ref']), 3, null, null, null, true);
         }
     } else {
         PrestaShopLogger::addLog('Privat24: Payment callback bad signature.', 3, null, null, null, true);
     }
     die;
 }
开发者ID:skoro,项目名称:prestashop-privat24,代码行数:56,代码来源:validation.php

示例12: initContent

 public function initContent()
 {
     parent::initContent();
     // Init smarty content and set template to display
     $order = new Order(Order::getOrderByCartId(Tools::getValue('id_cart')));
     if ($order->id_customer == Tools::getValue('id_customer')) {
         $this->context->smarty->assign(array('order' => $order, 'state' => new OrderState($order->current_state, $this->context->language->id)));
         $this->setTemplate('confirmation.tpl');
     } else {
         $this->setTemplate('error.tpl');
     }
 }
开发者ID:powa,项目名称:prestashop-extension,代码行数:12,代码来源:confirmation.php

示例13: initContent

 /**
  * Preparing hidden form with payment data before sending it to Dotpay
  */
 public function initContent()
 {
     parent::initContent();
     $this->display_column_left = false;
     $this->display_header = false;
     $this->display_footer = false;
     $cartId = 0;
     if (Tools::getValue('order_id') == false) {
         $cartId = $this->context->cart->id;
         $exAmount = $this->api->getExtrachargeAmount(true);
         if ($exAmount > 0 && !$this->isExVPinCart()) {
             $productId = $this->config->getDotpayExchVPid();
             if ($productId != 0) {
                 $product = new Product($productId, true);
                 $product->price = $exAmount;
                 $product->save();
                 $product->flushPriceCache();
                 $this->context->cart->updateQty(1, $product->id);
                 $this->context->cart->update();
                 $this->context->cart->getPackageList(true);
             }
         }
         $discAmount = $this->api->getDiscountAmount();
         if ($discAmount > 0) {
             $discount = new CartRule($this->config->getDotpayDiscountId());
             $discount->reduction_amount = $this->api->getDiscountAmount();
             $discount->reduction_currency = $this->context->cart->id_currency;
             $discount->reduction_tax = 1;
             $discount->update();
             $this->context->cart->addCartRule($discount->id);
             $this->context->cart->update();
             $this->context->cart->getPackageList(true);
         }
         $result = $this->module->validateOrder($this->context->cart->id, (int) $this->config->getDotpayNewStatusId(), $this->getDotAmount(), $this->module->displayName, NULL, array(), NULL, false, $this->customer->secure_key);
     } else {
         $this->context->cart = Cart::getCartByOrderId(Tools::getValue('order_id'));
         $this->initPersonalData();
         $cartId = $this->context->cart->id;
     }
     $this->api->onPrepareAction(Tools::getValue('dotpay_type'), array('order' => Order::getOrderByCartId($cartId), 'customer' => $this->context->customer->id));
     $sa = new DotpaySellerApi($this->config->getDotpaySellerApiUrl());
     if ($this->config->isDotpayDispInstruction() && $this->config->isApiConfigOk() && $this->api->isChannelInGroup(Tools::getValue('channel'), array(DotpayApi::cashGroup, DotpayApi::transfersGroup)) && $sa->isAccountRight($this->config->getDotpayApiUsername(), $this->config->getDotpayApiPassword(), $this->config->getDotpayApiVersion())) {
         $this->context->cookie->dotpay_channel = Tools::getValue('channel');
         Tools::redirect($this->context->link->getModuleLink($this->module->name, 'confirm', array('order_id' => Order::getOrderByCartId($cartId))));
         die;
     }
     $this->context->smarty->assign(array('hiddenForm' => $this->api->getHiddenForm()));
     $cookie = new Cookie('lastOrder');
     $cookie->orderId = Order::getOrderByCartId($cartId);
     $cookie->write();
     $this->setTemplate("preparing.tpl");
 }
开发者ID:dotpay,项目名称:dotpay,代码行数:55,代码来源:preparing.php

示例14: 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

示例15: getCartOrder

function getCartOrder()
{
    global $cart;
    $id_order = Order::getOrderByCartId((int) $cart->id);
    if (!$id_order) {
        return false;
    }
    $cartOrder = new Order((int) $id_order);
    if (!Validate::isLoadedObject($cartOrder)) {
        return false;
    }
    return $cartOrder;
}
开发者ID:madeny,项目名称:cartapi-plugin-prestashop,代码行数:13,代码来源:success.php


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