本文整理汇总了PHP中order_total::collect_posts方法的典型用法代码示例。如果您正苦于以下问题:PHP order_total::collect_posts方法的具体用法?PHP order_total::collect_posts怎么用?PHP order_total::collect_posts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类order_total
的用法示例。
在下文中一共展示了order_total::collect_posts方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getZenTotals
/**
* Get zen-cart order totals.
*
* @param ShoppingCart $shoppingCart The current shopping cart.
* @return array zencart order totals.
*/
protected function getZenTotals(ShoppingCart $shoppingCart)
{
global $order, $shipping_modules;
// save
$otmp = $order;
$smtmp = $shipping_modules;
$order = new \order();
if (!isset($shipping_modules)) {
$ssm = array();
if (null != ($shippingMethod = $shoppingCart->getSelectedShippingMethod())) {
$ssm = array('id' => $shippingMethod->getShippingId(), 'title' => $shippingMethod->getName(), 'cost' => $shippingMethod->getCost());
}
$shipping_modules = new \shipping($ssm);
}
$zenTotals = new \order_total();
$zenTotals->collect_posts();
$zenTotals->pre_confirmation_check();
$zenTotals->process();
// restore
$order = $otmp;
$shipping_modules = $smtmp;
return $zenTotals;
}
示例2: order
$_SESSION['shipping'] = $shipping_modules->cheapest();
}
if ($kein_versand == 1) {
$_SESSION['shipping'] = false;
}
$order = new order();
// load all enabled payment modules
require DIR_WS_CLASSES . 'payment.php';
$payment_modules = new payment($_SESSION['payment']);
$payment_modules->update_status();
require DIR_WS_CLASSES . 'order_total.php';
// GV Code ICW ADDED FOR CREDIT CLASS SYSTEM
$order_total_modules = new order_total();
$order_total_modules->process();
// GV Code Start
$order_total_modules->collect_posts();
$order_total_modules->pre_confirmation_check();
// GV Code End
if (is_array($payment_modules->modules)) {
$payment_modules->pre_confirmation_check();
}
$breadcrumb->add(NAVBAR_TITLE_PAYPAL_CHECKOUT, xtc_href_link(FILENAME_PAYPAL_CHECKOUT, '', 'SSL'));
require DIR_WS_INCLUDES . 'header.php';
if (SHOW_IP_LOG == 'true') {
$smarty->assign('IP_LOG', 'true');
if ($_SERVER['HTTP_X_FORWARDED_FOR']) {
$customers_ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$customers_ip = $_SERVER['REMOTE_ADDR'];
}
$smarty->assign('CUSTOMERS_IP', $customers_ip);
示例3: payment
$oPaymentModules = new payment($_SESSION['payment']);
require 'includes/classes/class_order_total.php';
require 'includes/classes/class_order.php';
$oOrder = new order;
if ( (isset($_SESSION['shipping'])) && ($_SESSION['shipping']['id'] == 'free_free')) {
if ( ($oOrder->info['total'] - $oOrder->info['shipping_cost']) < MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER ) {
MyOOS_CoreApi::redirect(oos_href_link($aPages['checkout_shipping'], '', 'SSL'));
}
}
$oPaymentModules->update_status();
$oOrderTotalModules = new order_total;
$oOrderTotalModules->collect_posts();
if (isset($_SESSION['cot_gv'])) {
$credit_covers = $oOrderTotalModules->pre_confirmation_check();
}
if ( (is_array($oPaymentModules->modules)) && (count($oPaymentModules->modules) > 1) && (!is_object($$_SESSION['payment'])) && (!$credit_covers) ) {
$_SESSION['error_message'] = $aLang['error_no_payment_module_selected'];
MyOOS_CoreApi::redirect(oos_href_link($aPages['checkout_payment'], '', 'SSL'));
}
if (is_array($oPaymentModules->modules)) {
$oPaymentModules->pre_confirmation_check();
}
示例4: prepareConfirmation
public function prepareConfirmation()
{
global $messageStack, $template, $breadcrumb, $template_dir_select, $template_dir, $language_page_directory, $currencies, $order, $zco_notifier, $db, $current_page_base, $order_total_modules, $credit_covers;
// error_reporting(E_ALL);
// ini_set('display_errors', 'on');
$_GET['main_page'] = $current_page_base = $current_page = FILENAME_CHECKOUT_CONFIRMATION;
if ($_SESSION['cart']->count_contents() <= 0) {
zen_redirect(zen_href_link(FILENAME_TIME_OUT));
}
if (!$_SESSION['customer_id']) {
$_SESSION['navigation']->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_PAYMENT));
zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
} else {
// validate customer
if (zen_get_customer_validate_session($_SESSION['customer_id']) == false) {
$_SESSION['navigation']->set_snapshot();
zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
}
}
// avoid hack attempts during the checkout procedure by checking the internal cartID
if (isset($_SESSION['cart']->cartID) && $_SESSION['cartID']) {
if ($_SESSION['cart']->cartID != $_SESSION['cartID']) {
zen_redirect(zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
}
}
// if no shipping method has been selected, redirect the customer to the shipping method selection page
if (!isset($_SESSION['shipping'])) {
zen_redirect(zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
}
if (isset($_SESSION['shipping']['id']) && $_SESSION['shipping']['id'] == 'free_free' && $_SESSION['cart']->get_content_type() != 'virtual' && defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true' && defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER') && $_SESSION['cart']->show_total() < MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) {
zen_redirect(zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
}
if (isset($_POST['payment'])) {
$_SESSION['payment'] = $_POST['payment'];
}
$_SESSION['comments'] = $_POST['comments'];
if (DISPLAY_CONDITIONS_ON_CHECKOUT == 'true') {
if (!isset($_POST['conditions']) || $_POST['conditions'] != '1') {
$messageStack->add_session('checkout_payment', ERROR_CONDITIONS_NOT_ACCEPTED, 'error');
}
}
// echo $messageStack->size('checkout_payment');
// load the selected payment module
require DIR_WS_CLASSES . 'payment.php';
$payment_modules = new payment($_POST['payment']);
$payment_modules->update_status();
if (($_POST['payment'] == '' || !is_object($payment_modules->paymentClass)) && $credit_covers === FALSE) {
$messageStack->add_session('checkout_payment', ERROR_NO_PAYMENT_MODULE_SELECTED, 'error');
}
$GLOBALS[$_POST['payment']] = $payment_modules->paymentClass;
require DIR_WS_CLASSES . 'order.php';
$order = new order();
// load the selected shipping module
require DIR_WS_CLASSES . 'shipping.php';
$shipping_modules = new shipping($_SESSION['shipping']);
require DIR_WS_CLASSES . 'order_total.php';
$order_total_modules = new order_total();
$order_total_modules->collect_posts();
$order_total_modules->pre_confirmation_check();
if (!isset($credit_covers)) {
$credit_covers = FALSE;
}
// echo 'credit covers'.$credit_covers;
if ($credit_covers) {
unset($_SESSION['payment']);
$_SESSION['payment'] = '';
}
// @debug echo ($credit_covers == true) ? 'TRUE' : 'FALSE';
if (is_array($payment_modules->modules)) {
$payment_modules->pre_confirmation_check();
}
if ($messageStack->size('checkout_payment') > 0) {
zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
}
// Stock Check
$flagAnyOutOfStock = false;
$stock_check = array();
if (STOCK_CHECK == 'true') {
for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
if ($stock_check[$i] = zen_check_stock($order->products[$i]['id'], $order->products[$i]['qty'])) {
$flagAnyOutOfStock = true;
}
}
// Out of Stock
if (STOCK_ALLOW_CHECKOUT != 'true' && $flagAnyOutOfStock == true) {
zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
}
}
// update customers_referral with $_SESSION['gv_id']
if ($_SESSION['cc_id']) {
$discount_coupon_query = "SELECT coupon_code\n FROM " . TABLE_COUPONS . "\n WHERE coupon_id = :couponID";
$discount_coupon_query = $db->bindVars($discount_coupon_query, ':couponID', $_SESSION['cc_id'], 'integer');
$discount_coupon = $db->Execute($discount_coupon_query);
$customers_referral_query = "SELECT customers_referral\n FROM " . TABLE_CUSTOMERS . "\n WHERE customers_id = :customersID";
$customers_referral_query = $db->bindVars($customers_referral_query, ':customersID', $_SESSION['customer_id'], 'integer');
$customers_referral = $db->Execute($customers_referral_query);
// only use discount coupon if set by coupon
if ($customers_referral->fields['customers_referral'] == '' and CUSTOMERS_REFERRAL_STATUS == 1) {
$sql = "UPDATE " . TABLE_CUSTOMERS . "\n SET customers_referral = :customersReferral\n WHERE customers_id = :customersID";
$sql = $db->bindVars($sql, ':customersID', $_SESSION['customer_id'], 'integer');
//.........这里部分代码省略.........
示例5: assertInfo
/**
* Assert info.
*
* @param boolean withTotals Flag to include/apply totals or not.
*/
private function assertInfo($withTotals)
{
global $order;
$order = new \order();
if ($withTotals) {
if (!isset($shipping_modules)) {
$shipping_modules = new \shipping($_SESSION['shipping']);
}
$order_total_modules = new \order_total();
$order_total_modules->collect_posts();
$order_total_modules->pre_confirmation_check();
$order_total_modules->process();
}
foreach ($order->info as $key => $value) {
if (in_array($key, array('rowClass', 'ip_address'))) {
continue;
}
if (array_key_exists($key, $this->info)) {
if ('tax_groups' == $key) {
// drop [0] as that is the default for none in zc
if (isset($value[0])) {
unset($value[0]);
}
$mytg = $this->info[$key];
if (count($value) != count($mytg)) {
echo 'info(' . ($withTotals ? 'with' : 'without') . ' ot): tax groups length diff! order: ';
var_dump($value);
echo 'ZM got: ';
var_dump($mytg);
echo '<br>';
}
continue;
}
if (in_array($key, array('total', 'subtotal', 'tax'))) {
$value = round($value, 3);
$this->info[$key] = round($this->info[$key], 3);
}
if ((string) $value != (string) $this->info[$key]) {
echo 'info(' . ($withTotals ? 'with' : 'without') . ' ot): value mismatch for ' . $key . ': value=';
var_dump($value);
echo ', ZM got: ';
var_dump($this->info[$key]);
echo "<BR>";
}
} else {
echo 'info(' . ($withTotals ? 'with' : 'without') . ' ot): missing key: ' . $key . ', value is: ' . $value . "<BR>";
}
}
echo '<br>';
}