Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9015429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:44:56+00:00 2026-06-16T03:44:56+00:00

How i can split an order into two different part (one for downloadable and

  • 0

How i can split an order into two different part (one for downloadable and second for physical) and authorize the total amount at once and capture the downloadable product amount at the time of order and for physical capture it manually from admin panel while product is ready for shipment.

Can anybody help me………….

Thanks in Advance 😀

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T03:44:57+00:00Added an answer on June 16, 2026 at 3:44 am

    You need to create a custom event in OnePageController (if you are using Onepage checkout) under saveOrderAction() method.

    and use the below code to remove the item from current cart and create a new order for physical product.

    class CompanyName_ModuleName_Model_Order extends Mage_Core_Model_Abstract {
    
    public function createOrder() {
    
        $quoteID = Mage::getSingleton("checkout/session")->getQuote()->getId();
        $quote = Mage::getModel("sales/quote")->load($quoteID);
    
        foreach($quote->getAllItems() as $item){
            $itemId = $item->getId();
            $productId = $item->getProductId();
            if(put your condition here){
                /* remove the item fro which need to split the order */
                $quote->removeItem($itemId)->save();
            }
        }
    
        $id = Mage::getSingleton('customer/session')->getCustomer()->getId();
        $customer = Mage::getModel('customer/customer')->load($id);
    
        $transaction = Mage::getModel('core/resource_transaction');
        $storeId = $customer->getStoreId();
        $reservedOrderId = Mage::getSingleton('eav/config')->getEntityType('order')->fetchNewIncrementId($storeId);
    
        $order = Mage::getModel('sales/order')
                        ->setIncrementId($reservedOrderId)
                        ->setStoreId($storeId)
                        ->setQuoteId(0)
                        ->setGlobal_currency_code('USD')
                        ->setBase_currency_code('USD')
                        ->setStore_currency_code('USD')
                        ->setOrder_currency_code('USD');
    
        /* set Customer data */
        $order->setCustomer_email($customer->getEmail())
                ->setCustomerFirstname($customer->getFirstname())
                ->setCustomerLastname($customer->getLastname())
                ->setCustomerGroupId($customer->getGroupId())
                ->setCustomer_is_guest(0)
                ->setCustomer($customer);
    
        /* set Billing Address */
        $billing = $customer->getDefaultBillingAddress();
        $billingAddress = Mage::getModel('sales/order_address')
                        ->setStoreId($storeId)
                        ->setAddressType(Mage_Sales_Model_Quote_Address::TYPE_BILLING)
                        ->setCustomerId($customer->getId())
                        ->setCustomerAddressId($customer->getDefaultBilling())
                        ->setCustomer_address_id($billing->getEntityId())
                        ->setPrefix($billing->getPrefix())
                        ->setFirstname($billing->getFirstname())
                        ->setMiddlename($billing->getMiddlename())
                        ->setLastname($billing->getLastname())
                        ->setSuffix($billing->getSuffix())
                        ->setCompany($billing->getCompany())
                        ->setStreet($billing->getStreet())
                        ->setCity($billing->getCity())
                        ->setCountry_id($billing->getCountryId())
                        ->setRegion($billing->getRegion())
                        ->setRegion_id($billing->getRegionId())
                        ->setPostcode($billing->getPostcode())
                        ->setTelephone($billing->getTelephone())
                        ->setFax($billing->getFax());
        $order->setBillingAddress($billingAddress);
    
        $shipping = $customer->getDefaultShippingAddress();
        $shippingAddress = Mage::getModel('sales/order_address')
                        ->setStoreId($storeId)
                        ->setAddressType(Mage_Sales_Model_Quote_Address::TYPE_SHIPPING)
                        ->setCustomerId($customer->getId())
                        ->setCustomerAddressId($customer->getDefaultShipping())
                        ->setCustomer_address_id($shipping->getEntityId())
                        ->setPrefix($shipping->getPrefix())
                        ->setFirstname($shipping->getFirstname())
                        ->setMiddlename($shipping->getMiddlename())
                        ->setLastname($shipping->getLastname())
                        ->setSuffix($shipping->getSuffix())
                        ->setCompany($shipping->getCompany())
                        ->setStreet($shipping->getStreet())
                        ->setCity($shipping->getCity())
                        ->setCountry_id($shipping->getCountryId())
                        ->setRegion($shipping->getRegion())
                        ->setRegion_id($shipping->getRegionId())
                        ->setPostcode($shipping->getPostcode())
                        ->setTelephone($shipping->getTelephone())
                        ->setFax($shipping->getFax());
    
        $order->setShippingAddress($shippingAddress)
                ->setShipping_method('freeshipping')
                ->setShippingDescription('Free Shipping - Free');
        /*set payment details here for example */
        $orderPayment = Mage::getModel('sales/order_payment')
                        ->setStoreId($storeId)
                        ->setCustomerPaymentId(0)
                        ->setMethod('cybersource_soap')
                        ->setCcType('VI')
                        ->setCcNumber('4111111111111111')
                        ->setCcLast4('1111')
                        ->setCcExpMonth('2')
                        ->setCcExpYear('2013')
                        ->setCcCid('123');
        $order->setPayment($orderPayment);
    
        /* let say, we have 2 products */
        $subTotal = 0;
        /* pass the product id and quantity here e.g. */
        $products = array(
        '2' => array(
        'qty' => 1
        )
        );
        foreach ($products as $productId => $product) {
            $_product = Mage::getModel('catalog/product')->load($productId);
            $rowTotal = $_product->getPrice() * $product['qty'];
            $orderItem = Mage::getModel('sales/order_item')
                            ->setStoreId($storeId)
                            ->setQuoteItemId(0)
                            ->setQuoteParentItemId(NULL)
                            ->setProductId($productId)
                            ->setProductType($_product->getTypeId())
                            ->setQtyBackordered(NULL)
                            ->setTotalQtyOrdered($product['qty'])
                            ->setQtyOrdered($product['qty'])
                            ->setName($_product->getName())
                            ->setSku($_product->getSku())
                            ->setPrice($_product->getPrice())
                            ->setBasePrice($_product->getPrice())
                            ->setOriginalPrice($_product->getPrice())
                            ->setRowTotal($rowTotal)
                            ->setBaseRowTotal($rowTotal);
    
            $subTotal += $rowTotal;
            $order->addItem($orderItem);
        }
    
        $order->setSubtotal($subTotal)
                ->setBaseSubtotal($subTotal)
                ->setGrandTotal($subTotal)
                ->setBaseGrandTotal($subTotal);
    
        $transaction->addObject($order);
        $transaction->addCommitCallback(array($order, 'place'));
        $transaction->addCommitCallback(array($order, 'save'));
        $transaction->save();
    }
    
    }
    

    and don’t forget to modify this code according your configuration etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given a linked list of integers in random order, split it into two new
How can I split a string such as Mar10 into Mar and 10 in
Given a string such as: 23,234,456 first second third How can I split string
If I want a part of an array I can use [] or split
Recently I've split my GWT 2.4 application into two maven modules: domain and webapp
I have a string like: $Order_num = "0982asdlkj"; How can I split that into
I have my urls.py split into two files: Project-level urls.py: from myapp.urls import MYAPP_URLS
I have written two different applications running as windows services. Each application represents one
I have two arrays of different length. I want to put them into hash,
Can split(string, array, separator) in awk use sequence of whitespaces as the separator (or

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.