本文整理汇总了PHP中Cart66Common::getOrderStatusOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP Cart66Common::getOrderStatusOptions方法的具体用法?PHP Cart66Common::getOrderStatusOptions怎么用?PHP Cart66Common::getOrderStatusOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cart66Common
的用法示例。
在下文中一共展示了Cart66Common::getOrderStatusOptions方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_class
}
// Look for sendy opt-in
if (CART66_PRO) {
include CART66_PATH . "/pro/Cart66SendyOptIn.php";
}
$gatewayName = get_class($gateway);
$gateway->initCheckout($oneTimeTotal);
if ($oneTimeTotal > 0 || $gatewayName == 'Cart66ManualGateway') {
$transactionId = $gateway->doSale();
} else {
// Do not attempt to charge $0.00 transactions to live gateways
$transactionId = $transId = 'MT-' . Cart66Common::getRandString();
}
if ($transactionId) {
// Set order status based on Cart66 settings
$statusOptions = Cart66Common::getOrderStatusOptions();
$status = $statusOptions[0];
// Check for account creation
$accountId = 0;
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Should an account be created? " . print_r($createAccount));
if ($createAccount) {
$account->save();
$accountId = $account->id;
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Just created account with id: accountId");
}
if ($mp = Cart66Session::get('Cart66Cart')->getMembershipProduct()) {
$account->attachMembershipProduct($mp, $account->firstName, $account->lastName);
$accountId = $account->id;
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Attached membership to account id: {$accountId}");
}
// Save the order locally
示例2: buildOrderDataArray
/**
* Return an array of data matching the rows in the Cart66 orders table for the given order.
*
* @param array The order as retrieved from mijireh
* @return array
*/
public function buildOrderDataArray($cloud_order)
{
$statusOptions = Cart66Common::getOrderStatusOptions();
$status = $statusOptions[0];
$order_token = $cloud_order['order_number'] . $cloud_order['email'];
$ouid = md5($order_token);
$order_info = array('trans_id' => $cloud_order['order_number'], 'authorization' => $cloud_order['authorization'], 'shipping' => $cloud_order['shipping'], 'shipping_method' => $cloud_order['meta_data']['shipping_method'], 'subtotal' => $cloud_order['subtotal'], 'discount_amount' => $cloud_order['discount'], 'tax' => $cloud_order['tax'], 'total' => $cloud_order['total'], 'status' => $status, 'email' => $cloud_order['email'], 'bill_first_name' => $cloud_order['first_name'], 'bill_last_name' => $cloud_order['last_name'], 'ordered_on' => $cloud_order['order_date'], 'ouid' => $ouid, 'coupon' => $cloud_order['meta_data']['coupon'], 'custom_field' => $cloud_order['meta_data']['custom-field']);
if (isset($cloud_order['shipping_address']) && is_array($cloud_order['shipping_address'])) {
$address = $cloud_order['shipping_address'];
$order_info['ship_first_name'] = $address['first_name'];
$order_info['ship_last_name'] = $address['last_name'];
$order_info['ship_address'] = $address['street'];
$order_info['ship_address2'] = $address['apt_suite'];
$order_info['ship_city'] = $address['city'];
$order_info['ship_state'] = $address['state_province'];
$order_info['ship_zip'] = $address['zip_code'];
$order_info['ship_country'] = Cart66Common::getCountryName($address['country']);
$order_info['phone'] = $address['phone'];
}
return $order_info;
}
示例3: saveOrder
/**
* Save a PayPal IPN order from a Website Payments Pro cart sale.
*
* @param array $pp Urldecoded array of IPN key value pairs
*/
public function saveOrder($pp)
{
global $wpdb;
// NEW Parse custom value
$referrer = false;
$ouid = $pp['custom'];
if (strpos($ouid, '|') !== false) {
list($ouid, $referrer, $gfData) = explode('|', $ouid);
}
$order = new Cart66Order();
$order->loadByOuid($ouid);
if ($order->id > 0 && $order->status == 'checkout_pending') {
$hasDigital = false;
// Calculate subtotal
$subtotal = 0;
$numCartItems = $pp['num_cart_items'] > 0 ? $pp['num_cart_items'] : 1;
for ($i = 1; $i <= $numCartItems; $i++) {
// PayPal in not consistent in the way it passes back the item amounts
$amt = 0;
if (isset($pp['mc_gross' . $i])) {
$amt = $pp['mc_gross' . $i];
} elseif (isset($pp['mc_gross_' . $i])) {
$amt = $pp['mc_gross_' . $i];
}
$subtotal += $amt;
}
$statusOptions = Cart66Common::getOrderStatusOptions();
$status = $statusOptions[0];
// Parse Gravity Forms ids
$gfIds = array();
if (!empty($gfData)) {
$forms = explode(',', $gfData);
foreach ($forms as $f) {
list($itemId, $formEntryId) = explode(':', $f);
$gfIds[$itemId] = $formEntryId;
}
}
// Look for discount amount
$discount = 0;
if (isset($pp['discount'])) {
$discount = $pp['discount'];
}
$data = array('bill_first_name' => $pp['first_name'], 'bill_last_name' => $pp['last_name'], 'bill_address' => $pp['address_street'], 'bill_city' => $pp['address_city'], 'bill_state' => $pp['address_state'], 'bill_zip' => $pp['address_zip'], 'bill_country' => $pp['address_country'], 'ship_first_name' => $pp['address_name'], 'ship_address' => $pp['address_street'], 'ship_city' => $pp['address_city'], 'ship_state' => $pp['address_state'], 'ship_zip' => $pp['address_zip'], 'ship_country' => $pp['address_country'], 'email' => $pp['payer_email'], 'phone' => $pp['contact_phone'], 'shipping' => $pp['mc_handling'], 'tax' => $pp['tax'], 'subtotal' => $subtotal, 'total' => $pp['mc_gross'], 'discount_amount' => $discount, 'trans_id' => $pp['txn_id'], 'ordered_on' => date('Y-m-d H:i:s', Cart66Common::localTs()), 'status' => $status);
foreach ($data as $key => $value) {
$data[$key] = is_null($value) ? '' : $value;
}
// Verify the first items in the IPN are for products managed by Cart66. It could be an IPN from some other type of transaction.
$productsTable = Cart66Common::getTableName('products');
$orderItemsTable = Cart66Common::getTableName('order_items');
$sql = "SELECT id from {$productsTable} where item_number = '" . $pp['item_number1'] . "'";
$productId = $wpdb->get_var($sql);
if (!$productId) {
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] about to throw an exception, this is not an IPN that should be managed by cart66 because the item number does not match up");
throw new Exception("This is not an IPN that should be managed by Cart66");
}
// Look for the 100% coupons shipping item and move it back to a shipping costs rather than a product
if ($data['shipping'] == 0) {
for ($i = 1; $i <= $numCartItems; $i++) {
$itemNumber = strtoupper($pp['item_number' . $i]);
if ($itemNumber == 'SHIPPING') {
$data['shipping'] = isset($pp['mc_gross_' . $i]) ? $pp['mc_gross_' . $i] : $pp['mc_gross' . $i];
}
}
}
$order->setData($data);
$order->save();
$orderId = $order->id;
// Handle email receipts
if (CART66_PRO && CART66_EMAILS && Cart66Setting::getValue('enable_advanced_notifications') == 1) {
$notify = new Cart66AdvancedNotifications($orderId);
$notify->sendAdvancedEmailReceipts();
} elseif (CART66_EMAILS) {
$notify = new Cart66Notifications($orderId);
$notify->sendEmailReceipts();
}
// Process affiliate reward if necessary
if ($referrer && CART66_PRO) {
Cart66Common::awardCommission($order->id, $referrer);
// End processing affiliate information
if (isset($_COOKIE['ap_id']) && $_COOKIE['ap_id']) {
setcookie('ap_id', $referrer, time() - 3600, "/");
unset($_COOKIE['ap_id']);
}
Cart66Session::drop('app_id');
}
if (CART66_PRO) {
// Begin iDevAffiliate Tracking
if (CART66_PRO && ($url = Cart66Setting::getValue('idevaff_url'))) {
require_once CART66_PATH . "/pro/idevaffiliate-award.php";
}
// End iDevAffiliate Tracking
}
} else {
$orderTable = Cart66Common::getTableName('orders');
// Make sure the transaction id is not already in the database
//.........这里部分代码省略.........
示例4: saveTcoOrder
public function saveTcoOrder()
{
global $wpdb;
// NEW Parse custom value
$referrer = false;
$ouid = $_POST['custom'];
if (strpos($ouid, '|') !== false) {
list($ouid, $referrer) = explode('|', $ouid);
}
$order = new Cart66Order();
$order->loadByOuid($ouid);
if ($order->id > 0 && $order->status == 'checkout_pending' && $_POST['total'] == $order->total) {
$statusOptions = Cart66Common::getOrderStatusOptions();
$status = $statusOptions[0];
$data = array('bill_first_name' => $_POST['first_name'], 'bill_last_name' => $_POST['last_name'], 'bill_address' => $_POST['street_address'], 'bill_address2' => $_POST['street_address2'], 'bill_city' => $_POST['city'], 'bill_state' => $_POST['state'], 'bill_zip' => $_POST['zip'], 'bill_country' => $_POST['country'], 'email' => $_POST['email'], 'trans_id' => $_POST['order_number'], 'ordered_on' => date('Y-m-d H:i:s', Cart66Common::localTs()), 'status' => $status);
// Verify the first items in the IPN are for products managed by Cart66. It could be an IPN from some other type of transaction.
$productsTable = Cart66Common::getTableName('products');
$orderItemsTable = Cart66Common::getTableName('order_items');
$sql = "SELECT id from {$productsTable} where item_number = '" . $_POST['li_0_product_id'] . "'";
$productId = $wpdb->get_var($sql);
if (!$productId) {
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] about to throw an exception, this is not an IPN that should be managed by cart66 because the item number does not match up");
throw new Exception("This is not an IPN that should be managed by Cart66");
}
$order->setData($data);
$order->save();
$orderId = $order->id;
// Handle email receipts
if (CART66_PRO && CART66_EMAILS && Cart66Setting::getValue('enable_advanced_notifications') == 1) {
$notify = new Cart66AdvancedNotifications($orderId);
$notify->sendAdvancedEmailReceipts();
} elseif (CART66_EMAILS) {
$notify = new Cart66Notifications($orderId);
$notify->sendEmailReceipts();
}
// Process affiliate reward if necessary
if ($referrer && CART66_PRO) {
Cart66Common::awardCommission($order->id, $referrer);
// End processing affiliate information
if (isset($_COOKIE['ap_id']) && $_COOKIE['ap_id']) {
setcookie('ap_id', $referrer, time() - 3600, "/");
unset($_COOKIE['ap_id']);
}
Cart66Session::drop('app_id');
}
if (CART66_PRO) {
// Begin iDevAffiliate Tracking
if (CART66_PRO && ($url = Cart66Setting::getValue('idevaff_url'))) {
require_once CART66_PATH . "/pro/idevaffiliate-award.php";
}
// End iDevAffiliate Tracking
}
wp_redirect(remove_query_arg('listener', Cart66Common::getCurrentPageUrl()));
exit;
}
}