/** * Initialize quote objects */ private function initializeQuote() { $this->quote = Mage::getModel('sales/quote'); $this->quote->setCheckoutMethod($this->proxyOrder->getCheckoutMethod()); $this->quote->setStore($this->proxyOrder->getStore()); $this->quote->save(); }
private function initializeQuote() { $this->quote = Mage::getModel('sales/quote'); $this->quote->setCheckoutMethod($this->proxyOrder->getCheckoutMethod()); $this->quote->setStore($this->proxyOrder->getStore()); $this->quote->getStore()->setData('current_currency', $this->quote->getStore()->getBaseCurrency()); $this->quote->save(); Mage::getSingleton('checkout/session')->replaceQuote($this->quote); }
/** * 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; }
protected function _initStore($storeId) { if ($storeId > 0) { // When specify storeId, get correct website id // ------------------------------------- $this->_webSiteId = Mage::getModel('core/store')->load($storeId)->getWebsiteId(); $this->_storeId = $storeId; // ------------------------------------- } else { // If store Id not set, set first from default website // Need for proper import order contains bundle product // ------------------------------------- $this->_webSiteId = Mage::helper('M2ePro/Sales')->getDefaultWebsiteId(); $this->_storeId = Mage::helper('M2ePro/Sales')->getDefaultStoreId(); // ------------------------------------- } $store = $this->_quote->getStore()->load($this->_storeId); // Init store where we import product $this->_quote->setStore($store); return $this->_storeId; }
public function render() { $customer = $this->_getCustomer(); $this->_quote->setStore($this->_getStore())->setCustomer($customer); $this->_quote->getBillingAddress()->importCustomerAddress($customer->getDefaultBillingAddress()); $this->_quote->getShippingAddress()->importCustomerAddress($customer->getDefaultShippingAddress()); $productCount = rand(3, 10); for ($i = 0; $i < $productCount; $i++) { $product = $this->_getRandomProduct(); if ($product) { $product->setQuoteQty(1); $this->_quote->addCatalogProduct($product); } } $this->_quote->getPayment()->setMethod('checkmo'); $this->_quote->getShippingAddress()->setShippingMethod('freeshipping_freeshipping'); //->collectTotals()->save(); $this->_quote->getShippingAddress()->setCollectShippingRates(true); $this->_quote->collectTotals()->save(); $this->_quote->save(); return $this; }