We will work on Apr 26th (Saturday) and will be off from Apr 30th (Wednesday) until May 2nd (Friday) for public holiday in our country

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 ...@@ -357,12 +357,34 @@ abstract class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Abstract extends EcomDev
} }
if ($attribute->usesSource() && $value !== null) { if ($attribute->usesSource() && $value !== null) {
$value = $attribute->getSource()->getOptionId($value); 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; 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 * 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