Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once 'app/Mage.php';
- Mage::app();
- $quote = Mage::getModel('sales/quote')
- ->setStoreId(Mage::app()->getStore('default')->getId());
- $product = Mage::getSingleton('checkout/cart')->getItems(); /* Get Items From Cart?? */
- //$product = Mage::getModel('catalog/product')->load(87561); /* 6 => Some product ID */
- $buyInfo = array('qty' => 1);
- $quote->addProduct($product, new Varien_Object($buyInfo));
- $billingAddress = array(
- 'firstname' => 'My',
- 'lastname' => 'Name',
- 'company' => 'None',
- 'email' => 'asdf@asdf.com',
- 'street' => array(
- 'Sample Street Line_1',
- 'Sample Street Line_2'
- ),
- 'city' => 'City',
- 'region_id' => '',
- 'region' => 'State/Province',
- 'postcode' => '12345',
- 'country_id' => 'DE',
- 'telephone' => '1234567890',
- 'fax' => '123456987',
- 'customer_password' => '',
- 'confirm_password' => '',
- 'save_in_address_book' => '0',
- 'use_for_shipping' => '1',
- );
- $quote->getBillingAddress()
- ->addData($billingAddress);
- $quote->getShippingAddress()
- ->addData($billingAddress)
- ->setShippingMethod('solutioo')
- ->setPaymentMethod('cashondelivery')
- ->setCollectShippingRates(true)
- ->collectTotals();
- $quote->setCheckoutMethod('guest')
- ->setCustomerId(null)
- ->setCustomerEmail($quote->getBillingAddress()->getEmail())
- ->setCustomerIsGuest(true)
- ->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
- $quote->getPayment()->importData( array('method' => 'cashondelivery'));
- $quote->save();
- $service = Mage::getModel('sales/service_quote', $quote);
- $service->submitAll();
- //$order = $service->getOrder();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement