Created
August 19, 2012 03:55
-
-
Save deniscsz/3391790 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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', | |
)); | |
$setupRG = Mage::getModel('customer/entity_setup', 'core_setup'); | |
$setupRG->addAttribute('customer', 'rg', array( | |
'type' => 'varchar', | |
'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', 'tipopessoa') | |
->setData('used_in_forms', array('adminhtml_customer','customer_account_create','customer_account_edit','checkout_register')) | |
->save(); | |
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'); | |
Mage::log("TABELA ".$tablequote); | |
$installer->run(" | |
ALTER TABLE $tablequote ADD `customer_tipopessoa` INT NOT NULL | |
"); | |
$tablequoteRG = $this->getTable('sales/quote'); | |
Mage::log("TABELA RG ".$tablequoteRG); | |
$installer->run(" | |
ALTER TABLE $tablequoteRG ADD `customer_rg` VARCHAR(10) | |
"); | |
$installer->endSetup(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment