Skip to content

Instantly share code, notes, and snippets.

@deniscsz
Created August 19, 2012 01:40
Show Gist options
  • Save deniscsz/3390847 to your computer and use it in GitHub Desktop.
Save deniscsz/3390847 to your computer and use it in GitHub Desktop.
Arquivo que altera o BD
<?php
$installer = $this;
$installer->startSetup();
$setup = Mage::getModel('customer/entity_setup', 'core_setup');
$setup->addAttribute('customer', 'tipopessoa', array(
'type' => 'int',
'input' => 'select',
'label' => 'Tipo Pessoa',
'global' => 1,
'visible' => 1,
'required' => 0,
'user_defined' => 1,
'default' => '0',
'visible_on_front' => 1,
'source' => 'novoatributo/entity_tipopessoa',
));
if (version_compare(Mage::getVersion(), '1.4.2', '>='))
{
Mage::getSingleton('eav/config')
->getAttribute('customer', 'tipopessoa')
->setData('used_in_forms', array('adminhtml_customer','customer_account_create','customer_account_edit','checkout_register'))
->save();
}
$tablequote = $this->getTable('sales/quote');
$installer->run("
ALTER TABLE $tablequote ADD `customer_tipopessoa` INT NOT NULL
");
$installer->endSetup();
$installer = $this;
$installer->startSetup();
$setup = Mage::getModel('customer/entity_setup', 'core_setup');
$setup->addAttribute('customer', 'rg', array(
'type' => 'text',
'input' => 'text',
'label' => 'Identidade (RG)',
'global' => 1,
'visible' => 1,
'required' => 0,
'user_defined' => 1,
'default' => '0',
'visible_on_front' => 1,
));
if (version_compare(Mage::getVersion(), '1.4.2', '>='))
{
Mage::getSingleton('eav/config')
->getAttribute('customer', 'rg')
->setData('used_in_forms', array('adminhtml_customer','customer_account_create','customer_account_edit','checkout_register'))
->save();
}
$tablequote = $this->getTable('sales/quote');
$installer->run("
ALTER TABLE $tablequote ADD `customer_tipopessoa` INT NOT NULL
");
$installer->endSetup();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment