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

How to add a new data to order? 
 
nickie084
Jr. Member
 
Total Posts:  3
Joined:  2008-07-09
 

Hi!

I’m trying to add a new field to billing form on checkout page. I created a new input inside the form in billing.phtml like this:

<li>
                <
div class="input-box">
                     <
label for="billing:addInfo"Additional Info </label><br/>
                    <
input type="text" name="billing[addInfo]" id="billing:addInfo" style="width:525px;" />
                </
div>
            </
li>

and added a new column “addInfo” to sales_order table in DB, but after placing a new order this column value is always NULL.

The ajax function that receives the form gets the additinal field value (i made file output to check), but then it disappears:(
Maybe i’m stupid but i’ve failed to
find the save() function where the actual database insertion happens. I guess the problem should be there…

Can anybody help me with this?

Many thanks ahead!

 
Magento Community Magento Community
Magento Community
Magento Community
 
nickie084
Jr. Member
 
Total Posts:  3
Joined:  2008-07-09
 

nobody?  :(

 
Magento Community Magento Community
Magento Community
Magento Community
 
nickie084
Jr. Member
 
Total Posts:  3
Joined:  2008-07-09
 

I’ve got half of a solution. Maybe that would help somebody.
This code adds data to addInfo column in sales_quote table:

/* save addInfo */
            $info = array (
                    
'addInfo'    => $data['addInfo']
                
);
            
            
$where[] "entity_id = '" $this->getQuote()->getId() . "'";
            
            
$conn Mage::getSingleton('core/resource')->getConnection('core_write');
            
$conn->update('sales_quote'$info$where);
        
/* save info ends */

it should be added to app\code\core\Mage\Checkout\Model\Type\Onepage.php
in

public function saveBilling($data$customerAddressId)

after

$this->getQuote()->save();

But don’t know how to get this info in adminpanel, in info.phtml…

order id can be easily got by

<?php echo $_order->getId()?>

but how to get corresponding entity_id? and is it possible , because i don’t understand EAV database structure :(
maybe something else should be used instead of entity_id when saving?
does anyone have a solution?

many thanks ahead!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top