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


PHP order::create_add_products方法代码示例

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


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

示例1: unset

        unset($_SESSION['alipay_forcard_success_order_id']);
        if (isset($_SESSION['alipay_forcard_pending_order_id'])) {
            unset($_SESSION['alipay_forcard_pending_order_id']);
        }
        $order->send_order_email($insert_id, 2);
    } else {
        zen_redirect(zen_href_link(FILENAME_DEFAULT));
    }
} else {
    // create the order record
    $insert_id = $order->create($order_totals, 2);
    $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_AFTER_ORDER_CREATE');
    $payment_modules->after_order_create($insert_id);
    $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_AFTER_PAYMENT_MODULES_AFTER_ORDER_CREATE');
    // store the product info to the order
    $order->create_add_products($insert_id);
    $_SESSION['order_number_created'] = $insert_id;
    $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_AFTER_ORDER_CREATE_ADD_PRODUCTS');
    //send email notifications
    $order->send_order_email($insert_id, 2);
}
$zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_AFTER_SEND_ORDER_EMAIL');
// clear slamming protection since payment was accepted
if (isset($_SESSION['payment_attempt'])) {
    unset($_SESSION['payment_attempt']);
}
/**
 * Calculate order amount for display purposes on checkout-success page as well as adword campaigns etc
 * Takes the product subtotal and subtracts all credits from it
 */
$ototal = $order_subtotal = $credits_applied = 0;
开发者ID:mahuidong,项目名称:doc,代码行数:31,代码来源:checkout_process.php

示例2: mail

if (eregi("VERIFIED", $info) && $_POST['txn_type'] == 'web_accept' && $_POST['business'] == MODULE_PAYMENT_PAYPAL_BUSINESS_ID) {
    if (MODULE_PAYMENT_PAYPAL_IPN_DEBUG == 'Yes') {
        mail(STORE_OWNER_EMAIL_ADDRESS, 'IPN DEBUG MESSAGE', 'Order Verified ' . $new_order_id);
    }
    // do success stuff here
    // Things to do
    // create paypal database entry
    $paypal_order = array(zen_order_id => $new_order_id, txn_type => $_POST['txn_type'], reason_code => $_POST['reason_code'], payment_type => $_POST['payment_type'], payment_status => $_POST['payment_status'], pending_reason => $_POST['pending_reason'], invoice => $_POST['invoice'], mc_currency => $_POST['mc_currency'], first_name => $_POST['first_name'], last_name => $_POST['last_name'], payer_business_name => $_POST['payer_business_name'], address_name => $_POST['address_name'], address_street => $_POST['addrss_street'], address_city => $_POST['address_city'], address_state => $_POST['address_state'], address_zip => $_POST['address_zip'], address_country => $_POST['address_country'], address_status => $_POST['address_status'], payer_email => $_POST['payer_email'], payer_id => $_POST['payer_id'], payer_status => $_POST['payer_status'], payment_date => $_POST['payment_date'], business => $_POST['business'], receiver_email => $_POST['receiver_email'], receiver_id => $_POST['receiver_id'], txn_id => $_POST['txn_id'], parent_txn_id => $_POST['parent_txn_id'], num_cart_items => $_POST['num_cart_items'], mc_gross => $_POST['mc_gross'], mc_fee => $_POST['mc_fee'], settle_amount => $_POST['settle_amount'], settle_currency => $_POST['settle_currency'], exchange_rate => $_POST['exchange_rate'], notify_version => $_POST['notify_version'], verify_sign => $_POST['verify_sign'], last_modified => $_POST['last_modified'], date_added => $_POST['date_added'], memo => $_POST['memo']);
    if (MODULE_PAYMENT_PAYPAL_IPN_DEBUG == 'Yes') {
        mail(STORE_OWNER_EMAIL_ADDRESS, 'IPN DEBUG MESSAGE', '10. Created Order Array');
    }
    $gBitDb->associateInsert(TABLE_PAYPAL, $paypal_order);
    if (MODULE_PAYMENT_PAYPAL_IPN_DEBUG == 'Yes') {
        mail(STORE_OWNER_EMAIL_ADDRESS, 'IPN DEBUG MESSAGE', '11. Got past Create DB Array');
    }
    if (isset($_SESSION['customer_id'])) {
        $order->create_add_products($new_order_id, 2);
        if (MODULE_PAYMENT_PAYPAL_IPN_DEBUG == 'Yes') {
            mail(STORE_OWNER_EMAIL_ADDRESS, 'IPN DEBUG MESSAGE', '12. Finalised Order');
        }
        $order->send_order_email($new_order_id, 2);
        $gBitCustomer->mCart->reset(true);
    }
    if (MODULE_PAYMENT_PAYPAL_IPN_DEBUG == 'Yes') {
        mail(STORE_OWNER_EMAIL_ADDRESS, 'IPN DEBUG MESSAGE', '13. Sent Email');
    }
} else {
    if (MODULE_PAYMENT_PAYPAL_IPN_DEBUG == 'Yes') {
        mail(STORE_OWNER_EMAIL_ADDRESS, 'IPN DEBUG MESSAGE', '14. Catastrophic Failure' . '#' . $_POST['business'] . '#' . MODULE_PAYMENT_PAYPAL_BUSINESS_ID . '#' . $_POST['txn_type'] . '#' . $info);
    }
}
开发者ID:bitweaver,项目名称:commerce,代码行数:31,代码来源:ipn_main_handler.php

示例3: copyOrder

 /**
  * Copy order.
  *
  * @param int orderId The order to copy.
  * @param ZenMagick\Base\ZMObject The new order.
  */
 public static function copyOrder($orderId)
 {
     $tables = array('orders', 'orders_products', 'orders_products_attributes', 'orders_total');
     $orderData = array();
     foreach ($tables as $table) {
         $sql = "SELECT * from %table." . $table . "% WHERE orders_id = :orderId";
         $orderData[$table] = ZMRuntime::getDatabase()->fetchAll($sql, array('orderId' => $orderId), $table, 'ZenMagick\\Base\\ZMObject');
     }
     $orderData['orders'][0]->setOrderDate(new \DateTime());
     $orderData['orders'][0]->setOrderStatusId(2);
     $newOrder = ZMRuntime::getDatabase()->createModel('orders', $orderData['orders'][0]);
     // do products by using zen-cart's order class to include all stock taking, etc
     // some requirements first..
     global $order_total_modules;
     $order_total_modules = new order_total();
     // load existing order
     $zcOrder = new order($orderId);
     // create new order products for the new order id
     $zcOrder->create_add_products($newOrder->getOrderId());
     /*
     // products
     foreach ($orderData['orders_products'] as $orderItem) {
         $orderItem->setOrderId($newOrder->getOrderId());
         $orderProductId = $orderItem->getOrderProductId();
     
         // find attributes using old order product id
         $attributes = array();
         foreach ($orderData['orders_products_attributes'] as $attribute) {
             if ($attribute->getOrderProductId() == $orderProductId) {
                 $attributes[] = $attribute;
             }
         }
     
         // create new product
         $orderItem = ZMRuntime::getDatabase()->createModel('orders_products', $orderItem);
     
         foreach ($attributes as $attribute) {
             $attribute->setOrderId($newOrder->getOrderId());
             $attribute->setOrderProductId($orderItem->getOrderProductId());
             ZMRuntime::getDatabase()->createModel('orders_products_attributes', $attribute);
         }
     }
     */
     foreach ($orderData['orders_total'] as $orderTotal) {
         $orderTotal->setOrderId($newOrder->getOrderId());
         ZMRuntime::getDatabase()->createModel('orders_total', $orderTotal);
     }
     return $newOrder;
 }
开发者ID:zenmagick,项目名称:zenmagick,代码行数:55,代码来源:UpdateSubscriptionsCronJob.php

示例4: amazon_process_order


//.........这里部分代码省略.........
                            //							{$itemTax->getCurrencyCode()}
                            $order->contents[$productsKey]['tax'] = $itemTax->getAmount();
                        }
                        if ($shippingPrice = $azi->getShippingPrice()) {
                            //							{$itemTax->getCurrencyCode()}
                            $order->info['shipping_cost'] = $shippingPrice->getAmount();
                        }
                        if (empty($attrString)) {
                            $attrString = $gCommerceSystem->getConfig('MODULE_PAYMENT_AMAZONMWS_DEFAULT_ATTRIBUTES');
                        }
                        // stock up the attributes
                        if ($attrString && ($attrs = explode(',', $attrString))) {
                            foreach ($attrs as $optionValueId) {
                                $optionId = $order->mDb->getOne("SELECT cpa.`products_options_id` FROM " . TABLE_PRODUCTS_ATTRIBUTES . " cpa WHERE cpa.`products_options_values_id`=?", array($optionValueId));
                                $order->contents[$productsKey]['attributes'][$optionId . '_' . $optionValueId] = $optionValueId;
                            }
                        }
                        if (!empty($order->contents[$productsKey]['attributes'])) {
                            $attributes = $order->contents[$productsKey]['attributes'];
                            $order->contents[$productsKey]['attributes'] = array();
                            $subindex = 0;
                            foreach ($attributes as $option => $value) {
                                $optionValues = zen_get_option_value(zen_get_options_id($option), (int) $value);
                                // Determine if attribute is a text attribute and change products array if it is.
                                if ($value == PRODUCTS_OPTIONS_VALUES_TEXT_ID) {
                                    $attr_value = $order->contents[$productsKey]['attributes_values'][$option];
                                } else {
                                    $attr_value = $optionValues['products_options_values_name'];
                                }
                                $order->contents[$productsKey]['attributes'][$subindex] = array('option' => $optionValues['products_options_name'], 'value' => $attr_value, 'option_id' => $option, 'value_id' => $value, 'prefix' => $optionValues['price_prefix'], 'price' => $optionValues['options_values_price']);
                                $subindex++;
                            }
                        }
                        $shown_price = zen_add_tax($order->contents[$productsKey]['final_price'], $order->contents[$productsKey]['tax']) * $order->contents[$productsKey]['products_quantity'] + zen_add_tax($order->contents[$productsKey]['onetime_charges'], $order->contents[$productsKey]['tax']);
                        $order->subtotal += $shown_price;
                        $products_tax = $order->contents[$productsKey]['tax'];
                        $products_tax_description = $order->contents[$productsKey]['tax_description'];
                        if (DISPLAY_PRICE_WITH_TAX == 'true') {
                            $order->info['tax'] += $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
                            if (isset($order->info['tax_groups']["{$products_tax_description}"])) {
                                $order->info['tax_groups']["{$products_tax_description}"] += $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
                            } else {
                                $order->info['tax_groups']["{$products_tax_description}"] = $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
                            }
                        } else {
                            $order->info['tax'] += $products_tax / 100 * $shown_price;
                            if (isset($order->info['tax_groups']["{$products_tax_description}"])) {
                                $order->info['tax_groups']["{$products_tax_description}"] += $products_tax / 100 * $shown_price;
                            } else {
                                $order->info['tax_groups']["{$products_tax_description}"] = $products_tax / 100 * $shown_price;
                            }
                        }
                        $order->info['tax'] = zen_round($order->info['tax'], 2);
                        if ($azi->isSetShippingPrice()) {
                            $shippingPrice = $azi->getShippingPrice();
                            $shipping['cost'] += $shippingPrice->getAmount();
                        }
                    }
                    foreach (array('cc_type', 'cc_owner', 'cc_number', 'cc_expires', 'coupon_code') as $key) {
                        $order->info[$key] = NULL;
                    }
                    $order->info['shipping_method'] = $shipping['title'];
                    $order->info['shipping_method_code'] = $shipping['code'];
                    $order->info['shipping_module_code'] = $shipping['id'];
                    $order->info['payment_module_code'] = 'amazonmws';
                    $order->info['payment_method'] = 'Amazon Order';
                    $_SESSION['sendto'] = NULL;
                    $_SESSION['shipping'] = $shipping;
                    unset($_SESSION['cot_gv']);
                    require_once DIR_FS_CLASSES . 'order_total.php';
                    global $order_total_modules;
                    $order_total_modules = new order_total();
                    $order_totals = $order_total_modules->pre_confirmation_check();
                    require_once DIR_WS_MODULES . 'payment/amazonmws.php';
                    $amazon = new amazonmws($azOrder->getAmazonOrderId());
                    $amazonOutput = $amazon->process();
                    $order_totals = $order_total_modules->process();
                    array_splice($order_totals, count($order_totals) - 1, 0, array($amazonOutput));
                    if ($ordersId = $order->create($order_totals, 2)) {
                        $order->create_add_products($ordersId);
                        $ret = $ordersId;
                        $order->updateStatus(array('status' => MODULE_PAYMENT_AMAZONMWS_INITIAL_ORDER_STATUS_ID));
                    }
                }
                chdir($oldCwd);
            }
        }
    } catch (MarketplaceWebServiceOrders_Exception $ex) {
        echo "Caught Exception: " . $ex->getMessage() . "\n";
        echo "Response Status Code: " . $ex->getStatusCode() . "\n";
        echo "Error Code: " . $ex->getErrorCode() . "\n";
        echo "Error Type: " . $ex->getErrorType() . "\n";
        echo "Request ID: " . $ex->getRequestId() . "\n";
        echo "XML: " . $ex->getXML() . "\n";
    }
    $gBitUser = $holdUser;
    $gBitCustomer = new CommerceCustomer($gBitUser->mUserId);
    $_SESSION['customer_id'] = $gBitUser->mUserId;
    return $ret;
}
开发者ID:bitweaver,项目名称:commerce,代码行数:101,代码来源:amazonmws_setup_inc.php


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