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


PHP Cart::getSummaryDetails方法代码示例

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


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

示例1: confirmOrder

 public function confirmOrder($custom)
 {
     $cart = new Cart((int) $custom['id_cart']);
     $cart_details = $cart->getSummaryDetails(null, true);
     $cart_hash = sha1(serialize($cart->nbProducts()));
     $this->context->cart = $cart;
     $address = new Address((int) $cart->id_address_invoice);
     $this->context->country = new Country((int) $address->id_country);
     $this->context->customer = new Customer((int) $cart->id_customer);
     $this->context->language = new Language((int) $cart->id_lang);
     $this->context->currency = new Currency((int) $cart->id_currency);
     if (isset($cart->id_shop)) {
         $this->context->shop = new Shop($cart->id_shop);
     }
     $res = $this->getResult();
     if (strcmp($res, "VERIFIED") == 0) {
         $currency_decimals = is_array($this->context->currency) ? (int) $this->context->currency['decimals'] : (int) $this->context->currency->decimals;
         $this->decimals = $currency_decimals * _PS_PRICE_DISPLAY_PRECISION_;
         $message = null;
         $mc_gross = Tools::ps_round(Tools::getValue('mc_gross'), $this->decimals);
         $cart_details = $cart->getSummaryDetails(null, true);
         $shipping = $cart_details['total_shipping_tax_exc'];
         $subtotal = $cart_details['total_price_without_tax'] - $cart_details['total_shipping_tax_exc'];
         $tax = $cart_details['total_tax'];
         $total_price = Tools::ps_round($shipping + $subtotal + $tax, $this->decimals);
         if (bccomp($mc_gross, $total_price, 2) !== 0) {
             $payment = (int) Configuration::get('PS_OS_ERROR');
             $message = $this->l('Price paid on paypal is not the same that on PrestaShop.') . '<br />';
         } elseif ($custom['hash'] != $cart_hash) {
             $payment = (int) Configuration::get('PS_OS_ERROR');
             $message = $this->l('Cart changed, please retry.') . '<br />';
         } else {
             $payment = (int) Configuration::get('PS_OS_PAYMENT');
             $message = $this->l('Payment accepted.') . '<br />';
         }
         $customer = new Customer((int) $cart->id_customer);
         $transaction = PayPalOrder::getTransactionDetails(false);
         if (_PS_VERSION_ < '1.5') {
             $shop = null;
         } else {
             $shop_id = $this->context->shop->id;
             $shop = new Shop($shop_id);
         }
         $this->validateOrder($cart->id, $payment, $total_price, $this->displayName, $message, $transaction, $cart->id_currency, false, $customer->secure_key, $shop);
     }
 }
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:46,代码来源:notifier.php

示例2: confirmOrder

 public function confirmOrder($custom)
 {
     $cart = new Cart((int) $custom['id_cart']);
     $cart_details = $cart->getSummaryDetails(null, true);
     $cart_hash = sha1(serialize($cart->nbProducts()));
     $this->context->cart = $cart;
     $address = new Address((int) $cart->id_address_invoice);
     $this->context->country = new Country((int) $address->id_country);
     $this->context->customer = new Customer((int) $cart->id_customer);
     $this->context->language = new Language((int) $cart->id_lang);
     $this->context->currency = new Currency((int) $cart->id_currency);
     if (isset($cart->id_shop)) {
         $this->context->shop = new Shop($cart->id_shop);
     }
     $this->createLog($cart->getProducts(true));
     $mc_gross = Tools::getValue('mc_gross');
     $total_price = Tools::ps_round($cart_details['total_price'], 2);
     $message = null;
     $result = $this->verify();
     if (strcmp($result, VERIFIED) == 0) {
         if ($mc_gross != $total_price) {
             $payment = (int) Configuration::get('PS_OS_ERROR');
             $message = $this->l('Price payed on paypal is not the same that on PrestaShop.') . '<br />';
         } elseif ($custom['hash'] != $cart_hash) {
             $payment = (int) Configuration::get('PS_OS_ERROR');
             $message = $this->l('Cart changed, please retry.') . '<br />';
         } else {
             $payment = (int) Configuration::get('PS_OS_WS_PAYMENT');
             $message = $this->l('Payment accepted.') . '<br />';
         }
         $customer = new Customer((int) $cart->id_customer);
         $id_order = (int) Order::getOrderByCartId((int) $cart->id);
         $transaction = array('currency' => pSQL(Tools::getValue(CURRENCY)), 'id_invoice' => pSQL(Tools::getValue(ID_INVOICE)), 'id_transaction' => pSQL(Tools::getValue(ID_TRANSACTION)), 'payment_date' => pSQL(Tools::getValue(PAYMENT_DATE)), 'shipping' => (double) Tools::getValue(SHIPPING), 'total_paid' => (double) Tools::getValue(TOTAL_PAID));
         $this->validateOrder($cart->id, $payment, $total_price, $this->displayName, $message, $transaction, $cart->id_currency, false, $customer->secure_key);
         $history = new OrderHistory();
         $history->id_order = (int) $id_order;
         $history->changeIdOrderState((int) $payment, (int) $id_order);
         $history->addWithemail();
         $history->add();
     }
 }
