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

Help with module to write in DB
 
VHA
Member
 
Total Posts:  41
Joined:  2008-06-21
Atlanta
 

I got a working module for a payment method, but i may be missing something… the module is not saving data to the 2 tables that has been created.

$installer $this;
/* @var $installer Mage_BoletoBancario_Model_Mysql4_Setup */

$installer->startSetup();

$installer->run("

-- DROP TABLE IF EXISTS `{
$this->getTable('BoletoBancario_api_debug')}`;
CREATE TABLE `{
$this->getTable('BoletoBancario_api_debug')}` (
  `debug_id` int(10) unsigned NOT NULL auto_increment,
  `debug_at` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
  `request_body` text,
  `response_body` text,
  PRIMARY KEY  (`debug_id`),
  KEY `debug_at` (`debug_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

    "
);

$installer->run("CREATE TABLE `BoletoBancario` (
  `OrderID` varchar(255) default '0',
  `TransacaoID` varchar(255) default '0',
  `TipoFrete` varchar(255) default '0',
  `ValorFrete` varchar(255) default '0',
  `Anotacao` varchar(255) default '0',
  `TipoPagamento` varchar(255) default '0',
  `StatusTransacao` varchar(255) default '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 "
);

$installer->endSetup();

$installer->addAttribute('quote_payment''BoletoBancario_payer_id', array());
$installer->addAttribute('quote_payment''BoletoBancario_payer_status', array());
$installer->addAttribute('quote_payment''BoletoBancario_correlation_id', array());
 
Magento Community Magento Community
Magento Community
Magento Community
 
VHA
Member
 
Total Posts:  41
Joined:  2008-06-21
Atlanta
 

Model/Session.php

class Mage_BoletoBancario_Model_Session extends Mage_Core_Model_Session_Abstract
{
    
public function __construct()
    
{
        $this
->_init('BoletoBancario');
    
}
}
 
Magento Community Magento Community
Magento Community
Magento Community
 
VHA
Member
 
Total Posts:  41
Joined:  2008-06-21
Atlanta
 

I upload my Standard file, code is to big to post. :/
Here is my Model/Mysql4/Setup.php

class Mage_BoletoBancario_Model_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup
{
}

Model/Source/StandardAction.php

class Mage_BoletoBancario_Model_Source_StandardAction
{
    
public function toOptionArray()
    
{
        
return array(
            array(
'value' => Mage_BoletoBancario_Model_Standard::PAYMENT_TYPE_AUTH'label' => Mage::helper('BoletoBancario')->__('Authorization')),
            array(
'value' => Mage_BoletoBancario_Model_Standard::PAYMENT_TYPE_SALE'label' => Mage::helper('BoletoBancario')->__('Sale')),
        );
    
}
}
File Attachments
Standard.txt  (File Size: 7KB - Downloads: 68)
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top