I need to insert data into the database, I'm getting the data from an old database, I had some attributes that have a certain value, I created those attributes in the site so that I can receive the data without any problem, the attributes that are type select has its values, the old site for having created and deleted attributes that are used today have high values, such as 42, and that same attribute that I create in the new site comes with value 1, because not being deleted and re-inserted, I would like to know how I would do a check to change the values of the attributes I have.
Example of how I add the fields
As you can see in the code I add the fields like this, I give a select and then put it in its place with ->setNomedoCampo($dadoselecionado)
in case the ->setStoreId($loja)
is set as id 1 or 2, for having 2 stores, but In the old database, only 1 and 2, how would I deploy a "converter" in this code so that I can exchange those values?
while($row = mysqli_fetch_array($select)){
$teste = array(
$clientes_id = $row['clientes_id'],
$nome = $row['nome'],
$sobrenome = $row['sobrenome'],
$site = $row['site'],
$loja = $row['loja'],
$grupo = $row['grupo'],
$prefixo = $row['prefixo'],
$assinatura = $row['assinatura']);
$customer = Mage::getModel("customer/customer");
$customer->setId($clientes_id)
->setFirstname($nome)
->setLastname($sobrenome)
->setWebsiteId($site)
->setStoreId($loja)
->setGroupId($grupo)
->setPrefix($prefixo)
->setMiddlename($assinatura);
Second question
I'd like to know if I have a value in the attribute that does not get a "default" value, such as before setting a value in the database so that it can hit old values. Below you can see how I add these new attributes to the database.
Attributes
Within "option" => array(...
is where I put the options that will be selected, would I have to put a value for them at the time of insertion here? Because if you have not had the need to make a converter as in the case I explained above.
$installer->addAttribute("customer", "occupation", array(
"type" => "varchar",
"backend" => "",
"label" => "Profissão",
"input" => "select",
"source" => "",
"visible" => true,
"required" => false,
"default" => "",
"frontend" => "",
"unique" => false,
"source" => "eav/entity_attribute_source_table",
"option" => array('values' => array('System Analist', 'Administrator'))
));
Image with the values of the attributes you would like to change
Then there are the values assigned to the options, 29, 30, 31, 32. However in the other site there are other values, so when I enter the bank will not pull these values correctly, someone would know if you have setar these values before inserting?