Commit 2fc45190 authored by Ivan Chepurnyi's avatar Ivan Chepurnyi

# Fix auto-fulfillment of product with default values for a store view, if...

# Fix auto-fulfillment of product with default values for a store view, if value was actually not specified.
parent 9eff83fc
......@@ -357,12 +357,34 @@ abstract class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Abstract extends EcomDev
}
if ($attribute->usesSource() && $value !== null) {
if ($attribute->getSource() instanceof Mage_Eav_Model_Entity_Attribute_Source_Abstract) {
$value = $attribute->getSource()->getOptionId($value);
} else {
$value = $this->_getOptionIdNonAttributeSource($attribute->getSource()->getAllOptions(), $value);
}
}
return $value;
}
/**
* Get option id if attribute source model doesn't support eav attribute interface
*
*
* @param array $options
* @param mixed $value
*/
protected function _getOptionIdNonAttributeSource($options, $value)
{
foreach ($options as $option) {
if (strcasecmp($option['label'], $value)==0 || $option['value'] == $value) {
return $option['value'];
}
}
return null;
}
/**
* Retrieves entity id field, based on entity configuration
*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment