Skip to content

Instantly share code, notes, and snippets.

@deivisonarthur
Last active September 21, 2016 23:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deivisonarthur/8597caabcdec513d04e9 to your computer and use it in GitHub Desktop.
Save deivisonarthur/8597caabcdec513d04e9 to your computer and use it in GitHub Desktop.
OSC 6 Pro - Remoção do atributo tipopessoa do OSC 4 antigo da tabela eav-attribute (O erro apresentando: Falha ao carregar módulo da configuração. Exemplo do erro http://screencast.com/t/Y9KmWizPsob2) - Adicione esse arquivo na raiz do magento, rode ele pelo navegador e depois o exclua.
<?php
include_once 'app/Mage.php';
//Mage::app('default');
Mage::app();
$installer->startSetup();
/*Remover atributos tipopessoa do OSC 4*/
if ($installer->getAttribute('customer', 'tipopessoa', 'attribute_id')) {
$installer->removeAttribute('customer', 'tipopessoa');
$installer->removeAttribute('customer_address', 'tipopessoa');
}
if (!$installer->getAttribute('customer', 'tipopessoa', 'attribute_id')) {
$installer->addAttribute('customer', 'tipopessoa', array(
'type' => 'int',
'input' => 'select',
'label' => 'Tipo de Pessoa',
'global' => 1,
'visible' => 1,
'required' => 0,
'user_defined' => 1,
'sort_order' => 95,
'visible_on_front' => 1,
'source' => 'eav/entity_attribute_source_table',
'option' => array(
'values' => array('Física', 'Jurídica'),
),
));
if (version_compare(Mage::getVersion(), '1.6.0', '<=')) {
$customer = Mage::getModel('customer/customer');
$attrSetId = $customer->getResource()->getEntityType()->getDefaultAttributeSetId();
$installer->addAttributeToSet('customer', $attrSetId, 'General', '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();
}
}
if (!$installer->getAttribute('customer', 'ie', 'attribute_id')) {
$installer->addAttribute('customer', 'ie', array(
'input' => 'text',
'type' => 'varchar',
'label' => 'IE (Inscrição Estadual)',
'visible' => 1,
'required' => 0,
'user_defined' => 1,
));
if (version_compare(Mage::getVersion(), '1.6.0', '<=')) {
$customer = Mage::getModel('customer/customer');
$attrSetId = $customer->getResource()->getEntityType()->getDefaultAttributeSetId();
$installer->addAttributeToSet('customer', $attrSetId, 'General', 'ie');
}
if (version_compare(Mage::getVersion(), '1.4.2', '>=')) {
Mage::getSingleton('eav/config')
->getAttribute('customer', 'ie')
->setData('used_in_forms', array('adminhtml_customer', 'customer_account_create', 'customer_account_edit', 'checkout_register'))
->save();
}
}
$installer->endSetup();
###############################################################################
Caso não após o procedimento acima ainda não esteja aparecendo o onestepcheckout
no admin faça um outro procedimento
###############################################################################
1 - Entre no banco do magento execute o sql:
--------------------------------------------------------------------------------
SELECT * FROM core_resource where code ='onestepcheckout_setup';
e veja se existe alguma entrada do onestepcheckout na tabela core resource,
caso tenha, exclua essa entrada
2 - Baixe a versão mais recente
--------------------------------------------------------------------------------
(http://onestepcheckout.com.br/sas44fAe778A/download.php?get=zip)
e envie para o Magento, entre no admin
3 - Limpe o cache.
--------------------------------------------------------------------------------
OBS: Caso tenha a versão mais recente não precisa executar o script acima!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment