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


PHP GetOrder函数代码示例

本文整理汇总了PHP中GetOrder函数的典型用法代码示例。如果您正苦于以下问题:PHP GetOrder函数的具体用法?PHP GetOrder怎么用?PHP GetOrder使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: generatePrintableInvoicePageTitle

function generatePrintableInvoicePageTitle($orderIds)
{
	$title = GetConfig('StoreName').' - ';

	// allow access to deleted orders if printing from within control panel
	$isAdmin = (defined('ISC_ADMIN_CP') && ISC_ADMIN_CP);

	if(count($orderIds) == 1 && ($order = GetOrder($orderIds[0], null, null, $isAdmin))) {
		return $title .= sprintf(GetLang('PrintInvoiceForOrderNumber'), $orderIds[0]);
	}

	return $title .= GetLang('PrintInvoices');
}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:13,代码来源:order.printing.php

示例2: takeOrder

function takeOrder($conn)
{
    $products = json_decode($_GET['products']);
    $order_id = $_GET['order_id'];
    foreach ($products as $product) {
        // sprawdzenie czy produkty są na stanie
        $product_amount = $conn->query("SELECT amount FROM product WHERE product_id =" . $product->product_id . ";");
        $product_amount = $product_amount->fetch();
        if ($product_amount['amount'] < $product->amount) {
            return array('code' => JSON::$resultCodes['not_enough_items'], 'data' => null);
        }
    }
    foreach ($products as $product) {
        $conn->query("UPDATE product SET amount=amount-" . $product->amount . " WHERE product_id=" . $product->product_id . ";");
        $conn->query("UPDATE orders SET status_id = status_id+1 WHERE order_id =" . $order_id . ";");
        $conn->query("INSERT INTO order_details VALUES(" . $order_id . " , " . $product->product_id . " , " . $product->amount . ");");
        if ($conn->error) {
            return array('code' => JSON::$resultCodes['mysql_exception'], 'data' => null);
        }
    }
    $order = GetOrder($conn, $order_id);
    return array('code' => JSON::$resultCodes['ok'], 'data' => $order);
}
开发者ID:dakusinio,项目名称:Sale,代码行数:23,代码来源:orderManagement.php

示例3: ViewCustomFields

 private function ViewCustomFields()
 {
     if (!isset($_REQUEST['orderId']) || !isId($_REQUEST['orderId'])) {
         exit;
     }
     // Load the order
     $order = GetOrder($_REQUEST['orderId']);
     if (!$order || $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId() && $order['ordvendorid'] != $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) {
         exit;
     }
     $fields = null;
     if ($order['ordcustomfields'] !== '') {
         $fields = unserialize($order['ordcustomfields']);
     }
     $GLOBALS['OrderID'] = $order['orderid'];
     $GLOBALS['OrderCustomFieldsPopupHeading'] = sprintf(GetLang('OrderCustomFieldsPopupHeading'), $order['orderid']);
     $GLOBALS['OrderCustomFields'] = '';
     if (!is_array($fields) || empty($fields)) {
         $GLOBALS['HideCustomFields'] = 'none';
     } else {
         $GLOBALS['HideMissingCustomFields'] = 'none';
         foreach ($fields as $widgetId => $data) {
             if ($data['type'] == 'singlecheckbox') {
                 $data['data'] = GetLang('Yes');
             }
             $GLOBALS['CustomFieldLabel'] = isc_html_escape($data['label']);
             $GLOBALS['CustomFieldData'] = isc_html_escape($data['data']);
             $GLOBALS['OrderCustomFields'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('OrderCustomFields');
         }
     }
     $GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("orders.customfields.popup");
     $GLOBALS["ISC_CLASS_TEMPLATE"]->ParseTemplate();
 }
开发者ID:nirvana-info,项目名称:old_bak,代码行数:33,代码来源:class.remote.orders_23_Jult_mj.php

示例4: UpdateReturnStatus

	public function UpdateReturnStatus(&$return, $status, $crediting = false)
	{

		// Start a transaction
		$GLOBALS['ISC_CLASS_DB']->Query("START TRANSACTION");

		// Changing the status of this return to "Refunded", so we need to perform some additional things
		if($status == 5 && $return['retstatus'] != 5) {
			$refundAmount = $return['retprodcost'] * $return['retprodqty'];
			$updatedProduct = array(
				"ordprodrefundamount" => $return['retprodcost'],
				"ordprodrefunded" => $return['retprodqty'],
				"ordprodreturnid" => $return['returnid']
			);

			$order = getOrder($return['retorderid']);
			if (!$order) {
				return false;
			}

			$GLOBALS['ISC_CLASS_DB']->UpdateQuery("order_products", $updatedProduct, "orderprodid='".$GLOBALS['ISC_CLASS_DB']->Quote($return['retordprodid'])."'");

			$query = "
				UPDATE [|PREFIX|]orders
				SET ordrefundedamount = ordrefundedamount + ".$refundAmount."
				WHERE orderid='".$return['retorderid']."'
			";
			$this->db->query($query);

			// Have all items in this order been refunded? Mark the order as refunded.
			$query = sprintf("SELECT SUM(ordprodqty-ordprodrefunded) FROM [|PREFIX|]order_products WHERE orderorderid=%d", $return['retorderid']);
			$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
			$remainingItems = $GLOBALS['ISC_CLASS_DB']->FetchOne($result);
			if($remainingItems == 0) {
				$updatedOrder = array(
					'ordstatus' => 4
				);
				$GLOBALS['ISC_CLASS_DB']->UpdateQuery("orders", $updatedOrder, "orderid='".$GLOBALS['ISC_CLASS_DB']->Quote($return['retorderid'])."'");
			}

			// Update the status of this return
			$updatedReturn = array(
				"retstatus" => 5,
				"retuserid" => $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetUserId()
			);
			$GLOBALS['ISC_CLASS_DB']->UpdateQuery("returns", $updatedReturn, "returnid='".$GLOBALS['ISC_CLASS_DB']->Quote($return['returnid'])."'");

			// Update the product inventory for this returned item
			$query = sprintf("SELECT * FROM [|PREFIX|]order_products WHERE ordprodid='%d'", $return['retordprodid']);
			$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
			$row = $GLOBALS['ISC_CLASS_DB']->Fetch($result);

			UpdateInventoryOnReturn($return['retordprodid']);

			// dont send a refund through the checkout module if a store credit was issued
			if (!$crediting) {
				// If the checkout module that was used for an order is still enabled and has a function
				// to handle a status change, then call that function
				$valid_checkout_modules = GetAvailableModules('checkout', true, true);
				$valid_checkout_module_ids = array();
				foreach ($valid_checkout_modules as $valid_module) {
					$valid_checkout_module_ids[] = $valid_module['id'];
				}

				$newStatus = $order['ordstatus'];
				if (isset($updatedOrder['ordstatus'])) {
					$newStatus = $updatedOrder['ordstatus'];
				}

				// attempt to refund this amount with the checkout provider
				$order = GetOrder($return['retorderid'], false);
				if (in_array($order['orderpaymentmodule'], $valid_checkout_module_ids)) {
					GetModuleById('checkout', $checkout_module, $order['orderpaymentmodule']);
					if (method_exists($checkout_module, 'HandleStatusChange')) {
						call_user_func(array($checkout_module, 'HandleStatusChange'), $return['retorderid'], $order['ordstatus'], $newStatus, $refundAmount);
					}
				}
			}
		}
		else {
			// Update the status of this return
			$updatedReturn = array(
				"retstatus" => $status
			);
			$GLOBALS['ISC_CLASS_DB']->UpdateQuery("returns", $updatedReturn, "returnid='".$GLOBALS['ISC_CLASS_DB']->Quote($return['returnid'])."'");
		}

		$return['retstatus'] = $status;

		if(GetConfig('NotifyOnReturnStatusChange') == 1) {
			$this->EmailReturnStatusChange($return);
		}

		if($GLOBALS['ISC_CLASS_DB']->GetErrorMsg() == "") {
			$GLOBALS['ISC_CLASS_DB']->Query("COMMIT");
			return true;
		}
		else {
			return false;
		}
//.........这里部分代码省略.........
开发者ID:hungnv0789,项目名称:vhtm,代码行数:101,代码来源:class.returns.php

示例5: convertOrderToQuote

	/**
	 * Given an order ID, load the order and convert it in to a quote based off
	 * the ISC_QUOTE class.
	 *
	 * @param int $orderId The order ID to load in to a quote.
	 * @return ISC_QUOTE Quote object for the order.
	 */
	public function convertOrderToQuote($orderId, $enableDiscounts = true)
	{
		$order = GetOrder($orderId, null, null, true);
		if(!$order) {
			 return false;
		}

		$quote = new ISC_QUOTE;
		$quote
			->setDiscountsEnabled($enableDiscounts)
			->setOrderId($orderId)
			->setCustomerId($order['ordcustid'])
			->setAppliedStoreCredit($order['ordstorecreditamount'])
			->setCustomerMessage($order['ordcustmessage'])
			->setStaffNotes($order['ordnotes'])
			->setOrderStatus($order['ordstatus']);

		$billingCustomFields = array();
		if($order['ordformsessionid']) {
			$billingCustomFields = $GLOBALS['ISC_CLASS_FORM']->getSavedSessionData(
				$order['ordformsessionid'],
				array(),
				FORMFIELDS_FORM_BILLING,
				true
			);
		}

		$quote->getBillingAddress()
			->setFirstName($order['ordbillfirstname'])
			->setLastName($order['ordbilllastname'])
			->setCompany($order['ordbillcompany'])
			->setEmail($order['ordbillemail'])
			->setPhone($order['ordbillphone'])
			->setAddress1($order['ordbillstreet1'])
			->setAddress2($order['ordbillstreet2'])
			->setCity($order['ordbillsuburb'])
			->setZip($order['ordbillzip'])
			->setCountryByName($order['ordbillcountry'])
			->setStateByName($order['ordbillstate'])
			->setCustomFields($billingCustomFields);

		if($order['shipping_address_count'] > 1) {
			$quote->setIsSplitShipping(true);
		}

		// Set the shipping addresses on the quote
		$query = "
			SELECT *
			FROM [|PREFIX|]order_addresses a
			LEFT JOIN [|PREFIX|]order_shipping s ON (s.order_address_id = a.id)
			WHERE a.order_id='".$order['orderid']."'
		";
		$result = $GLOBALS['ISC_CLASS_DB']->query($query);
		while($address = $GLOBALS['ISC_CLASS_DB']->fetch($result)) {
			$shippingCustomFields = array();
			if($address['form_session_id']) {
				$shippingCustomFields = $GLOBALS['ISC_CLASS_FORM']->getSavedSessionData(
					$address['form_session_id'],
					array(),
					FORMFIELDS_FORM_SHIPPING,
					true
				);
			}
			$quoteAddress = new ISC_QUOTE_ADDRESS_SHIPPING;
			$quoteAddress
				->setQuote($quote)
				->setId($address['order_address_id'])
				->setFirstName($address['first_name'])
				->setLastName($address['last_name'])
				->setCompany($address['company'])
				->setEmail($address['email'])
				->setPhone($address['phone'])
				->setAddress1($address['address_1'])
				->setAddress2($address['address_2'])
				->setCity($address['city'])
				->setZip($address['zip'])
				->setCountryByName($address['country'])
				->setStateByName($address['state'])
				->setCustomFields($shippingCustomFields)
				->setShippingMethod($address['base_cost'], $address['method'], $address['module'], true)
				->setHandlingCost($address['base_handling_cost'], true);
			$quote->addShippingAddress($quoteAddress);
		}

		// Load any configurable fields for items on this order
		$configurableFields = array();
		$query = "
			SELECT *
			FROM [|PREFIX|]order_configurable_fields
			WHERE orderid='".$order['orderid']."'
		";
		$result = $GLOBALS['ISC_CLASS_DB']->query($query);
		while($configurableField = $GLOBALS['ISC_CLASS_DB']->fetch($result)) {
//.........这里部分代码省略.........
开发者ID:hungnv0789,项目名称:vhtm,代码行数:101,代码来源:entity.order.php

示例6: addProducts

 /**
  * Add all the products
  *
  * Method will add all the products within the $input['products'] array
  *
  * @access private
  * @param array &$input The referenced input data
  * @return bool TRUE if all the products were added, FALSE otherwise
  */
 private function addProducts(&$input, $editingExisting = false)
 {
     if (!array_key_exists('products', $input) || !is_array($input['products'])) {
         return false;
     }
     $existingOrder = array();
     if ($editingExisting) {
         $existingOrder = GetOrder($input['orderid'], true);
     }
     $couponsUsed = array();
     $giftCertificates = array();
     foreach ($input['products'] as $product) {
         $existingProduct = false;
         if (isset($product['existing_order_product']) && isset($existingOrder['products'][$product['existing_order_product']])) {
             $existingProduct = $existingOrder['products'][$product['existing_order_product']];
             unset($existingOrder['products'][$product['existing_order_product']]);
         }
         if (!isset($product['product_code'])) {
             $product['product_code'] = '';
         }
         if (!isset($product['variation_id'])) {
             $product['variation_id'] = 0;
         }
         if (isset($product['discount_price'])) {
             $price = $product['discount_price'];
         } else {
             $price = $product['product_price'];
         }
         // Set up some default values for the product
         $newProduct = array('ordprodsku' => $product['product_code'], "ordprodname" => $product['product_name'], "ordprodtype" => '', "ordprodcost" => $price, "ordprodoriginalcost" => $product['product_price'], "ordprodweight" => 0, "ordprodqty" => $product['quantity'], "orderorderid" => $input['orderid'], "ordprodid" => $product['product_id'], "ordprodvariationid" => $product['variation_id'], "ordprodoptions" => '', "ordprodcostprice" => 0, "ordprodfixedshippingcost" => 0, "ordprodistaxable" => 1);
         //YMM info added by Simha
         $newProduct['ordyear'] = $product['year'];
         $newProduct['ordmake'] = $product['make'];
         $newProduct['ordmodel'] = $product['model'];
         //blessen
         if (isset($input['offerid'])) {
             $newProduct['offerid'] = $input['offerid'];
         }
         /*
         $mmyvals =  array(
             "omake"             => $product['make'],
             "model"            => $product['model'],
             "year"             => $product['year'],                      
         );                               
         $MMYInfo = serialize($mmyvals);              
         $newProduct['mmyinfo'] =  $MMYInfo;
         */
         //YMM info added by Simha Ends
         // This product is a gift certificate so set the appropriate values
         if (isset($product['type']) && $product['type'] == "giftcertificate") {
             // Gift certificates can't be edited
             if (isset($product['existing_order_product'])) {
                 continue;
             }
             $newProduct['ordprodtype'] = 'giftcertificate';
             $giftCertificates[] = $product;
         } else {
             if (isset($product['data'])) {
                 $newProduct['ordprodtype'] = $product['data']['prodtype'];
             } else {
                 $newProduct['ordprodtype'] = 'physical';
             }
         }
         if (isset($product['data']['prodcostprice'])) {
             $newProduct['ordprodcostprice'] = (double) $product['data']['prodcostprice'];
         }
         if (isset($product['options'])) {
             $newProduct['ordprodoptions'] = serialize($product['options']);
         }
         if (isset($product['data']['prodweight'])) {
             $newProduct['ordprodweight'] = $product['data']['prodweight'];
         }
         if (isset($product['data']['prodfixedshippingcost'])) {
             $newProduct['ordprodfixedshippingcost'] = $product['data']['prodfixedshippingcost'];
         }
         if (isset($product['data']['prodistaxable'])) {
             $newProduct['ordprodistaxable'] = $product['data']['prodistaxable'];
         }
         if (isset($product['event_date']) && isset($product['event_name'])) {
             $newProduct['ordprodeventdate'] = $product['event_date'];
             $newProduct['ordprodeventname'] = $product['event_name'];
         }
         // If wrapping has been applied to this product, add it in
         if (isset($product['wrapping'])) {
             $newProduct['ordprodwrapid'] = $product['wrapping']['wrapid'];
             $newProduct['ordprodwrapname'] = $product['wrapping']['wrapname'];
             $newProduct['ordprodwrapcost'] = $product['wrapping']['wrapprice'];
             if (isset($product['wrapping']['wrapmessage'])) {
                 $newProduct['ordprodwrapmessage'] = $product['wrapping']['wrapmessage'];
             }
         }
//.........这里部分代码省略.........
开发者ID:nirvana-info,项目名称:old_bak,代码行数:101,代码来源:entity.order_jun24.php

示例7: _handleAuctionCheckoutComplete

	/**
	* Ebay: Sent to a seller when a buyer completes the checkout process for an item. Not sent when an auction ends without bids.
	*
	* My notes: Seems to be triggered when the buyer's payment process for an AUCTION item has completed, is not fired for fixed price items which fire 'FixedPrice...' notifications instead
	*
	* @param array $body
	*/
	protected function _handleAuctionCheckoutComplete($body)
	{
		// The data fields in the notification are the same as those returned by the GetItemTransactions call with the default detail level.
		if (!empty ($body['Item']['ItemID']) && ISC_ADMIN_EBAY::validEbayItemId($body['Item']['ItemID'])) {
			// variables init
			$order = array();
			$orderId = 1;
			$order['ShippingInsuranceCost'] = 0;
			$completedPaymentHoldStatus = array('None', 'Released');
			$orderStatus = ORDER_STATUS_AWAITING_PAYMENT;
			$existingOrderId = 0;

			// Determine if the buyer purchase multiple items from the same seller
			if (!empty($body['TransactionArray']['Transaction']['ContainingOrder'])) {
			 // Call the operation to get the order transaction.
				$orderId = $body['TransactionArray']['Transaction']['ContainingOrder']['OrderID'];

				// if the record already exist, check if we need to update existing orders, that the payment hasn't been cleared previously.
				$existingOrder = GetOrderByEbayOrderId($orderId);
				$orderTransaction = ISC_ADMIN_EBAY_OPERATIONS::getOrderTransactions($orderId);
				$transactions = $orderTransaction->OrderArray->Order->TransactionArray->Transaction;

				$order['SubTotal'] = (string) $orderTransaction->OrderArray->Order->Subtotal;
				$order['ShippingCost'] = (string) $orderTransaction->OrderArray->Order->ShippingServiceSelected->ShippingServiceCost;
				$order['ShippingInsuranceCost'] = 0;
				$order['GrandTotal'] = (string) $orderTransaction->OrderArray->Order->Total;
				$order['TotalQuantityPurchased'] = 0;
				foreach ($transactions as $transaction) {
					$convertedTransaction = (array) $transaction;
					$variationOptionsString = '';
					if (isset($convertedTransaction['Variation']->VariationSpecifics)) {
						$variationNameValueList = (array) $convertedTransaction['Variation']->VariationSpecifics->NameValueList;
						$variationOptions = array();
						$variationSpecifics = (array) $convertedTransaction['Variation']->VariationSpecifics;
						if (is_array($variationSpecifics['NameValueList'])) {
							foreach ($variationSpecifics['NameValueList'] as $option) {
								$variationOptions[(string) $option->Name] = (string) $option->Value;
							}
						} else {
							$variationOptions[(string) $variationSpecifics['NameValueList']->Name] = (string) $variationSpecifics['NameValueList']->Value;
						}
						$variationOptionsString = serialize($variationOptions);
					}
					$quantityPurchased = $convertedTransaction['QuantityPurchased'];
					$transactionPrice = $convertedTransaction['TransactionPrice'];
					$itemId = (string) $convertedTransaction['Item']->ItemID;
					$transactionId = (string) $convertedTransaction['TransactionID'];
					$totalTransactionPrice = $transactionPrice * $quantityPurchased;
					$order['Transaction'][] = array(
						'QuantityPurchased' => $quantityPurchased,
						'TransactionPrice' => $transactionPrice,
						'ItemId' => $itemId,
						'TotalTransactionPrice' => $totalTransactionPrice,
						'VariationOptionsString' => $variationOptionsString,
						'TransactionId' => $transactionId,
					);
					$order['TotalQuantityPurchased'] += $quantityPurchased;
					$order['Currency'] = GetCurrencyByCode($body['TransactionArray']['Transaction']['AmountPaid']['!currencyID']);
					$buyerInfoShippingAddress = $body['TransactionArray']['Transaction']['Buyer']['BuyerInfo']['ShippingAddress'];
					$buyerEmailAddress = $body['TransactionArray']['Transaction']['Buyer']['Email'];
				}

				if ($existingOrder) {
					$existingOrderId = $existingOrder['orderid'];
				}
			}
			else {
				$transactions = $body['TransactionArray'];
				foreach ($transactions as $transaction) {
					$itemId = $body['Item']['ItemID'];
					$transactionId = $transaction['TransactionID'];
					$query = "
						SELECT *
						FROM [|PREFIX|]order_products
						WHERE ebay_item_id = '".$GLOBALS["ISC_CLASS_DB"]->Quote($itemId)."'
							AND ebay_transaction_id = '".$GLOBALS["ISC_CLASS_DB"]->Quote($transactionId)."'
						LIMIT 1
					";
					$res = $GLOBALS['ISC_CLASS_DB']->Query($query);
					$row = $GLOBALS['ISC_CLASS_DB']->Fetch($res);
					$eachItemPriceExTax = $transaction['TransactionPrice']['!'];
					$quantityPurchased = $transaction['QuantityPurchased'];
					$totalTransactionPrice = $quantityPurchased * $eachItemPriceExTax;
					$variationOptionsString = '';

					// do we have a variation for this product?
					if (isset($transaction['Variation']['VariationSpecifics'])) {
						$variationNameValueList = $transaction['Variation']['VariationSpecifics']['NameValueList'];
						$variationOptions = array();
						foreach ($variationNameValueList as $option) {
							$variationOptions[$option['Name']] = $option['Value'];
						}
						$variationOptionsString = serialize($variationOptions);
//.........这里部分代码省略.........
开发者ID:hungnv0789,项目名称:vhtm,代码行数:101,代码来源:class.ebay.notifications.listener.php

示例8: TransferToProvider

	/**
	*	Redirect the customer to eSelectPlus's site to enter their payment details
	*/
	public function TransferToProvider()
	{
		$total = number_format($this->GetGatewayAmount(), 2,'.', '');

		$this->_hostedpaypageid = $this->GetValue("hostedpaypageid");
		$this->_hostedpaypagetoken = $this->GetValue("hostedpaypagetoken");
		$testmode_on = $this->GetValue("testmode");
		if ($testmode_on == "YES") {
			$eselectplus_url = "https://esplusqa.moneris.com/DPHPP/index.php";
		} else {
			$eselectplus_url = "https://esplus.moneris.com/DPHPP/index.php";
		}

		$billingDetails = $this->GetBillingDetails();
		$shippingAddress = $this->getShippingAddress();

		$formFields = array(
			'hpp_id' 			=> $this->_hostedpaypageid,
			'hpp_key'			=> $this->_hostedpaypagetoken,
			'amount' 			=> $total,
			'cust_id' 			=> GetLang('eSelectPlusOrder', array('id' => $this->GetCombinedOrderId())),
			'client_email' 		=> $billingDetails['ordbillemail'],
			'od_bill_company'	=> $billingDetails['ordbillcompany'],
			'od_bill_firstname' => $billingDetails['ordbillfirstname'],
			'od_bill_lastname' 	=> $billingDetails['ordbilllastname'],
			'od_bill_address' 	=> $billingDetails['ordbillstreet1'] . ", " . $billingDetails['ordbillstreet2'],
			'od_bill_city' 		=> $billingDetails['ordbillsuburb'],
			'od_bill_state' 	=> $billingDetails['ordbillstate'],
			'od_bill_zipcode' 	=> $billingDetails['ordbillzip'],
			'od_bill_country' 	=> $billingDetails['ordbillcountry'],
			'od_bill_phone' 	=> $billingDetails['ordbillphone'],
			'od_ship_company' 	=> $shippingAddress['company'],
			'od_ship_firstname' => $shippingAddress['first_name'],
			'od_ship_lastname' 	=> $shippingAddress['last_name'],
			'od_ship_address' 	=> $shippingAddress['address_1'] . ", " . $shippingAddress['address_2'],
			'od_ship_city' 		=> $shippingAddress['city'],
			'od_ship_state' 	=> $shippingAddress['state'],
			'od_ship_zipcode' 	=> $shippingAddress['zip'],
			'od_ship_country' 	=> $shippingAddress['country'],
			'od_ship_phone' 	=> $shippingAddress['phone']
		);

		// add the items
		$orders = $this->GetOrders();
		$products = array();
		foreach ($orders as $order) {
			$order = GetOrder($order['orderid']);
			foreach ($order['products'] as $product) {
				$products[] = $product;
			}
		}

		$i = 1;
		foreach ($products as $product) {
			$productFields = array(
				'li_id'.$i			=> $product['ordprodsku'],
				'li_description'.$i	=> $product['ordprodname'],
				'li_quantity'.$i 	=> $product['ordprodqty'],
				'li_price'.$i 		=> number_format($product['total_inc_tax'], 2,'.','')
			);

			$formFields += $productFields;

			$i++;
		}

		// add the shipping
		$shipping_cost = $this->GetShippingCost() + $this->GetHandlingCost();
		if ($shipping_cost > 0) {
			$formFields['li_shipping'] = number_format($shipping_cost, 2, '.', '');
		}

		 // add tax
		if ($this->GetTaxCost() > 0) {
			$formFields['li_taxes'] = number_format($this->GetTaxCost(), 2, '.', '');
		}

		$this->RedirectToProvider($eselectplus_url, $formFields);
	}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:82,代码来源:module.eselectplushpus.php

示例9: CreateShipment

	/**
	 * Show the form to create a new shipment from one or more items in an order.
	 */
	public function CreateShipment()
	{
		if(!isset($_REQUEST['orderId'])) {
			exit;
		}

		$order = GetOrder($_REQUEST['orderId']);
		if(!$order || !isset($order['orderid'])) {
			exit;
		}

		if ($order['ordisdigital'] == 1) {
			$this->template->display('modal.basic.tpl', array(
				'title' => GetLang('CreateShipmentFromOrder'),
				'message' => GetLang('DigitalOrderNoShipping'),
			));
			exit;
		}

		if ($order['ordtotalqty'] - $order['ordtotalshipped'] <= 0) {
			$this->template->display('modal.basic.tpl', array(
				'title' => GetLang('CreateShipmentFromOrder'),
				'message' => GetLang('AllItemsShipped'),
			));
			exit;
		}

		if(empty($_REQUEST['addressId'])) {
			$addressWhere = 'order_id='.$order['orderid'];
		}
		else {
			$addressWhere = 'order_id='.$order['orderid'].' AND id='.(int)$_REQUEST['addressId'];
		}

		// Fetch the address associated with this order
		$query = "
			SELECT *
			FROM [|PREFIX|]order_addresses
			WHERE ".$addressWhere."
			LIMIT 1
		";
		$result = $this->db->query($query);
		$address = $this->db->fetch($result);
		if(!$address) {
			exit;
		}
		$query = "
			SELECT *
			FROM [|PREFIX|]order_shipping
			WHERE order_address_id='".$address['id']."'
		";
		$result = $this->db->query($query);
		$shipping = $this->db->fetch($result);

		$this->template->assign('address', $address);
		$this->template->assign('shipping', $shipping);

		$shipmentModules = array();
		$shippingModules = getAvailableModules('shipping');
		foreach($shippingModules as $module) {
			$shipmentModules[$module['id']] = $module['object']->getName();
		}

		$this->template->assign('shippingModules', $shipmentModules);

		$GLOBALS['OrderId'] = $order['orderid'];
		$GLOBALS['OrderDate'] = CDate($order['orddate']);
		$GLOBALS['ShippingMethod'] = isc_html_escape($shipping['method']);
		$GLOBALS['OrderComments'] = isc_html_escape($order['ordcustmessage']);

		// Fetch out any items that have already been shipped for this order
		$shippedItems = array();
		$query = "
			SELECT itemid, itemqty, itemordprodid
			FROM [|PREFIX|]shipment_items i
			INNER JOIN [|PREFIX|]shipments s ON (
				s.shiporderid='".(int)$order['orderid']."' AND
				i.shipid=s.shipmentid
			)
			INNER JOIN [|PREFIX|]order_products op ON (op.orderprodid = i.itemordprodid)
			WHERE op.order_address_id='".$address['id']."'
		";

		$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
		while($shippedItem = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
			if(!isset($shippedItems[$shippedItem['itemordprodid']])) {
				$shippedItems[$shippedItem['itemordprodid']] = 0;
			}
			$shippedItems[$shippedItem['itemordprodid']] += $shippedItem['itemqty'];
		}

		// OK, now loop through all of the items going to this address and see what we can ship
		$query = "
			SELECT *
			FROM [|PREFIX|]order_products
			WHERE order_address_id='".$address['id']."'
		";
//.........这里部分代码省略.........
开发者ID:hungnv0789,项目名称:vhtm,代码行数:101,代码来源:class.shipments.php

示例10: EmailOnStatusChange

/**
 *	Send an email notification to a customer when the status of their order changes.
 *
 * @param int The ID of the order to email the invoice for.
 * @return boolean True if successful.
 */
function EmailOnStatusChange($orderId, $status)
{
	// Load the order
	$order = GetOrder($orderId);
	if (!$order) {
		return false;
	}

	// Load the customer we'll be contacting
	if ($order['ordcustid'] > 0) {
		$customer = GetCustomer($order['ordcustid']);
		$GLOBALS['ViewOrderStatusLink'] = '<a href="'.$GLOBALS['ShopPathSSL'].'/orderstatus.php">'.GetLang('ViewOrderStatus').'</a>';
	} else {
		$customer['custconemail'] = $order['ordbillemail'];
		$customer['custconfirstname'] = $order['ordbillfirstname'];
		$GLOBALS['ViewOrderStatusLink'] = '';
	}

	if (empty($customer['custconemail'])) {
		return;
	}

	// All prices in the emailed invoices will be shown in the default currency of the store
	$defaultCurrency = GetDefaultCurrency();

	$statusName = GetOrderStatusById($status);
	$GLOBALS['OrderStatusChangedHi'] = sprintf(GetLang('OrderStatusChangedHi'), isc_html_escape($customer['custconfirstname']));
	$GLOBALS['OrderNumberStatusChangedTo'] = sprintf(GetLang('OrderNumberStatusChangedTo'), $order['orderid'], $statusName);
	$GLOBALS['OrderTotal'] = FormatPrice($order['total_inc_tax'], false, true, false, $defaultCurrency, true);
	$GLOBALS['DatePlaced'] = CDate($order['orddate']);

	if ($order['orderpaymentmethod'] === 'giftcertificate') {
		$GLOBALS['PaymentMethod'] = GetLang('PaymentGiftCertificate');
	}
	else if ($order['orderpaymentmethod'] === 'storecredit') {
		$GLOBALS['PaymentMethod'] = GetLang('PaymentStoreCredit');
	}
	else {
		$GLOBALS['PaymentMethod'] = $order['orderpaymentmethod'];
	}

	$query = "
		SELECT COUNT(*)
		FROM [|PREFIX|]order_products
		WHERE ordprodtype='digital'
		AND orderorderid='".$GLOBALS['ISC_CLASS_DB']->Quote($orderId)."'
	";

	$numDigitalProducts = $GLOBALS['ISC_CLASS_DB']->FetchOne($query);

	$emailTemplate = FetchEmailTemplateParser();

	$GLOBALS['SNIPPETS']['CartItems'] = "";

	if (OrderIsComplete($status) && $numDigitalProducts > 0) {
		$query = "
			SELECT *
			FROM [|PREFIX|]order_products op INNER JOIN [|PREFIX|]products p ON (op.ordprodid = p.productid)
			WHERE ordprodtype='digital'
			AND orderorderid='".$GLOBALS['ISC_CLASS_DB']->Quote($orderId)."'
		";
		$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
		while ($product_row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
			$GLOBALS['ProductOptions'] = '';
			$GLOBALS['ProductQuantity'] = $product_row['ordprodqty'];
			$GLOBALS['ProductName'] = isc_html_escape($product_row['ordprodname']);

			$GLOBALS['ISC_CLASS_ACCOUNT'] = GetClass('ISC_ACCOUNT');
			$DownloadItemEncrypted = $GLOBALS['ISC_CLASS_ACCOUNT']->EncryptDownloadKey($product_row['orderprodid'], $product_row['ordprodid'], $orderId, $order['ordtoken']);
			$GLOBALS['DownloadsLink'] = $GLOBALS['ShopPathSSL'].'/account.php?action=download_item&amp;data='.$DownloadItemEncrypted;

			$GLOBALS['SNIPPETS']['CartItems'] .= $emailTemplate->GetSnippet("StatusCompleteDownloadItem");
		}
	}

	$GLOBALS['SNIPPETS']['OrderTrackingLink'] = "";

	$shipments = $GLOBALS['ISC_CLASS_DB']->Query("
		SELECT shipmentid, shipdate, shiptrackno, shipping_module, shipmethod, shipcomments
		FROM [|PREFIX|]shipments
		WHERE shiporderid = " . (int)$orderId . "
		ORDER BY shipdate, shipmentid
	");

	$GLOBALS['TrackingLinkList'] = '';

	while($shipment = $GLOBALS['ISC_CLASS_DB']->Fetch($shipments)) {
		if (!$shipment['shiptrackno']) {
			continue;
		}

		GetModuleById('shipping', /** @var ISC_SHIPPING */$module, $shipment['shipping_module']);

		if ($module) {
//.........这里部分代码省略.........
开发者ID:hungnv0789,项目名称:vhtm,代码行数:101,代码来源:orders.php

示例11: DoVoid

	/**
	* Voids an authorized transaction
	*
	* @param mixed $orderId
	* @param mixed $transactionId
	* @param string $message
	*/
	public function DoVoid($orderId, $transactionId, &$message = '')
	{
		$order = GetOrder($orderId);

		$extraInfo = @unserialize($order['extrainfo']);
		if (!is_array($extraInfo) || empty($extraInfo['CyberSourceRequestToken']) || empty($extraInfo['CyberSourceRequestID'])) {
			$message = GetLang('CyberSourceTransactionDetailsMissing');
			return false;
		}

		$request = array(
			'merchantID' => $this->GetValue('merchantid'),
			'merchantReferenceCode' => $orderId,
			'ccAuthReversalService' => array(
				'authRequestID'	=> $extraInfo['CyberSourceRequestID'],
				'run' 			=> 'true',
			),
			'orderRequestToken' => $extraInfo['CyberSourceRequestToken'],
			'purchaseTotals' => array(
				'currency' 			=> GetCurrencyCodeByID($order['ordcurrencyid']),
				'grandTotalAmount' 	=> number_format($order['total_inc_tax'], 2, '.', ''),
			),
		);

		$response = $this->runTransaction($request);

		if (!isset($response['decision'])) {
			$message = GetLang('CyberSourceInvalidRequest');
			return false;
		}

		$decision = $response['decision'];
		$reasonCode = $response['reasonCode'];
		$requestID = $response['requestID'];
		$requestToken = $response['requestToken'];

		$transactionType = GetLang('CyberSourceTransactionTypeVoid');

		if ($decision == 'ACCEPT') {
			$message = GetLang('CyberSourcePaymentVoided');

			unset($extraInfo['CyberSourceRequestID']);
			unset($extraInfo['CyberSourceRequestToken']);

			// Mark the order as captured
			$updatedOrder = array(
				'ordpaymentstatus' 	=> 'void',
				'extrainfo' 		=> serialize($extraInfo),
			);

			// Update the orders table with new transaction details
			$GLOBALS['ISC_CLASS_DB']->UpdateQuery('orders', $updatedOrder, "orderid='".(int)$orderId."'");

			$authorizationCode = '';
			if (isset($response['ccAuthReversalReply']['authorizationCode'])) {
				$authorizationCode = $response['ccAuthReversalReply']['authorizationCode'];
			}

			// Log the transaction in store logs
			$logMessage = GetLang('CyberSourcePaymentVoidedLogMsg', array('orderId' => $orderId));

			$logDetails = GetLang('CyberSourcePaymentVoidedLogDetails', array(
				'decision' 			=> $decision,
				'reasonCode' 		=> $reasonCode,
				'requestID' 		=> $requestID,
				'authorizationCode'	=> $authorizationCode,
				'transactionType'	=> $transactionType,
			));

			$GLOBALS['ISC_CLASS_LOG']->LogSystemSuccess(array('payment', $this->GetName()), $logMessage, $logDetails);

			return true;
		}
		else {
			$message = GetLang('CyberSourceVoidFailed');

			// any missing fields?
			$missingFieldsString = '';
			if (isset($response['missingField'])) {
				$missingFields = $response['missingField'];
				if (!is_array($missingFields)) {
					$missingFields = array($missingFields);
				}

				$missingFieldsString = implode(', ', $missingFields);
			}

			//any invalid fields?
			$invalidFieldsString = '';
			if (isset($response['invalidField'])) {
				$invalidFields = $response['invalidField'];
				if (!is_array($invalidFields)) {
					$invalidFields = array($invalidFields);
//.........这里部分代码省略.........
开发者ID:hungnv0789,项目名称:vhtm,代码行数:101,代码来源:module.cybersourcedirect.php

示例12: UpdateOrderStatus

		/**
		 * Update the order status of a specific order from the manage orders page
		 *
		 * @return void
		 **/
		private function UpdateOrderStatus()
		{
			$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->LoadLangFile('orders');

			if(isset($_REQUEST['o']) && isset($_REQUEST['s'])) {
				$order_id = (int)$_REQUEST['o'];
				$status = (int)$_REQUEST['s'];

				$order = GetOrder($order_id);
				if($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId() && $order['ordvendorid'] != $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) {
					echo 0;
					exit;
				}

				if (UpdateOrderStatus($order_id, $status)) {
					echo 1;
				} else {
					echo 0;
				}
			}
			else {
				echo 0;
			}

			exit;
		}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:31,代码来源:class.remote.php

示例13: PrintCheckedOrderList

function PrintCheckedOrderList($servername, $username, $password, $dbname, $orderlist)
{
    require_once 'EAN13.php';
    $pdf = new PDF_EAN13('P', 'mm', array(105, 148));
    //    echo "PrintCheckedOrderList for: " . $orderlist . "<br><br>";
    $orders = explode(";", $orderlist);
    foreach ($orders as $order) {
        if ($order != "") {
            $order_db = GetOrder($order);
            $orderlines = GetOrderLine($order_db->entity_id, $order);
            CreatePDFFile($servername, $username, $password, $dbname, $order_db, $orderlines, false, $pdf);
        }
    }
    $nomFacture = getcwd() . "/upload/Reservierungen_checked_orders.pdf";
    $pdf->Output($nomFacture);
    echo "Reservierungszettel f&uuml;r <a href=\"" . "upload/Reservierungen_checked_orders.pdf" . "\">" . "alle angekreuzten Bestellunen</a> drucken.<br><br>";
    foreach ($orders as $order) {
        if ($order != "") {
            $order_db = GetOrder($order);
            $orderlines = GetOrderLine($order_db->entity_id, $order);
            CreatePDFFile($servername, $username, $password, $dbname, $order_db, $orderlines, true, null);
        }
    }
    echo "<b>zum beenden bitte Tab schliessen</b>";
    exit;
}
开发者ID:Hifi-Fabrik,项目名称:hififabrik,代码行数:26,代码来源:order.php

示例14: ViewOrderNotes

 private function ViewOrderNotes()
 {
     if (!isset($_REQUEST['orderId']) || !isId($_REQUEST['orderId'])) {
         exit;
     }
     // Load the order
     $order = GetOrder($_REQUEST['orderId']);
     if (!$order || $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId() && $order['ordvendorid'] != $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) {
         exit;
     }
     $GLOBALS['OrderID'] = $order['orderid'];
     $GLOBALS['OrderNotes'] = isc_html_escape($order['ordnotes']);
     $GLOBALS['ThankYouID'] = 'CustomerStatus';
     $GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("orders.notes.popup");
     $GLOBALS["ISC_CLASS_TEMPLATE"]->ParseTemplate();
 }
开发者ID:nirvana-info,项目名称:old_bak,代码行数:16,代码来源:class.remote.customers.php

示例15: UpdateReturnStatus

 public function UpdateReturnStatus(&$return, $status, $crediting = false)
 {
     // Start a transaction
     $GLOBALS['ISC_CLASS_DB']->Query("START TRANSACTION");
     if ($status == 5 && $return['retstatus'] != 5) {
         // Changing the status of this return to "Refunded", so we need to perform some additional things
         $refundAmount = $return['retprodcost'] * $return['retprodqty'];
         // Grab the order if it still exists to provide a refund on the tax as well
         $order = GetOrder($return['retorderid']);
         if ($order['ordtotalincludestax'] == 0 && $order['ordtaxrate'] > 0) {
             $taxCharged = number_format($refundAmount / 100 * $order['ordtaxrate'], GetConfig('DecimalPlaces'), '.', '');
             $refundAmount += $taxCharged;
         }
         $updatedProduct = array("ordprodrefundamount" => $return['retprodcost'], "ordprodrefunded" => $return['retprodqty'], "ordprodreturnid" => $return['returnid']);
         $GLOBALS['ISC_CLASS_DB']->UpdateQuery("order_products", $updatedProduct, "orderprodid='" . $GLOBALS['ISC_CLASS_DB']->Quote($return['retordprodid']) . "'");
         // Fetch the total for this order
         $query = sprintf("SELECT ordsubtotal, ordtotalamount FROM [|PREFIX|]orders WHERE orderid='%s'", $return['retorderid']);
         $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
         $orderTotal = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
         // Reduce the order total by retprodcost x retprodqty (the price we paid x the quantity being returned)
         $orderSubTotal = $orderTotal['ordsubtotal'] - $refundAmount;
         if ($orderSubTotal <= 0) {
             $orderSubTotal = 0;
         }
         $orderTotalAmount = $orderTotal['ordtotalamount'] - $orderTotal['ordsubtotal'] + $orderSubTotal;
         if ($orderTotalAmount <= 0) {
             $orderTotalAmount = 0;
         }
         $updatedOrder = array("ordsubtotal" => $orderSubTotal, "ordtotalamount" => $orderTotalAmount);
         // If the amount of tax has changed, need to update that total too
         if (isset($taxCharged)) {
             $updatedOrder['ordtaxtotal'] = $order['ordtaxtotal'] - $taxCharged;
         } else {
             if ($order['ordtotalincludestax']) {
                 $taxCharged = $refundAmount / (100 + $order['ordtaxrate']) * $order['ordtaxrate'];
                 $taxCharged = number_format($taxCharged, GetConfig('DecimalPlaces'), '.', '');
                 $updatedOrder['ordtaxtotal'] = $order['ordtaxtotal'] - $taxCharged;
             }
         }
         if ($orderTotalAmount == 0) {
             $updatedOrder['ordtaxtotal'] = 0;
         }
         // Have all items in this order been refunded? Mark the order as refunded.
         $query = sprintf("SELECT SUM(ordprodqty-ordprodrefunded) FROM [|PREFIX|]order_products WHERE orderorderid=%d", $return['retorderid']);
         $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
         $remainingItems = $GLOBALS['ISC_CLASS_DB']->FetchOne($result);
         if ($remainingItems == 0) {
             $updatedOrder['ordstatus'] = 4;
         }
         $GLOBALS['ISC_CLASS_DB']->UpdateQuery("orders", $updatedOrder, "orderid='" . $GLOBALS['ISC_CLASS_DB']->Quote($return['retorderid']) . "'");
         // Update the status of this return
         $updatedReturn = array("retstatus" => 5, "retuserid" => $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetUserId());
         $GLOBALS['ISC_CLASS_DB']->UpdateQuery("returns", $updatedReturn, "returnid='" . $GLOBALS['ISC_CLASS_DB']->Quote($return['returnid']) . "'");
         // Update the product inventory for this returned item
         $query = sprintf("SELECT * FROM [|PREFIX|]order_products WHERE ordprodid='%d'", $return['retordprodid']);
         $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
         $row = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
         UpdateInventoryOnReturn($return['retordprodid']);
         // dont send a refund through the checkout module if a store credit was issued
         if (!$crediting) {
             // If the checkout module that was used for an order is still enabled and has a function
             // to handle a status change, then call that function
             $valid_checkout_modules = GetAvailableModules('checkout', true, true);
             $valid_checkout_module_ids = array();
             foreach ($valid_checkout_modules as $valid_module) {
                 $valid_checkout_module_ids[] = $valid_module['id'];
             }
             $newStatus = $order['ordstatus'];
             if (isset($updatedOrder['ordstatus'])) {
                 $newStatus = $updatedOrder['ordstatus'];
             }
             // attempt to refund this amount with the checkout provider
             $order = GetOrder($return['retorderid'], false);
             if (in_array($order['orderpaymentmodule'], $valid_checkout_module_ids)) {
                 GetModuleById('checkout', $checkout_module, $order['orderpaymentmodule']);
                 if (method_exists($checkout_module, 'HandleStatusChange')) {
                     call_user_func(array($checkout_module, 'HandleStatusChange'), $return['retorderid'], $order['ordstatus'], $newStatus, $refundAmount);
                 }
             }
         }
     } else {
         // Update the status of this return
         $updatedReturn = array("retstatus" => $status);
         $GLOBALS['ISC_CLASS_DB']->UpdateQuery("returns", $updatedReturn, "returnid='" . $GLOBALS['ISC_CLASS_DB']->Quote($return['returnid']) . "'");
     }
     $return['retstatus'] = $status;
     if (GetConfig('NotifyOnReturnStatusChange') == 1) {
         $this->EmailReturnStatusChange($return);
     }
     if ($GLOBALS['ISC_CLASS_DB']->GetErrorMsg() == "") {
         $GLOBALS['ISC_CLASS_DB']->Query("COMMIT");
         return true;
     } else {
         return false;
     }
 }
开发者ID:nirvana-info,项目名称:old_bak,代码行数:96,代码来源:class.returns.php


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