Magento Forum

   
SOLVED : save additional data against order or payment
 
Saggy
Sr. Member
 
Total Posts:  131
Joined:  2009-02-03
 

Hi Guys,

Is there a simple way to save additional data against the payment or order which can be extracted during order export?

I want to save payment gateway response. Here is the data which I need to save -:

- AuthCode
- PayerAuthRequestID
- AuthResult
- EFTSN

N.B. - I don’t want to save in the debug table as protx or cybersource does.

Any help would be appreciated. Thanks in advance.

Cheers
S

 
Magento Community Magento Community
Magento Community
Magento Community
 
Saggy
Sr. Member
 
Total Posts:  131
Joined:  2009-02-03
 

Don’t worry guys. I found the answer. Thanks anyways

 
Magento Community Magento Community
Magento Community
Magento Community
 
gizmocreative
Jr. Member
 
Total Posts:  6
Joined:  2009-01-16
 

Hi @Saggy,
Would you be so kind as to post a reference to your answer you found?  I’d like to know the same…
Thanks,
Daniel

 
Magento Community Magento Community
Magento Community
Magento Community
 
Saggy
Sr. Member
 
Total Posts:  131
Joined:  2009-02-03
 
gizmocreative - 11 May 2009 11:03 AM

Hi @Saggy,
Would you be so kind as to post a reference to your answer you found?  I’d like to know the same…
Thanks,
Daniel

Hi Dan,

Here is the code to save additional data against payment array of order-:

$sAdditionalData=$this->result//here you can save any string

$order Mage::getModel('sales/order');
$order->loadByIncrementId($this->getOrderId());
$payment $order->getPayment();
$payment->setAdditionalData($sAdditionalData)
->
save();

Here is the code to extract addtional data from payment array of order-:

$order Mage::getModel('sales/order');
$order->loadByIncrementId($this->getOrderId());
$payment $order->getPayment();
$additonalData $payment->getData('additional_data')

Hope this will help.

 
Magento Community Magento Community
Magento Community
Magento Community
 
kiatng
Enthusiast
 
Total Posts:  875
Joined:  2008-09-03
Kuala Lumpur, Malaysia
 

@Saggy

Thanks a lot for the code. After hours of trying different ways and deadends and messing with the DB table, this works:

$order->setAdditionalData($sAdditionalData)->save();

This does not work:

$order->setData('additional_data'$sAdditionalData); //data will be lost outside execution scope
$order->save();  //runtime error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'additional_data' in 'field list'

Hope this will help others.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Saggy
Sr. Member
 
Total Posts:  131
Joined:  2009-02-03
 

No worries, I am glad it helped you.

Cheers
S

 
Magento Community Magento Community
Magento Community
Magento Community
 
writemcodeboy
Member
 
Avatar
Total Posts:  33
Joined:  2009-09-18
 

Hey Guys—to what DB table/column does setAdditionalData() save it too?

I cant find it anywhere and can not verify that I have it working.

Thank you!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Saggy
Sr. Member
 
Total Posts:  131
Joined:  2009-02-03
 

Hi Onionlips,

It should be there in order text table. You need to make sure that you have selected the tick box to show all rows (if using sqlyog).

Cheers
S

 
Magento Community Magento Community
Magento Community
Magento Community
 
writemcodeboy
Member
 
Avatar
Total Posts:  33
Joined:  2009-09-18
 

@Saggy. Thank you for the direction!

Using:
$payment->setAdditionalData(serialize($myAdditionalArray));

I found it:
TABLE: sales_order_entity_text
COLUMN: value

 
Magento Community Magento Community
Magento Community
Magento Community
 
Reager
Jr. Member
 
Total Posts:  20
Joined:  2009-10-22
 

Hi.

Im new to Magento and I would like to know how to get this working. In which file should/could this be used?

BR
D

 
Magento Community Magento Community
Magento Community
Magento Community
 
KhurramAziz
Jr. Member
 
Total Posts:  2
Joined:  2010-03-29
 

Hi all

Has anyone dealt with a problem to make Magento substract the inventory from stock not after order placement but after successfull paypal payment?

This is an imporatnt feature for stores which sell hand made and one-off products. Sometimes a visitor goes through the checkout process just for testing or playing around and will not make payment but the product goes sold out anyway.

I would be grateful for any tips on the topic.

Take care

 
Magento Community Magento Community
Magento Community
Magento Community
 
BLACKBULL_316
Member
 
Total Posts:  35
Joined:  2010-04-20
India
 

Hi I am newbie to magento..Please provide a step by step to perform the funtionality(ave additional data against payment array of order-: ).

where to use all these code means which fiel??

 
Magento Community Magento Community
Magento Community
Magento Community
 
gardenxl
Jr. Member
 
Total Posts:  2
Joined:  2012-01-06
 

Could a bit more of a hint be provided here? I need to store the same information but have no idea which file(s) to edit to achieve this.

 
Magento Community Magento Community
Magento Community
Magento Community
 
kiatng
Enthusiast
 
Total Posts:  875
Joined:  2008-09-03
Kuala Lumpur, Malaysia
 

The code will work in any file. So it depends on when and where the info is available. For example, you can setup an observer on the payment module and put the code there or you can write your own payment module and when the payment gateway returns some info, you can use the codes to store the info.

 
Magento Community Magento Community
Magento Community
Magento Community
 
ayunksyah
Jr. Member
 
Total Posts:  10
Joined:  2012-05-09
Indonesia
 

Hi I am newbie to magento..Please provide a step by step

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