I'm trying to implement a custom payment module and have added a few custom colums to the sales_flat_order_payment table. After the customer places the order, these fields should be updated and some of the inserted information needs to pre presented simultaneously. I do all of this in a custom block, that should display a custom template file or an error message if something went wrong. The problem I'm having now is, that the database information doesn't get updated. I don't know if this is the right way to do it but here is my code:
$this->orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$this->order = Mage::getModel('sales/order')->loadByIncrementId($this->orderId);
$this->payment = $this->order->getPayment();
then later I try to assign my data to the fields, for example:
$this->payment->setMyData(time());
the column names are all correct, in this case it would be my_data. I do the same with the appropriate get() methods, which seem to work ok.
Also there seems to be another problem, the error message in the constructor doesn't get displayed every time:
if($this->establishGateway() == true)
{
$this->setTemplate('mypayment/gateway.phtml');
}
else
{
Mage::getSingleton('core/session')->addError(__('There was a Problem with the Payment Gateway.'));
}
loadlayout and renderlayout get called from the controller that loads this block. Any suggestions?
$this->order->getPayment();
? – Renon Stewart Sep 13 '15 at 18:50