timbroder
8/10/2011 - 8:57 PM

_matchAttribute

_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;
    }