Skip to content

Instantly share code, notes, and snippets.

@timbroder
Created August 10, 2011 20:57
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 timbroder/1138243 to your computer and use it in GitHub Desktop.
Save timbroder/1138243 to your computer and use it in GitHub Desktop.
_matchAttribute
protected function _matchAttribute(Varien_Object $attribute, $item)
{
$code = $attribute->getAttributeCode();
$value = $item->getData($code);
Mage::log("Mapping Price code/value ".$code."/".$value, null, "migration.log");
Mage::log($item, null, "migration.log");
if ($code == 'entity_type_id') {
$value = $attribute->getEntityTypeId();
} elseif ($code == 'attribute_set_id') {
if (!$value = $attribute->getDefaultAttributeSetId()) {
$value = $attribute->getEntityType()->getDefaultAttributeSetId();
$attribute->setDefaultAttributeSetId($value);
}
} else if ($this->isValueEmpty($value, $attribute)){
$this->_matchAttributeType($attribute, $value);
}
$item->setData($code, $value);
Mage::log("Mapping Price code/value (after)", null, "migration.log");
Mage::log($item, null, "migration.log");
return $this;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment