Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Adding an item into a pending order
 
saturnin
Jr. Member
 
Total Posts:  2
Joined:  2008-05-01
 

Hello,
I’m facing a problem of adding certain item(s) into certain order from external script. It’s meant to be used for free gifts functionality. Till now I have this fragment, unfortunatelly I don’t know the important hmmm Anybody knows what should be there?
Thank you.

<?php
        
require_once '../app/Mage.php';
        
Mage::app('default');
        
try{
                $oId 
$_POST["orderid"];
                
$pId $_POST["inserted_product_id"];

                
$order Mage::getModel('sales/order')->load($oId);
                
$product Mage::getModel('catalog/product')->load($pId);

                
// prepare an order item from $product ?????
                // insert an item into order and save ?????

        
}
        
catch(Exception $e){
        
die($e->getMessage());
        
}
?>
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top