forzar mysql4-install-0.1.0.php custom module
Si por alguna extraña razón tu módulo no arranca el script en Module/sql/module_setup/mysql4-install-0.1.0.php y lo actualizas como mysql4-upgrade-0.1.0-2.0.2.php y cambias el config.xml a
Código original mysql4-install-0.1.0.php:
<?php
$installer = $this;
//graba en customer_entity_varchar
$installer->startSetup();
$setup = Mage::getModel('customer/entity_setup', 'core_setup');
$setup->addAttribute('customer', 'rut', array(
'label' => 'Rut',
'type' => 'varchar',
'input' => 'text',
'global' => 1,
'visible' => 1,
'required' => 0,
'user_defined' => 1,
'default' => '0',
'visible_on_front' => 1,
'frontend_class' => 'validate-rut required-entry',
'source' => 'profile/entity_rut',
));
if (version_compare(Mage::getVersion(), '1.6.0', '<='))
{
$customer = Mage::getModel('customer/customer');
$attrSetId = $customer->getResource()->getEntityType()->getDefaultAttributeSetId();
$setup->addAttributeToSet('customer', $attrSetId, 'General', 'rut');
}
if (version_compare(Mage::getVersion(), '1.4.2', '>='))
{
Mage::getSingleton('eav/config')
->getAttribute('customer', 'rut')
->setData('used_in_forms', array('adminhtml_customer','customer_account_create','customer_account_edit','checkout_register'))
->save();
}
// graba en sales_flat_quote
$tablequote = $this->getTable('sales/quote');
$installer->run("
ALTER TABLE $tablequote ADD `customer_rut` VARCHAR(255) COLLATE utf8_general_ci NOT NULL DEFAULT ''
");
$installer->endSetup();
Bueno tomas ese código y creas un archivo llamado script.php en la raíz del sitio Magento y lo dejas así:
<?php
require_once 'app/Mage.php';
umask( 0 );
Mage :: app( "default" );
//$installer = $this;
//graba en customer_entity_varchar
//$installer->startSetup();
$setup = Mage::getModel('customer/entity_setup', 'core_setup');
$setup->addAttribute('customer', 'rut', array(
'label' => 'Rut',
'type' => 'varchar',
'input' => 'text',
'global' => 1,
'visible' => 1,
'required' => 0,
'user_defined' => 1,
'default' => '0',
'visible_on_front' => 1,
'frontend_class' => 'validate-rut required-entry',
'source' => 'profile/entity_rut',
));
if (version_compare(Mage::getVersion(), '1.6.0', '<='))
{
$customer = Mage::getModel('customer/customer');
$attrSetId = $customer->getResource()->getEntityType()->getDefaultAttributeSetId();
$setup->addAttributeToSet('customer', $attrSetId, 'General', 'rut');
}
if (version_compare(Mage::getVersion(), '1.4.2', '>='))
{
Mage::getSingleton('eav/config')
->getAttribute('customer', 'rut')
->setData('used_in_forms', array('adminhtml_customer','customer_account_create','customer_account_edit','checkout_register'))
->save();
}
// graba en sales_flat_quote
//$tablequote = $this->getTable('sales/quote');
//$installer->run("
//ALTER TABLE $tablequote ADD `customer_rut` VARCHAR(255) COLLATE utf8_general_ci NOT NULL DEFAULT ''
//");
//$installer->endSetup();
echo 'terminado';
Así no más a la fuerza bruta!
Fuente: http://stackoverflow.com/questions/11402051/getting-setup-model
Magento Chile Google+