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


PHP Mage_Sales_Model_Quote::getId方法代码示例

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


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

示例1: _updateQuote

 protected function _updateQuote(Mage_Sales_Model_Quote $quote)
 {
     if (!Mage::helper('recapture')->isEnabled()) {
         return $this;
     }
     if (!$quote->getId()) {
         return;
     }
     //sales_quote_save_before gets called like 5 times on some page loads, we don't want to do 5 updates per page load
     if (Mage::registry('recapture_has_posted')) {
         return;
     }
     Mage::register('recapture_has_posted', true);
     $mediaConfig = Mage::getModel('catalog/product_media_config');
     $storeId = Mage::app()->getStore();
     $transportData = array('first_name' => $quote->getCustomerFirstname(), 'last_name' => $quote->getCustomerLastname(), 'email' => $quote->getCustomerEmail(), 'external_id' => $quote->getId(), 'grand_total' => $quote->getGrandTotal(), 'products' => array(), 'totals' => array());
     $cartItems = $quote->getAllVisibleItems();
     foreach ($cartItems as $item) {
         $productModel = $item->getProduct();
         $productImage = (string) Mage::helper('catalog/image')->init($productModel, 'thumbnail');
         //check configurable first
         if ($item->getProductType() == 'configurable') {
             if (Mage::getStoreConfig('checkout/cart/configurable_product_image') == 'itself') {
                 $child = $productModel->getIdBySku($item->getSku());
                 $image = Mage::getResourceModel('catalog/product')->getAttributeRawValue($child, 'thumbnail', $storeId);
                 if ($image) {
                     $productImage = $mediaConfig->getMediaUrl($image);
                 }
             }
         }
         //then check grouped
         if (Mage::getStoreConfig('checkout/cart/grouped_product_image') == 'parent') {
             $options = $productModel->getTypeInstance(true)->getOrderOptions($productModel);
             if (isset($options['super_product_config']) && $options['super_product_config']['product_type'] == 'grouped') {
                 $parent = $options['super_product_config']['product_id'];
                 $image = Mage::getResourceModel('catalog/product')->getAttributeRawValue($parent, 'thumbnail', $storeId);
                 $productImage = $mediaConfig->getMediaUrl($image);
             }
         }
         $optionsHelper = Mage::helper('catalog/product_configuration');
         if ($item->getProductType() == 'configurable') {
             $visibleOptions = $optionsHelper->getConfigurableOptions($item);
         } else {
             $visibleOptions = $optionsHelper->getCustomOptions($item);
         }
         $product = array('name' => $item->getName(), 'sku' => $item->getSku(), 'price' => $item->getPrice(), 'qty' => $item->getQty(), 'image' => $productImage, 'options' => $visibleOptions);
         $transportData['products'][] = $product;
     }
     $totals = $quote->getTotals();
     foreach ($totals as $total) {
         //we pass grand total on the top level
         if ($total->getCode() == 'grand_total') {
             continue;
         }
         $total = array('name' => $total->getTitle(), 'amount' => $total->getValue());
         $transportData['totals'][] = $total;
     }
     Mage::helper('recapture/transport')->dispatch('cart', $transportData);
     return $this;
 }
开发者ID:recaptureio,项目名称:magento_connector,代码行数:60,代码来源:Observer.php

示例2: setQuote

 /**
  * Set Quote object to Collection
  *
  * @param Mage_Sales_Model_Quote $quote
  * @return Mage_Sales_Model_Resource_Quote_Item_Collection
  */
 public function setQuote($quote)
 {
     $this->_quote = $quote;
     $quoteId = $quote->getId();
     if ($quoteId) {
         $this->addFieldToFilter('quote_id', $quote->getId());
     } else {
         $this->_totalRecords = 0;
         $this->_setIsLoaded(true);
     }
     return $this;
 }
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:18,代码来源:Collection.php

示例3: getQuote

 /**
  * Retrieve quote model object
  *
  * @return Mage_Sales_Model_Quote
  */
 public function getQuote()
 {
     if (is_null($this->_quote)) {
         $this->_quote = Mage::getModel('sales/quote');
         if ($this->getStoreId() && $this->getQuoteId()) {
             $this->_quote->setStoreId($this->getStoreId())->load($this->getQuoteId());
         } elseif ($this->getStoreId() && $this->hasCustomerId()) {
             $this->_quote->setStoreId($this->getStoreId())->setCustomerGroupId(Mage::getStoreConfig(self::XML_PATH_DEFAULT_CREATEACCOUNT_GROUP))->assignCustomer($this->getCustomer())->setIsActive(false)->save();
             $this->setQuoteId($this->_quote->getId());
         }
         $this->_quote->setIgnoreOldQty(true);
         $this->_quote->setIsSuperMode(true);
     }
     return $this->_quote;
 }
开发者ID:HelioFreitas,项目名称:magento-pt_br,代码行数:20,代码来源:Quote.php

示例4: getQuote

 /**
  * Retrieve quote model object
  *
  * @return Mage_Sales_Model_Quote
  */
 public function getQuote()
 {
     if (is_null($this->_quote)) {
         $this->_quote = Mage::getModel('sales/quote');
         if ($this->getStoreId() && $this->getQuoteId()) {
             $this->_quote->setStoreId($this->getStoreId())->load($this->getQuoteId());
         } elseif ($this->getStoreId()) {
             $this->_quote->setStoreId($this->getStoreId())->assignCustomer($this->getCustomer())->setIsActive(false)->save();
             $this->setQuoteId($this->_quote->getId());
         }
         $this->_quote->setIgnoreOldQty(true);
         $this->_quote->setIsSuperMode(true);
     }
     return $this->_quote;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:20,代码来源:Quote.php

示例5: setUp

 protected function setUp()
 {
     parent::setUp();
     $quote = new Mage_Sales_Model_Quote();
     $quote->load('test01', 'reserved_order_id');
     Mage::getSingleton('Mage_Checkout_Model_Session')->setQuoteId($quote->getId());
 }
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:7,代码来源:OnepageController.php

示例6: 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->setStoreId($quote->getStoreId())->setQuoteId($quote->getId())->setRemoteIp($quote->getRemoteIp())->setCustomerId($quote->getCustomerId())->setCustomerEmail($quote->getCustomerEmail())->setCustomerFirstname($quote->getCustomerFirstname())->setCustomerLastname($quote->getCustomerLastname())->setCustomerGroupId($quote->getCustomerGroupId())->setCustomerTaxClassId($quote->getCustomerTaxClassId())->setCustomerNote($quote->getCustomerNote())->setCustomerNoteNotify($quote->getCustomerNoteNotify())->setCustomerIsGuest($quote->getCustomerIsGuest())->setBaseCurrencyCode($quote->getBaseCurrencyCode())->setStoreCurrencyCode($quote->getStoreCurrencyCode())->setOrderCurrencyCode($quote->getQuoteCurrencyCode())->setStoreToBaseRate($quote->getStoreToBaseRate())->setStoreToOrderRate($quote->getStoreToQuoteRate())->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;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:16,代码来源:Quote.php

示例7: 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;
 }
开发者ID:codercv,项目名称:urbansurprisedev,代码行数:17,代码来源:Quote.php

示例8: testReviewAction

 /**
  * @magentoDataFixture Mage/Sales/_files/quote.php
  * @magentoDataFixture Mage/Paypal/_files/quote_payment.php
  */
 public function testReviewAction()
 {
     $quote = new Mage_Sales_Model_Quote();
     $quote->load('test01', 'reserved_order_id');
     Mage::getSingleton('Mage_Checkout_Model_Session')->setQuoteId($quote->getId());
     $this->dispatch('paypal/express/review');
     $html = $this->getResponse()->getBody();
     $this->assertContains('Simple Product', $html);
     $this->assertContains('Review', $html);
     $this->assertContains('/paypal/express/placeOrder/', $html);
 }
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:15,代码来源:ExpressController.php

示例9: reactivateQuote

 /**
  * @param Mage_Sales_Model_Quote $quote
  */
 protected function reactivateQuote(Mage_Sales_Model_Quote $quote)
 {
     if ($quote->getId()) {
         /* @note: Reset reserved_order_id, Magento up to and including version 1.7 has a bug in Mage_Sales_Model_Resource_Quote::isOrderIncrementIdUsed()
          * They cast the orderIncrementId to (int), which breaks the checkout/cart for all non-numerical incrementIds
          * (Causes Integrity Constraint Violation, because orderIncrementId already exists */
         $quote->setIsActive(1)->setReservedOrderId(null)->save();
         $oSession = Mage::getSingleton('checkout/session');
         $oSession->replaceQuote($quote)->unsLastRealOrderId();
     }
 }
开发者ID:kirchbergerknorr,项目名称:Payone_Core,代码行数:14,代码来源:CartController.php

示例10: testOverviewAction

 /**
  * Covers app/code/core/Mage/Checkout/Block/Multishipping/Payment/Info.php
  * and app/code/core/Mage/Checkout/Block/Multishipping/Overview.php
  *
  * @magentoDataFixture Mage/Sales/_files/quote.php
  * @magentoDataFixture Mage/Customer/_files/customer.php
  */
 public function testOverviewAction()
 {
     $quote = new Mage_Sales_Model_Quote();
     $quote->load('test01', 'reserved_order_id');
     Mage::getSingleton('Mage_Checkout_Model_Session')->setQuoteId($quote->getId());
     $session = new Mage_Customer_Model_Session();
     $session->login('customer@example.com', 'password');
     $this->getRequest()->setPost('payment', array('method' => 'checkmo'));
     $this->dispatch('checkout/multishipping/overview');
     $html = $this->getResponse()->getBody();
     $this->assertContains('<p>' . $quote->getPayment()->getMethodInstance()->getTitle() . '</p>', $html);
     $this->assertContains('<span class="price">$10.00</span>', $html);
 }
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:20,代码来源:MultishippingController.php

示例11: 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;
 }
开发者ID:jauderho,项目名称:magento-mirror,代码行数:57,代码来源:Quote.php

示例12: getCustomerCart

 /**
  * Retrieve customer cart quote object model
  *
  * @return Mage_Sales_Model_Quote
  */
 public function getCustomerCart()
 {
     if (!is_null($this->_cart)) {
         return $this->_cart;
     }
     $this->_cart = Mage::getModel('sales/quote');
     if ($this->getSession()->getCustomer()->getId()) {
         $this->_cart->setStore($this->getSession()->getStore())->loadByCustomer($this->getSession()->getCustomer()->getId());
         if (!$this->_cart->getId()) {
             $this->_cart->assignCustomer($this->getSession()->getCustomer());
             $this->_cart->save();
         }
     }
     return $this->_cart;
 }
开发者ID:beejhuff,项目名称:magento-1.13.0.2,代码行数:20,代码来源:Create.php

示例13: getAlias

 /**
  * get alias or generate a new one
  *
  * alias has length 16 and consists of quote creation date, a separator,
  * and the quote id to make sure we have the full quote id we shorten
  * the creation date accordingly
  *
  * @param Mage_Sales_Model_Quote $quote
  *
  * @return string
  */
 public function getAlias($quote)
 {
     $alias = $quote->getPayment()->getAdditionalInformation('alias');
     if (0 == strlen($alias)) {
         /* turn createdAt into format MMDDHHii */
         $createdAt = substr(str_replace(array(':', '-', ' '), '', $quote->getCreatedAt()), 4, -2);
         $quoteId = $quote->getId();
         /* shorten createdAt, if we would exceed maximum length */
         $maxAliasLength = 16;
         $separator = '99';
         $maxCreatedAtLength = $maxAliasLength - strlen($quoteId) - strlen($separator);
         $alias = substr($createdAt, 0, $maxCreatedAtLength) . $separator . $quoteId;
     }
     if ($this->isAdminSession() && !strpos($alias, 'BE')) {
         $alias = $alias . 'BE';
     }
     return $alias;
 }
开发者ID:roshu1980,项目名称:add-computers,代码行数:29,代码来源:Alias.php

示例14: saveOrder

 /**
  * Place the order when customer returned from paypal
  * Until this moment all quote data must be valid
  *
  * @return array
  */
 public function saveOrder()
 {
     $this->_ignoreAddressValidation();
     $order = Mage::getModel('sales/service_quote', $this->_quote)->submit();
     $this->_quote->save();
     /**
      * Prepare session to success or cancellation page
      */
     $quoteId = $this->_quote->getId();
     $this->_getCheckoutSession()->setLastQuoteId($quoteId)->setLastSuccessQuoteId($quoteId)->setLastOrderId($order->getId())->setLastRealOrderId($order->getIncrementId());
     if ($order->getState() == Mage_Sales_Model_Order::STATE_PROCESSING) {
         try {
             $order->sendNewOrderEmail();
         } catch (Exception $e) {
             Mage::logException($e);
         }
     }
     return array();
 }
开发者ID:xiaoguizhidao,项目名称:emporiodopara,代码行数:25,代码来源:Checkout.php

示例15: _addCustomer

 /**
  * Sets the customer info if available
  *
  * @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $object
  * @return $this
  */
 protected function _addCustomer($object)
 {
     $format = Mage::getStoreConfig('tax/avatax/cust_code_format', $object->getStoreId());
     $customer = Mage::getModel('customer/customer');
     if ($object->getCustomerId()) {
         $customer->load($object->getCustomerId());
         $taxClass = Mage::getModel('tax/class')->load($customer->getTaxClassId())->getOpAvataxCode();
         $this->_request->setCustomerUsageType($taxClass);
     }
     switch ($format) {
         case OnePica_AvaTax_Model_Source_Customercodeformat::LEGACY:
             if ($customer->getId()) {
                 $customerCode = $customer->getName() . ' (' . $customer->getId() . ')';
             } else {
                 $address = $object->getBillingAddress() ? $object->getBillingAddress() : $object;
                 $customerCode = $address->getFirstname() . ' ' . $address->getLastname() . ' (Guest)';
             }
             break;
         case OnePica_AvaTax_Model_Source_Customercodeformat::CUST_EMAIL:
             $customerCode = $object->getCustomerEmail() ? $object->getCustomerEmail() : $customer->getEmail();
             break;
         case OnePica_AvaTax_Model_Source_Customercodeformat::CUST_ID:
         default:
             $customerCode = $object->getCustomerId() ? $object->getCustomerId() : 'guest-' . $object->getId();
             break;
     }
     $this->_request->setCustomerCode($customerCode);
     return $this;
 }
开发者ID:virtual97,项目名称:avatax,代码行数:35,代码来源:Abstract.php


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