本文整理汇总了PHP中Mage_Sales_Model_Order::getQuoteId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order::getQuoteId方法的具体用法?PHP Mage_Sales_Model_Order::getQuoteId怎么用?PHP Mage_Sales_Model_Order::getQuoteId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order::getQuoteId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: orderSuccessEvent
/**
* Adiciona o Link do meio de pagamento a página de sucesso.
* @param $observer
*/
public function orderSuccessEvent($observer)
{
try {
$order = new Mage_Sales_Model_Order();
$lastOrderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$order->loadByIncrementId($lastOrderId);
$quoteId = $order->getQuoteId();
$quote = Mage::getModel("sales/quote")->loadByIdWithoutStore($quoteId);
$type = null;
$payment_method_bcash = $quote->getPaymentMethodBcash();
if ($payment_method_bcash) {
$helper = new Bcash_Pagamento_Helper_PaymentMethod();
$type = $helper->getPaymentMethod($payment_method_bcash);
}
$layout = Mage::app()->getLayout();
$block = $layout->createBlock('Mage_Core_Block_Template', 'link_pagamento_bcash', array('template' => 'bcash/pagamento/checkout/success.phtml'));
$block->setOrder($order);
$block->setQuote($quote);
$block->setType($type);
$layout->getBlock('content')->append($block);
$bcashTransacation = $order->getTransactionIdBcash();
Mage::helper("bcash")->saveLog("Pedido '" . $lastOrderId . "' realizado com sucesso. Transacao: " . $bcashTransacation);
} catch (Exception $e) {
Mage::helper("bcash")->saveLog($e->getMessage());
}
}
示例2: updateShippingInfo
/**
*
* Update shipping info after notifyRequest
* @param array $data
*/
protected function updateShippingInfo($data)
{
try {
$typeChosen = $data['Shipping']['ShippingType'];
$cost = $data['Shipping']['ShippingCost']['Gross'];
if (!empty($typeChosen)) {
$quote = Mage::getModel('sales/quote')->load($this->_order->getQuoteId());
$address = $quote->getShippingAddress();
$shipping = Mage::getModel('shipping/shipping');
$shippingRates = $shipping->collectRatesByAddress($address)->getResult();
$shippingCostList = array();
foreach ($shippingRates->getAllRates() as $rate) {
$type = $rate->getCarrierTitle() . ' - ' . $rate->getMethodTitle();
if ($type == $typeChosen) {
$this->_order->setShippingDescription($typeChosen);
$this->_order->setShippingMethod($rate->getCarrier() . "_" . $rate->getMethod());
$current = $this->_order->getShippingAmount();
$this->_order->setShippingAmount($cost / 100);
$this->_order->setGrandTotal($this->_order->getGrandTotal() + $this->_order->getShippingAmount() - $current);
$this->_order->save();
}
}
}
} catch (Exception $e) {
Mage::logException("shipping info error: " . $e);
}
}
示例3: _getQuoteFromOrder
/**
* Load a Quote object from an Order object
* @param Mage_Sales_Model_Order $order
* @return Mage_Sales_Model_Quote
*/
protected function _getQuoteFromOrder($order)
{
if (!$this->_quote instanceof Mage_Sales_Model_Quote) {
$this->_quote = Mage::getModel('sales/quote')->load($order->getQuoteId());
}
return $this->_quote;
}
示例4: getNostoId
/**
* Gets the Nosto ID for an order model.
* The Nosto ID represents the customer who placed to the order on Nosto's
* side.
*
* @param Mage_Sales_Model_Order $order the order to get the Nosto ID for.
*
* @return bool|string the Nosto ID or false if not found for order.
*/
public function getNostoId(Mage_Sales_Model_Order $order)
{
/** @var Nosto_Tagging_Model_Customer $customer */
$customer = Mage::getModel('nosto_tagging/customer');
$customer->load($order->getQuoteId(), 'quote_id');
return $customer->hasData('nosto_id') ? $customer->getNostoId() : false;
}
示例5: successAction
public function successAction()
{
$order = new Mage_Sales_Model_Order();
$lastOrderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$order->loadByIncrementId($lastOrderId);
$quoteId = $order->getQuoteId();
$quote = Mage::getModel("sales/quote")->load($quoteId);
try {
$order->setTransactionIdBcash($quote->getTransactionIdBcash())->setStatusBcash($quote->getStatusBcash())->setDescriptionStatusBcash($quote->getDescriptionStatusBcash())->setPaymentLinkBcash($quote->getPaymentLinkBcash())->setPaymentMethodBcash($quote->getPaymentMethodBcash())->setInstallmentsBcash($quote->getInstallmentsBcash());
$order->save();
$order->sendNewOrderEmail();
} catch (Exception $ex) {
}
$type = null;
$payment_method_bcash = $order->getPaymentMethodBcash();
if ($payment_method_bcash) {
$helper = new Bcash_Pagamento_Helper_PaymentMethod();
$type = $helper->getPaymentMethod($payment_method_bcash);
}
$this->loadLayout();
$this->getLayout()->getBlock('root')->setTemplate('page/2columns-right.phtml');
$block = $this->getLayout()->createBlock('Mage_Core_Block_Template', 'link_pagamento_bcash', array('template' => 'bcash/pagamento/checkout/success.phtml'));
$block->setOrder($order);
$block->setQuote($quote);
$block->setType($type);
$this->getLayout()->getBlock('content')->append($block);
$this->_initLayoutMessages('checkout/session');
Mage::dispatchEvent('checkout_onepage_controller_success_action', array('order_ids' => array($lastOrderId)));
$this->renderLayout();
}
示例6: getQuoteByOrder
/**
* Get quote model by order
*
* @param Mage_Sales_Model_Order $order
* @return boolean|Mage_Sales_Model_Quote
*/
public function getQuoteByOrder(Mage_Sales_Model_Order $order)
{
$quoteId = $order->getQuoteId();
$storeId = $order->getStoreId();
$this->checkQuoteItems($quoteId, $order);
$quote = Mage::getModel('sales/quote')->setStoreId($storeId)->load($quoteId);
return $quote;
}
示例7: _prepareOrderData
/**
* @return array
*/
protected function _prepareOrderData()
{
// magento 1.5 compat
$shipping_method_c = $this->_order->getShippingMethod(true);
$shipping_method = $this->_order->getData('shipping_method');
$shipping_method_code = $shipping_method_c ? $shipping_method_c->getData('carrier_code') : $shipping_method;
$data = array_filter(array('currency_code' => $this->_order->getOrderCurrencyCode(), 'shipping_method_code' => $shipping_method_code, 'shipping_method_title' => $this->_order->getShippingDescription(), 'created_on' => $this->_order->getCreatedAt(), 'updated_on' => $this->_order->getUpdatedAt(), 'state' => $this->_order->getState(), 'status' => $this->_order->getStatus(), 'is_gift' => $this->_order->getGiftMessageId() != null, 'ref_quote_id' => $this->_order->getQuoteId(), 'order_subtotal_with_tax' => $this->_order->getSubtotalInclTax(), 'order_subtotal' => $this->_order->getSubtotal(), 'order_tax' => $this->_order->getTaxAmount(), 'order_hidden_tax' => $this->_order->getHiddenTaxAmount(), 'order_shipping_with_tax' => $this->_order->getShippingInclTax(), 'order_shipping' => $this->_order->getShippingAmount(), 'order_discount' => $this->_order->getDiscountAmount(), 'order_shipping_discount' => $this->_order->getShippingDiscountAmount(), 'order_total' => $this->_order->getGrandTotal(), 'order_total_items' => $this->_order->getTotalItemCount()));
return $data;
}
示例8: prepateWithOrder
/**
* Adds information to based on the order object inside magento
*
* @param Mage_Sales_Model_Order $order
* @return Bitpay_Core_Model_Invoice
*/
public function prepateWithOrder($order)
{
if (false === isset($order) || true === empty($order)) {
\Mage::helper('bitpay')->debugData('[ERROR] In Bitpay_Core_Model_Invoice::prepateWithOrder(): Missing or empty $order parameter.');
throw new \Exception('In Bitpay_Core_Model_Invoice::prepateWithOrder(): Missing or empty $order parameter.');
}
$this->addData(array('quote_id' => $order->getQuoteId(), 'increment_id' => $order->getIncrementId()));
return $this;
}
示例9: setUp
public function setUp()
{
parent::setUp();
$order = new Mage_Sales_Model_Order();
$order->load('100000001', 'increment_id');
$order->getPayment()->setMethod(Mage_Paypal_Model_Config::METHOD_PAYFLOWLINK);
$order->save();
$session = Mage::getSingleton('Mage_Checkout_Model_Session');
$session->setLastRealOrderId($order->getRealOrderId())->setLastQuoteId($order->getQuoteId());
}
示例10: testRedirectActionIsContentGenerated
public function testRedirectActionIsContentGenerated()
{
$order = new Mage_Sales_Model_Order();
$order->load('100000001', 'increment_id');
$order->getPayment()->setMethod(Mage_Paypal_Model_Config::METHOD_WPS);
$order->save();
$session = Mage::getSingleton('Mage_Checkout_Model_Session');
$session->setLastRealOrderId($order->getRealOrderId())->setLastQuoteId($order->getQuoteId());
$this->dispatch('paypal/standard/redirect');
$this->assertContains('<form action="https://www.paypal.com/webscr" id="paypal_standard_checkout"' . ' name="paypal_standard_checkout" method="POST">', $this->getResponse()->getBody());
}
示例11: testCancelActionIsContentGenerated
public function testCancelActionIsContentGenerated()
{
$order = new Mage_Sales_Model_Order();
$order->load('100000001', 'increment_id');
$order->getPayment()->setMethod(Mage_Paypal_Model_Config::METHOD_HOSTEDPRO);
$order->save();
$session = Mage::getSingleton('Mage_Checkout_Model_Session');
$session->setLastRealOrderId($order->getRealOrderId())->setLastQuoteId($order->getQuoteId());
$this->dispatch('paypal/hostedpro/cancel');
$this->assertContains('window.top.checkout.gotoSection("payment");', $this->getResponse()->getBody());
$this->assertContains('window.top.document.getElementById(\'checkout-review-submit\').show();', $this->getResponse()->getBody());
$this->assertContains('window.top.document.getElementById(\'iframe-warning\').hide();', $this->getResponse()->getBody());
}
示例12: _setCheckoutInfoFromOldOrder
/**
* Coge las billing y shipping address de la ultima order
* el checkout method y shipping method
* y las vuelve a meter en quote actual para que el checkout
* pueda tener las direcciones pre-populadas.
*
* @param Mage_Sales_Model_Order $order
*/
protected function _setCheckoutInfoFromOldOrder(Mage_Sales_Model_Order $order)
{
$checkoutSession = $this->getCheckoutSession();
$quote = $checkoutSession->getQuote();
$oldQuote = Mage::getModel('sales/quote')->load($order->getQuoteId());
$quote->setCheckoutMethod($oldQuote->getCheckoutMethod());
if ($oldQuote->getId()) {
$billingAddress = clone $oldQuote->getBillingAddress();
$billingAddress->setQuote($quote);
$shippingAddress = clone $oldQuote->getShippingAddress();
$shippingAddress->setQuote($quote);
$quote->removeAddress($quote->getBillingAddress()->getId());
$quote->removeAddress($quote->getShippingAddress()->getId());
$quote->setBillingAddress($billingAddress);
$quote->setShippingAddress($shippingAddress);
}
$quote->save();
return $this;
}
示例13: setDataFromOrder
/**
* Set entity data to request
*
* @param Mage_Sales_Model_Order $order
* @param Mage_Authorizenet_Model_Directpost $paymentMethod
* @return Mage_Authorizenet_Model_Directpost_Request
*/
public function setDataFromOrder(Mage_Sales_Model_Order $order, Mage_Authorizenet_Model_Directpost $paymentMethod)
{
$payment = $order->getPayment();
$this->setXFpSequence($order->getQuoteId());
$this->setXInvoiceNum($order->getIncrementId());
$this->setXAmount($payment->getBaseAmountAuthorized());
$this->setXCurrencyCode($order->getBaseCurrencyCode());
$this->setXTax(sprintf('%.2F', $order->getBaseTaxAmount()))->setXFreight(sprintf('%.2F', $order->getBaseShippingAmount()));
//need to use strval() because NULL values IE6-8 decodes as "null" in JSON in JavaScript, but we need "" for null values.
$billing = $order->getBillingAddress();
if (!empty($billing)) {
$this->setXFirstName(strval($billing->getFirstname()))->setXLastName(strval($billing->getLastname()))->setXCompany(strval($billing->getCompany()))->setXAddress(strval($billing->getStreet(1)))->setXCity(strval($billing->getCity()))->setXState(strval($billing->getRegion()))->setXZip(strval($billing->getPostcode()))->setXCountry(strval($billing->getCountry()))->setXPhone(strval($billing->getTelephone()))->setXFax(strval($billing->getFax()))->setXCustId(strval($billing->getCustomerId()))->setXCustomerIp(strval($order->getRemoteIp()))->setXCustomerTaxId(strval($billing->getTaxId()))->setXEmail(strval($order->getCustomerEmail()))->setXEmailCustomer(strval($paymentMethod->getConfigData('email_customer')))->setXMerchantEmail(strval($paymentMethod->getConfigData('merchant_email')));
}
$shipping = $order->getShippingAddress();
if (!empty($shipping)) {
$this->setXShipToFirstName(strval($shipping->getFirstname()))->setXShipToLastName(strval($shipping->getLastname()))->setXShipToCompany(strval($shipping->getCompany()))->setXShipToAddress(strval($shipping->getStreet(1)))->setXShipToCity(strval($shipping->getCity()))->setXShipToState(strval($shipping->getRegion()))->setXShipToZip(strval($shipping->getPostcode()))->setXShipToCountry(strval($shipping->getCountry()));
}
$this->setXPoNum(strval($payment->getPoNumber()));
return $this;
}
示例14: _processOrder
/**
* Operate with order using information from silent post
*
* @param Mage_Sales_Model_Order $order
*/
protected function _processOrder(Mage_Sales_Model_Order $order)
{
$response = $this->getResponse();
$payment = $order->getPayment();
$payment->setTransactionId($response->getPnref())->setIsTransactionClosed(0);
$canSendNewOrderEmail = true;
if ($response->getResult() == self::RESPONSE_CODE_FRAUDSERVICE_FILTER || $response->getResult() == self::RESPONSE_CODE_DECLINED_BY_FILTER) {
$canSendNewOrderEmail = false;
$fraudMessage = $this->_getFraudMessage() ? $response->getFraudMessage() : $response->getRespmsg();
$payment->setIsTransactionPending(true)->setIsFraudDetected(true)->setAdditionalInformation('paypal_fraud_filters', $fraudMessage);
}
if ($response->getAvsdata() && strstr(substr($response->getAvsdata(), 0, 2), 'N')) {
$payment->setAdditionalInformation('paypal_avs_code', substr($response->getAvsdata(), 0, 2));
}
if ($response->getCvv2match() && $response->getCvv2match() != 'Y') {
$payment->setAdditionalInformation('paypal_cvv2_match', $response->getCvv2match());
}
switch ($response->getType()) {
case self::TRXTYPE_AUTH_ONLY:
$payment->registerAuthorizationNotification($payment->getBaseAmountAuthorized());
break;
case self::TRXTYPE_SALE:
$payment->registerCaptureNotification($payment->getBaseAmountAuthorized());
break;
}
$order->save();
try {
if ($canSendNewOrderEmail) {
$order->queueNewOrderEmail();
}
Mage::getModel('sales/quote')->load($order->getQuoteId())->setIsActive(false)->save();
} catch (Exception $e) {
Mage::throwException(Mage::helper('paypal')->__('Can not send new order email.'));
}
}
示例15: __construct
/**
* set the order information
* @param Mage_Sales_Model_Order $orderData
*/
public function __construct(Mage_Sales_Model_Order $orderData)
{
$customerModel = Mage::getModel('customer/customer');
$customerModel->load($orderData->getCustomerId());
$this->id = $orderData->getIncrementId();
$this->quote_id = $orderData->getQuoteId();
$this->email = $orderData->getCustomerEmail();
$this->store_name = $orderData->getStoreName();
$created_at = new Zend_Date($orderData->getCreatedAt(), Zend_Date::ISO_8601);
$this->purchase_date = $created_at->toString(Zend_Date::ISO_8601);
$this->delivery_method = $orderData->getShippingDescription();
$this->delivery_total = $orderData->getShippingAmount();
$this->currency = $orderData->getStoreCurrencyCode();
if ($payment = $orderData->getPayment()) {
$this->payment = $payment->getMethodInstance()->getTitle();
}
$this->couponCode = $orderData->getCouponCode();
/**
* custom order attributes
*/
$helper = Mage::helper('ddg');
$website = Mage::app()->getStore($orderData->getStore())->getWebsite();
$customAttributes = $helper->getConfigSelectedCustomOrderAttributes($website);
if ($customAttributes) {
$fields = Mage::getResourceModel('ddg_automation/order')->getOrderTableDescription();
foreach ($customAttributes as $customAttribute) {
if (isset($fields[$customAttribute])) {
$field = $fields[$customAttribute];
$value = $this->_getCustomAttributeValue($field, $orderData);
if ($value) {
$this->_assignCustom($field, $value);
}
}
}
}
/**
* Billing address.
*/
if ($orderData->getBillingAddress()) {
$billingData = $orderData->getBillingAddress()->getData();
$this->billing_address = array('billing_address_1' => $this->_getStreet($billingData['street'], 1), 'billing_address_2' => $this->_getStreet($billingData['street'], 2), 'billing_city' => $billingData['city'], 'billing_region' => $billingData['region'], 'billing_country' => $billingData['country_id'], 'billing_postcode' => $billingData['postcode']);
}
/**
* Shipping address.
*/
if ($orderData->getShippingAddress()) {
$shippingData = $orderData->getShippingAddress()->getData();
$this->delivery_address = array('delivery_address_1' => $this->_getStreet($shippingData['street'], 1), 'delivery_address_2' => $this->_getStreet($shippingData['street'], 2), 'delivery_city' => $shippingData['city'], 'delivery_region' => $shippingData['region'], 'delivery_country' => $shippingData['country_id'], 'delivery_postcode' => $shippingData['postcode']);
}
$syncCustomOption = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_SYNC_ORDER_PRODUCT_CUSTOM_OPTIONS, $website);
/**
* Order items.
* @var Mage_Sales_Model_Order_Item $productItem
*/
foreach ($orderData->getAllItems() as $productItem) {
//product custom options
$customOptions = array();
if ($syncCustomOption) {
$customOptions = $this->_getOrderItemOptions($productItem);
}
$product = $productItem->getProduct();
if ($product) {
// category names
$categoryCollection = $product->getCategoryCollection()->addAttributeToSelect('name');
$productCat = array();
foreach ($categoryCollection as $cat) {
$categories = array();
$categories[] = $cat->getName();
$productCat[]['Name'] = substr(implode(', ', $categories), 0, 244);
}
$attributes = array();
//selected attributes from config
$configAttributes = Mage::helper('ddg')->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_SYNC_ORDER_PRODUCT_ATTRIBUTES, $orderData->getStore()->getWebsite());
if ($configAttributes) {
$configAttributes = explode(',', $configAttributes);
//attributes from attribute set
$attributesFromAttributeSet = $this->_getAttributesArray($product->getAttributeSetId());
foreach ($configAttributes as $attribute_code) {
//if config attribute is in attribute set
if (in_array($attribute_code, $attributesFromAttributeSet)) {
//attribute input type
$inputType = $product->getResource()->getAttribute($attribute_code)->getFrontend()->getInputType();
//fetch attribute value from product depending on input type
switch ($inputType) {
case 'multiselect':
case 'select':
case 'dropdown':
$value = $product->getAttributeText($attribute_code);
break;
default:
$value = $product->getData($attribute_code);
break;
}
if ($value) {
// check limit on text and assign value to array
$attributes[][$attribute_code] = $this->_limitLength($value);
//.........这里部分代码省略.........