本文整理汇总了PHP中Mage_Sales_Model_Quote::getReservedOrderId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote::getReservedOrderId方法的具体用法?PHP Mage_Sales_Model_Quote::getReservedOrderId怎么用?PHP Mage_Sales_Model_Quote::getReservedOrderId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Quote
的用法示例。
在下文中一共展示了Mage_Sales_Model_Quote::getReservedOrderId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initCheckout
/**
* Prepare quote, reserve order ID for specified quote
*
* @return string
*/
public function initCheckout()
{
$this->_quote->reserveOrderId()->save();
/**
* Reset multishipping flag before any manipulations with quote address
* addAddress method for quote object related on this flag
*/
if ($this->_quote->getIsMultiShipping()) {
$this->_quote->setIsMultiShipping(false);
$this->_quote->save();
}
/*
* want to load the correct customer information by assigning to address
* instead of just loading from sales/quote_address
*/
$customer = Mage::getSingleton('Mage_Customer_Model_Session')->getCustomer();
if ($customer) {
$this->_quote->assignCustomer($customer);
}
$quote = Mage::getSingleton('Mage_Checkout_Model_Session')->getQuote();
if (!Mage::getSingleton('Mage_Customer_Model_Session')->isLoggedIn() && Mage::helper('Mage_Checkout_Helper_Data')->isAllowedGuestCheckout($quote)) {
$this->_prepareGuestQuote();
}
return $this->_quote->getReservedOrderId();
}
示例2: start
/**
* Reserve order ID for specified quote and start checkout on PayPal
* @return string
*/
public function start($returnUrl, $cancelUrl)
{
$this->_quote->reserveOrderId()->save();
// prepare API
$this->_getApi();
$this->_api->setAmount($this->_quote->getBaseGrandTotal())->setCurrencyCode($this->_quote->getBaseCurrencyCode())->setInvNum($this->_quote->getReservedOrderId())->setReturnUrl($returnUrl)->setCancelUrl($cancelUrl)->setSolutionType($this->_config->solutionType)->setPaymentAction($this->_config->paymentAction);
// supress or export shipping address
if ($this->_quote->getIsVirtual()) {
$this->_api->setSuppressShipping(true);
} else {
$address = $this->_quote->getShippingAddress();
$isOverriden = 0;
if (true === $address->validate()) {
$isOverriden = 1;
$this->_api->setAddress($address);
}
$this->_quote->getPayment()->setAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_SHIPPING_OVERRIDEN, $isOverriden);
$this->_quote->getPayment()->save();
}
// add line items
if ($this->_config->lineItemsEnabled) {
list($items, $totals) = Mage::helper('paypal')->prepareLineItems($this->_quote);
$this->_api->setLineItems($items)->setLineItemTotals($totals);
}
$this->_config->exportExpressCheckoutStyleSettings($this->_api);
// call API and redirect with token
$this->_api->callSetExpressCheckout();
$token = $this->_api->getToken();
$this->_redirectUrl = $this->_config->getExpressCheckoutStartUrl($token);
return $token;
}
示例3: toOrder
/**
* Convert quote model to order model
*
* @param Mage_Sales_Model_Quote $quote
* @return Mage_Sales_Model_Order
*/
public function toOrder(Mage_Sales_Model_Quote $quote, $order = null)
{
if (!$order instanceof Mage_Sales_Model_Order) {
$order = Mage::getModel('sales/order');
}
/* @var $order Mage_Sales_Model_Order */
$order->setIncrementId($quote->getReservedOrderId())->setStoreId($quote->getStoreId())->setQuoteId($quote->getId())->setCustomer($quote->getCustomer());
Mage::helper('core')->copyFieldset('sales_convert_quote', 'to_order', $quote, $order);
Mage::dispatchEvent('sales_convert_quote_to_order', array('order' => $order, 'quote' => $quote));
return $order;
}
示例4: toOrder
/**
* Convert quote model to order model
*
* @param Mage_Sales_Model_Quote $quote
* @return Mage_Sales_Model_Order
*/
public function toOrder(Mage_Sales_Model_Quote $quote, $order = null)
{
if (!$order instanceof Mage_Sales_Model_Order) {
$order = Mage::getModel('sales/order');
}
/* @var $order Mage_Sales_Model_Order */
$order->setIncrementId($quote->getReservedOrderId())->setStoreId($quote->getStoreId())->setQuoteId($quote->getId());
Mage::helper('core')->copyFieldset('sales_convert_quote', 'to_order', $quote, $order);
if (!$quote->getCustomerId()) {
$order->setCustomerId(null);
}
//
// ->setRemoteIp($quote->getRemoteIp())
//
// /**
// * Customer data
// */
// ->setCustomerId($quote->getCustomerId())
// ->setCustomerEmail($quote->getCustomerEmail())
// ->setCustomerPrefix($quote->getCustomerPrefix())
// ->setCustomerFirstname($quote->getCustomerFirstname())
// ->setCustomerMiddlename($quote->getCustomerMiddlename())
// ->setCustomerLastname($quote->getCustomerLastname())
// ->setCustomerSuffix($quote->getCustomerSuffix())
// ->setCustomerGroupId($quote->getCustomerGroupId())
// ->setCustomerTaxClassId($quote->getCustomerTaxClassId())
// ->setCustomerNote($quote->getCustomerNote())
// ->setCustomerNoteNotify($quote->getCustomerNoteNotify())
// ->setCustomerIsGuest($quote->getCustomerIsGuest())
// ->setCustomerDob($quote->getCustomerDob())
//
// /**
// * Currency data
// */
// ->setBaseCurrencyCode($quote->getBaseCurrencyCode())
// ->setStoreCurrencyCode($quote->getStoreCurrencyCode())
// ->setOrderCurrencyCode($quote->getQuoteCurrencyCode())
// ->setStoreToBaseRate($quote->getStoreToBaseRate())
// ->setStoreToOrderRate($quote->getStoreToQuoteRate())
//
// /**
// * Another data
// */
// ->setCouponCode($quote->getCouponCode())
// ->setGiftcertCode($quote->getGiftcertCode())
// ->setIsVirtual($quote->getIsVirtual())
// ->setIsMultiPayment($quote->getIsMultiPayment())
// ->setAppliedRuleIds($quote->getAppliedRuleIds());
Mage::dispatchEvent('sales_convert_quote_to_order', array('order' => $order, 'quote' => $quote));
return $order;
}
示例5: prepareOrderNumber
private function prepareOrderNumber()
{
if ($this->proxyOrder->isOrderNumberPrefixSourceChannel()) {
$orderNumber = $this->addPrefixToOrderNumberIfNeed($this->proxyOrder->getChannelOrderNumber());
if (Mage::helper('M2ePro/Magento')->isMagentoOrderIdUsed($orderNumber)) {
$orderNumber .= '(1)';
}
$this->quote->setReservedOrderId($orderNumber);
return;
}
$orderNumber = $this->quote->getReservedOrderId();
if (empty($orderNumber)) {
$orderNumber = $this->quote->getResource()->getReservedOrderId($this->quote);
}
$orderNumber = $this->addPrefixToOrderNumberIfNeed($orderNumber);
if ($this->quote->getResource()->isOrderIncrementIdUsed($orderNumber)) {
$orderNumber = $this->quote->getResource()->getReservedOrderId($this->quote);
}
$this->quote->setReservedOrderId($orderNumber);
}
示例6: start
/**
* Reserve order ID for specified quote and start checkout on PayPal
* @return string
*/
public function start($returnUrl, $cancelUrl)
{
$this->_quote->reserveOrderId()->save();
// prepare API
$this->_getApi();
$this->_api->setAmount($this->_quote->getBaseGrandTotal())->setCurrencyCode($this->_quote->getBaseCurrencyCode())->setInvNum($this->_quote->getReservedOrderId())->setReturnUrl($returnUrl)->setCancelUrl($cancelUrl)->setSolutionType($this->_config->solutionType)->setPaymentAction($this->_config->paymentAction);
if ($this->_giropayUrls) {
list($successUrl, $cancelUrl, $pendingUrl) = $this->_giropayUrls;
$this->_api->addData(array('giropay_cancel_url' => $cancelUrl, 'giropay_success_url' => $successUrl, 'giropay_bank_txn_pending_url' => $pendingUrl));
}
// supress or export shipping address
if ($this->_quote->getIsVirtual()) {
$this->_api->setSuppressShipping(true);
} else {
$address = $this->_quote->getShippingAddress();
$isOverriden = 0;
if (true === $address->validate()) {
$isOverriden = 1;
$this->_api->setAddress($address);
}
$this->_quote->getPayment()->setAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_SHIPPING_OVERRIDEN, $isOverriden);
$this->_quote->getPayment()->save();
}
// add line items
if ($this->_config->lineItemsEnabled && Mage::helper('paypal')->doLineItemsMatchAmount($this->_quote, $this->_quote->getBaseGrandTotal())) {
//For transfering line items order amount must be equal to cart total amount
list($items, $totals) = Mage::helper('paypal')->prepareLineItems($this->_quote);
$this->_api->setLineItems($items)->setLineItemTotals($totals);
}
$this->_config->exportExpressCheckoutStyleSettings($this->_api);
// call API and redirect with token
$this->_api->callSetExpressCheckout();
$token = $this->_api->getToken();
$this->_redirectUrl = $this->_config->getExpressCheckoutStartUrl($token);
return $token;
}
示例7: getOrderId
/**
* Returns the reserved order id
* @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $object
* @return String OrderId
*/
public function getOrderId($object)
{
$orderId = null;
if ($object instanceof Mage_Sales_Model_Order) {
$orderId = $object->getIncrementId();
}
if ($object instanceof Mage_Sales_Model_Quote) {
$orderId = $object->getReservedOrderId();
}
return $orderId;
}