开发者ID:rtajmahal,项目名称:PrestaShop-modules,代码行数:41,代码来源:notifier.php

示例3: viewcustomer


//.........这里部分代码省略.........
					<td align="center">' . $discount['id_discount'] . '</td>
					<td>' . $discount['name'] . '</td>
					<td>' . $discount['type'] . '</td>
					<td align="right">' . $discount['value'] . '</td>
					<td align="center">' . $discount['quantity_for_user'] . '</td>
					<td align="center"><img src="../img/admin/' . ($discount['active'] ? 'enabled.gif' : 'disabled.gif') . '" alt="' . $this->l('Status') . '" title="' . $this->l('Status') . '" /></td>
					<td align="center">
						<a href="?tab=AdminDiscounts&id_discount=' . $discount['id_discount'] . '&adddiscount&token=' . $tokenDiscounts . '"><img src="../img/admin/edit.gif" /></a>
						<a href="?tab=AdminDiscounts&id_discount=' . $discount['id_discount'] . '&deletediscount&token=' . $tokenDiscounts . '"><img src="../img/admin/delete.gif" /></a>
					</td>
				</tr>';
            }
            echo '
			</table>';
        } else {
            echo $customer->firstname . ' ' . $customer->lastname . ' ' . $this->l('has no discount vouchers') . '.';
        }
        echo '<div class="clear">&nbsp;</div>';
        echo '<div style="float:left">
		<h2>' . $this->l('Carts') . ' (' . sizeof($carts) . ')</h2>';
        if ($carts and sizeof($carts)) {
            echo '
			<table cellspacing="0" cellpadding="0" class="table">
				<tr>
					<th class="center">' . $this->l('ID') . '</th>
					<th class="center">' . $this->l('Date') . '</th>
					<th class="center">' . $this->l('Total') . '</th>
					<th class="center">' . $this->l('Carrier') . '</th>
					<th class="center">' . $this->l('Actions') . '</th>
				</tr>';
            $tokenCarts = Tools::getAdminToken('AdminCarts' . (int) Tab::getIdFromClassName('AdminCarts') . (int) $cookie->id_employee);
            foreach ($carts as $cart) {
                $cartI = new Cart((int) $cart['id_cart']);
                $summary = $cartI->getSummaryDetails();
                $currency = new Currency((int) $cart['id_currency']);
                $carrier = new Carrier((int) $cart['id_carrier']);
                echo '
				<tr ' . ($irow++ % 2 ? 'class="alt_row"' : '') . ' style="cursor: pointer" onclick="document.location = \'?tab=AdminCarts&id_cart=' . $cart['id_cart'] . '&viewcart&token=' . $tokenCarts . '\'">
					<td class="center">' . sprintf('%06d', $cart['id_cart']) . '</td>
					<td>' . Tools::displayDate($cart['date_add'], (int) $cookie->id_lang, true) . '</td>
					<td align="right">' . Tools::displayPrice($summary['total_price'], $currency) . '</td>
					<td>' . $carrier->name . '</td>
					<td align="center"><a href="index.php?tab=AdminCarts&id_cart=' . $cart['id_cart'] . '&viewcart&token=' . $tokenCarts . '"><img src="../img/admin/details.gif" /></a></td>
				</tr>';
            }
            echo '
			</table>';
        } else {
            echo $this->l('No cart available') . '.';
        }
        echo '</div>';
        $interested = Db::getInstance()->ExecuteS('SELECT DISTINCT id_product FROM ' . _DB_PREFIX_ . 'cart_product cp INNER JOIN ' . _DB_PREFIX_ . 'cart c on c.id_cart = cp.id_cart WHERE c.id_customer = ' . (int) $customer->id . ' AND cp.id_product NOT IN (
		SELECT product_id FROM ' . _DB_PREFIX_ . 'orders o inner join ' . _DB_PREFIX_ . 'order_detail od ON o.id_order = od.id_order WHERE o.valid = 1 AND o.id_customer = ' . (int) $customer->id . ')');
        if (count($interested)) {
            echo '<div style="float:left;margin-left:20px">
			<h2>' . $this->l('Products') . ' (' . count($interested) . ')</h2>
			<table cellspacing="0" cellpadding="0" class="table">';
            foreach ($interested as $p) {
                $product = new Product((int) $p['id_product'], false, $cookie->id_lang);
                echo '
				<tr ' . ($irow++ % 2 ? 'class="alt_row"' : '') . ' style="cursor: pointer" onclick="document.location = \'' . $link->getProductLink((int) $product->id, $product->link_rewrite, Category::getLinkRewrite($product->id_category_default, (int) $cookie->id_lang)) . '\'">
					<td>' . (int) $product->id . '</td>
					<td>' . Tools::htmlentitiesUTF8($product->name) . '</td>
					<td align="center"><a href="' . $link->getProductLink((int) $product->id, $product->link_rewrite, Category::getLinkRewrite($product->id_category_default, (int) $cookie->id_lang)) . '"><img src="../img/admin/details.gif" /></a></td>
				</tr>';
            }
开发者ID:srikanthash09,项目名称:codetestdatld,代码行数:67,代码来源:AdminCustomers.php

示例4: viewcustomer


//.........这里部分代码省略.........
					<th>' . $this->l('Type') . '</th>
					<th>' . $this->l('Value') . '</th>
					<th>' . $this->l('Qty available') . '</th>
					<th>' . $this->l('Status') . '</th>
					<th>' . $this->l('Actions') . '</th>
				</tr>';
            $tokenDiscounts = Tools::getAdminToken('AdminDiscounts' . intval(Tab::getIdFromClassName('AdminDiscounts')) . intval($cookie->id_employee));
            foreach ($discounts as $discount) {
                echo '
				<tr ' . ($irow++ % 2 ? 'class="alt_row"' : '') . '>
					<td align="center">' . $discount['id_discount'] . '</td>
					<td>' . $discount['name'] . '</td>
					<td>' . $discount['type'] . '</td>
					<td align="right">' . $discount['value'] . '</td>
					<td align="center">' . $discount['quantity_for_user'] . '</td>
					<td align="center"><img src="../img/admin/' . ($discount['active'] ? 'enabled.gif' : 'disabled.gif') . '" alt="' . $this->l('Status') . '" title="' . $this->l('Status') . '" /></td>
					<td align="center">
						<a href="?tab=AdminDiscounts&id_discount=' . $discount['id_discount'] . '&adddiscount&token=' . $tokenDiscounts . '"><img src="../img/admin/edit.gif" /></a>
						<a href="?tab=AdminDiscounts&id_discount=' . $discount['id_discount'] . '&deletediscount&token=' . $tokenDiscounts . '"><img src="../img/admin/delete.gif" /></a>
					</td>
				</tr>';
            }
            echo '
			</table>';
        } else {
            echo $customer->firstname . ' ' . $customer->lastname . ' ' . $this->l('has no discount vouchers') . '.';
        }
        echo '<div class="clear">&nbsp;</div>';
        echo '<h2>' . $this->l('Carts') . ' (' . sizeof($carts) . ')</h2>';
        if ($carts and sizeof($carts)) {
            echo '
			<table cellspacing="0" cellpadding="0" class="table">
				<tr>
					<th class="center">' . $this->l('ID') . '</th>
					<th class="center">' . $this->l('Date') . '</th>
					<th class="center">' . $this->l('Total') . '</th>
					<th class="center">' . $this->l('Carrier') . '</th>
					<th class="center">' . $this->l('Actions') . '</th>
				</tr>';
            $tokenCarts = Tools::getAdminToken('AdminCarts' . intval(Tab::getIdFromClassName('AdminCarts')) . intval($cookie->id_employee));
            foreach ($carts as $cart) {
                $cartI = new Cart(intval($cart['id_cart']));
                $summary = $cartI->getSummaryDetails();
                $currency = new Currency(intval($cart['id_currency']));
                $carrier = new Carrier(intval($cart['id_carrier']));
                echo '
				<tr ' . ($irow++ % 2 ? 'class="alt_row"' : '') . ' style="cursor: pointer" onclick="document.location = \'?tab=AdminCarts&id_cart=' . $cart['id_cart'] . '&viewcart&token=' . $tokenCarts . '\'">
					<td class="center">' . sprintf('%06d', $cart['id_cart']) . '</td>
					<td>' . Tools::displayDate($cart['date_add'], intval($cookie->id_lang), true) . '</td>
					<td align="right">' . Tools::displayPrice($summary['total_price'], $currency) . '</td>
					<td>' . $carrier->name . '</td>
					<td align="center"><a href="?tab=AdminCarts&id_cart=' . $cart['id_cart'] . '&viewcart&token=' . $tokenCarts . '"><img src="../img/admin/details.gif" /></a></td>
				</tr>';
            }
            echo '
			</table>';
        } else {
            echo $this->l('No cart available') . '.';
        }
        echo '<div class="clear">&nbsp;</div>';
        /* Last connections */
        $connections = $customer->getLastConnections();
        if (sizeof($connections)) {
            echo '<h2>' . $this->l('Last connections') . '</h2>
            <table cellspacing="0" cellpadding="0" class="table">
                <tr>
                    <th style="width: 200px">' . $this->l('Date') . '</th>
                    <th style="width: 100px">' . $this->l('Pages viewed') . '</th>
                    <th style="width: 100px">' . $this->l('Total time') . '</th>
                    <th style="width: 100px">' . $this->l('Origin') . '</th>
                    <th style="width: 100px">' . $this->l('IP Address') . '</th>
                </tr>';
            foreach ($connections as $connection) {
                echo '<tr>
                        <td>' . Tools::displayDate($connection['date_add'], intval($cookie->id_lang), true) . '</td>
                        <td>' . intval($connection['pages']) . '</td>
                        <td>' . $connection['time'] . '</td>
                        <td>' . ($connection['http_referer'] ? preg_replace('/^www./', '', parse_url($connection['http_referer'], PHP_URL_HOST)) : $this->l('Direct link')) . '</td>
                        <td>' . $connection['ipaddress'] . '</td>
                    </tr>';
            }
            echo '</table><div class="clear">&nbsp;</div>';
        }
        if (sizeof($referrers)) {
            echo '<h2>' . $this->l('Referrers') . '</h2>
            <table cellspacing="0" cellpadding="0" class="table">
                <tr>
                    <th style="width: 200px">' . $this->l('Date') . '</th>
                    <th style="width: 200px">' . $this->l('Name') . '</th>
                </tr>';
            foreach ($referrers as $referrer) {
                echo '<tr>
                        <td>' . Tools::displayDate($referrer['date_add'], intval($cookie->id_lang), true) . '</td>
                        <td>' . $referrer['name'] . '</td>
                    </tr>';
            }
            echo '</table><div class="clear">&nbsp;</div>';
        }
        echo '<a href="' . $currentIndex . '&token=' . $this->token . '"><img src="../img/admin/arrow2.gif" /> ' . $this->l('Back to customer list') . '</a><br />';
    }
开发者ID:redb,项目名称:prestashop,代码行数:101,代码来源:AdminCustomers.php

示例5: renderView

    public function renderView()
    {
        /** @var Customer $customer */
        if (!($customer = $this->loadObject())) {
            return;
        }
        $this->context->customer = $customer;
        $gender = new Gender($customer->id_gender, $this->context->language->id);
        $gender_image = $gender->getImage();
        $customer_stats = $customer->getStats();
        $sql = 'SELECT SUM(total_paid_real) FROM ' . _DB_PREFIX_ . 'orders WHERE id_customer = %d AND valid = 1';
        if ($total_customer = Db::getInstance()->getValue(sprintf($sql, $customer->id))) {
            $sql = 'SELECT SQL_CALC_FOUND_ROWS COUNT(*) FROM ' . _DB_PREFIX_ . 'orders WHERE valid = 1 AND id_customer != ' . (int) $customer->id . ' GROUP BY id_customer HAVING SUM(total_paid_real) > %d';
            Db::getInstance()->getValue(sprintf($sql, (int) $total_customer));
            $count_better_customers = (int) Db::getInstance()->getValue('SELECT FOUND_ROWS()') + 1;
        } else {
            $count_better_customers = '-';
        }
        $orders = Order::getCustomerOrders($customer->id, true);
        $total_orders = count($orders);
        for ($i = 0; $i < $total_orders; $i++) {
            $orders[$i]['total_paid_real_not_formated'] = $orders[$i]['total_paid_real'];
            $orders[$i]['total_paid_real'] = Tools::displayPrice($orders[$i]['total_paid_real'], new Currency((int) $orders[$i]['id_currency']));
        }
        $messages = CustomerThread::getCustomerMessages((int) $customer->id);
        $total_messages = count($messages);
        for ($i = 0; $i < $total_messages; $i++) {
            $messages[$i]['message'] = substr(strip_tags(html_entity_decode($messages[$i]['message'], ENT_NOQUOTES, 'UTF-8')), 0, 75);
            $messages[$i]['date_add'] = Tools::displayDate($messages[$i]['date_add'], null, true);
            if (isset(self::$meaning_status[$messages[$i]['status']])) {
                $messages[$i]['status'] = self::$meaning_status[$messages[$i]['status']];
            }
        }
        $groups = $customer->getGroups();
        $total_groups = count($groups);
        for ($i = 0; $i < $total_groups; $i++) {
            $group = new Group($groups[$i]);
            $groups[$i] = array();
            $groups[$i]['id_group'] = $group->id;
            $groups[$i]['name'] = $group->name[$this->default_form_language];
        }
        $total_ok = 0;
        $orders_ok = array();
        $orders_ko = array();
        foreach ($orders as $order) {
            if (!isset($order['order_state'])) {
                $order['order_state'] = $this->l('There is no status defined for this order.');
            }
            if ($order['valid']) {
                $orders_ok[] = $order;
                $total_ok += $order['total_paid_real_not_formated'];
            } else {
                $orders_ko[] = $order;
            }
        }
        $products = $customer->getBoughtProducts();
        $carts = Cart::getCustomerCarts($customer->id);
        $total_carts = count($carts);
        for ($i = 0; $i < $total_carts; $i++) {
            $cart = new Cart((int) $carts[$i]['id_cart']);
            $this->context->cart = $cart;
            $summary = $cart->getSummaryDetails();
            $currency = new Currency((int) $carts[$i]['id_currency']);
            $carrier = new Carrier((int) $carts[$i]['id_carrier']);
            $carts[$i]['id_cart'] = sprintf('%06d', $carts[$i]['id_cart']);
            $carts[$i]['date_add'] = Tools::displayDate($carts[$i]['date_add'], null, true);
            $carts[$i]['total_price'] = Tools::displayPrice($summary['total_price'], $currency);
            $carts[$i]['name'] = $carrier->name;
        }
        $sql = 'SELECT DISTINCT cp.id_product, c.id_cart, c.id_shop, cp.id_shop AS cp_id_shop
				FROM ' . _DB_PREFIX_ . 'cart_product cp
				JOIN ' . _DB_PREFIX_ . 'cart c ON (c.id_cart = cp.id_cart)
				JOIN ' . _DB_PREFIX_ . 'product p ON (cp.id_product = p.id_product)
				WHERE c.id_customer = ' . (int) $customer->id . '
					AND NOT EXISTS (
							SELECT 1
							FROM ' . _DB_PREFIX_ . 'orders o
							JOIN ' . _DB_PREFIX_ . 'order_detail od ON (o.id_order = od.id_order)
							WHERE product_id = cp.id_product AND o.valid = 1 AND o.id_customer = ' . (int) $customer->id . '
						)';
        $interested = Db::getInstance()->executeS($sql);
        $total_interested = count($interested);
        for ($i = 0; $i < $total_interested; $i++) {
            $product = new Product($interested[$i]['id_product'], false, $this->default_form_language, $interested[$i]['id_shop']);
            if (!Validate::isLoadedObject($product)) {
                continue;
            }
            $interested[$i]['url'] = $this->context->link->getProductLink($product->id, $product->link_rewrite, Category::getLinkRewrite($product->id_category_default, $this->default_form_language), null, null, $interested[$i]['cp_id_shop']);
            $interested[$i]['id'] = (int) $product->id;
            $interested[$i]['name'] = Tools::htmlentitiesUTF8($product->name);
        }
        $emails = $customer->getLastEmails();
        $connections = $customer->getLastConnections();
        if (!is_array($connections)) {
            $connections = array();
        }
        $total_connections = count($connections);
        for ($i = 0; $i < $total_connections; $i++) {
            $connections[$i]['http_referer'] = $connections[$i]['http_referer'] ? preg_replace('/^www./', '', parse_url($connections[$i]['http_referer'], PHP_URL_HOST)) : $this->l('Direct link');
        }
//.........这里部分代码省略.........
开发者ID:nmardones,项目名称:PrestaShop,代码行数:101,代码来源:AdminCustomersController.php

示例6: trim

$successUrl = trim(Configuration::get('GOPAY_SUCCESS_URL'));
$gwUrl = trim(Configuration::get('GOPAY_GW_URL'));
$infopageUrl = trim(Configuration::get('GOPAY_INFOPAGE_URL'));
// redirect param
$param = $_POST['param'];
// cart z parametru
$cartId = $_POST['cartId'];
$cart = new Cart($cartId);
$paymentChannels = array();
foreach ($_POST as $key) {
    if (substr($key, 0, 13) == "method_gopay_") {
        $paymentChannels[] = substr($key, 13);
    }
}
// castka predavana validateOrder
$cartSummary = $cart->getSummaryDetails();
$nonConvertedAmount = $cartSummary['total_price'];
if ($cart->OrderExists()) {
    $gpErrors = 'alreadyClosed';
    Tools::redirectLink("{$infopageUrl}?gp_errors={$gpErrors}");
}
// ziskani id ceske meny
$czk_id = Currency::getIdByIsoCode('CZK');
// overeni existence ceske meny s ISO CZK
if ($czk_id == '') {
    $gpErrors = 'czk';
    Tools::redirectLink("{$infopageUrl}?gp_errors={$gpErrors}");
} else {
    // cart v CZK
    $cart->id_currency = intval($czk_id);
    $cart->save();
开发者ID:greench,项目名称:prestashop,代码行数:31,代码来源:pay.php

示例7: hookPayment

 public function hookPayment($params)
 {
     if (!$this->active || !$this->checkCurrency($params['cart'])) {
         return;
     }
     $method = $this->useMobileMethod();
     $shop_url = PayPal::getShopDomainSsl(true, true);
     if (isset($this->context->cookie->express_checkout)) {
         // Check if user went through the payment preparation detail and completed it
         $detail = unserialize($this->context->cookie->express_checkout);
         if (!empty($detail['payer_id']) && !empty($detail['token'])) {
             $values = array('get_confirmation' => true);
             $link = $shop_url . _MODULE_DIR_ . $this->name . '/express_checkout/submit.php';
             if (_PS_VERSION_ < '1.5') {
                 Tools::redirectLink($link . '?' . http_build_query($values, '', '&'));
             } else {
                 $controller = new FrontController();
                 $controller->init();
                 Tools::redirect(Context::getContext()->link->getModuleLink('paypal', 'confirm', $values));
             }
         }
     }
     $this->context->smarty->assign(array('logos' => $this->paypal_logos->getLogos(), 'sandbox_mode' => Configuration::get('PAYPAL_SANDBOX'), 'use_mobile' => (bool) $this->context->getMobileDevice(), 'PayPal_lang_code' => isset($iso_lang[$this->context->language->iso_code]) ? $iso_lang[$this->context->language->iso_code] : 'en_US'));
     if ($method == HSS) {
         $billing_address = new Address($this->context->cart->id_address_invoice);
         $delivery_address = new Address($this->context->cart->id_address_delivery);
         $billing_address->country = new Country($billing_address->id_country);
         $delivery_address->country = new Country($delivery_address->id_country);
         $billing_address->state = new State($billing_address->id_state);
         $delivery_address->state = new State($delivery_address->id_state);
         $cart = new Cart((int) $this->context->cart->id);
         $cart_details = $cart->getSummaryDetails(null, true);
         // Backward compatibility
         if (_PS_VERSION_ < '1.5') {
             $shipping = $this->context->cart->getOrderShippingCost();
         } else {
             $shipping = $this->context->cart->getTotalShippingCost();
         }
         if ((int) Configuration::get('PAYPAL_SANDBOX') == 1) {
             $action_url = 'https://securepayments.sandbox.paypal.com/acquiringweb';
         } else {
             $action_url = 'https://securepayments.paypal.com/acquiringweb';
         }
         $this->context->smarty->assign(array('action_url' => $action_url, 'cart' => $this->context->cart, 'cart_details' => $cart_details, 'currency' => new Currency((int) $this->context->cart->id_currency), 'customer' => $this->context->customer, 'business_account' => Configuration::get('PAYPAL_BUSINESS_ACCOUNT'), 'custom' => Tools::jsonEncode(array('id_cart' => $this->context->cart->id, 'hash' => sha1(serialize($cart->nbProducts())))), 'gift_price' => (double) Configuration::get('PS_GIFT_WRAPPING_PRICE'), 'billing_address' => $billing_address, 'delivery_address' => $delivery_address, 'shipping' => $shipping, 'subtotal' => $cart_details['total_price_without_tax'] - $shipping, 'time' => time(), 'cancel_return' => $this->context->link->getPageLink('order.php'), 'notify_url' => $shop_url . _MODULE_DIR_ . $this->name . '/integral_evolution/notifier.php', 'return_url' => $shop_url . _MODULE_DIR_ . $this->name . '/integral_evolution/submit.php?id_cart=' . (int) $this->context->cart->id, 'tracking_code' => $this->getTrackingCode()));
         return $this->fetchTemplate('/views/templates/front/integral_evolution/', 'iframe');
     } elseif ($method == WPS || $method == ECS) {
         $this->getTranslations();
         $this->context->smarty->assign(array('PayPal_integral' => WPS, 'PayPal_express_checkout' => ECS, 'PayPal_payment_method' => $method, 'PayPal_payment_type' => 'payment_cart', 'PayPal_current_shop_url' => $shop_url . $_SERVER['REQUEST_URI'], 'PayPal_tracking_code' => $this->getTrackingCode()));
         return $this->fetchTemplate('/views/templates/front/express_checkout/', 'paypal');
     }
     return '';
 }
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:52,代码来源:paypal_abstract.php


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