示例#1
0
 /**
  * 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;
 }
示例#2
0
 /**
  * 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;
 }
示例#3
0
 /**
  * @param Mage_Sales_Model_Quote $quote
  *
  * @return Mage_Sales_Model_Quote
  */
 protected function _setQuoteVirtualItem(Mage_Sales_Model_Quote $quote)
 {
     if (!count($this->_virtualObjectStack)) {
         return $quote;
     }
     $quote->setIsSuperMode(true);
     foreach ($this->_virtualObjectStack as $obj) {
         /* @var $obj Varien_Object */
         $amountWithTax = $obj->getUnitAmountWithTax();
         /* @var $merged Mage_Catalog_Model_Product */
         $merged = $this->_getCouponHelper()->createProductFromShopgateCoupon($obj);
         /* @var $quoteItem Mage_Sales_Model_Quote_Item */
         $quoteItem = $quote->addProduct($merged, $obj->getQty());
         $quoteItem->setCustomPrice($amountWithTax);
         $quoteItem->setOriginalPrice($amountWithTax);
         $quoteItem->setOriginalCustomPrice($amountWithTax);
         $quoteItem->setNoDiscount(true);
         $quoteItem->setRowWeight(0);
         $quoteItem->setWeeeTaxApplied(serialize(array()));
     }
     return $quote;
 }