0
Magento에서 자동으로 Product EAV 값 객체를 저장하고 컬렉션로드 또는 단일 제품로드 중에 자동으로 가져올 수 있습니까?Magento 자동으로 EAV 값으로 객체 저장
그래서 Magento store 제품 속성 개체 및 모델을 가질 수 있습니다.
public function getData($key='', $index=null)
{
if (''===$key) {
return $this->_data;
}
$default = null;
// accept a/b/c as ['a']['b']['c']
if (strpos($key,'/')) {
$keyArr = explode('/', $key);
$data = $this->_data;
foreach ($keyArr as $i=>$k) {
if ($k==='') {
return $default;
}
if (is_array($data)) {
if (!isset($data[$k])) {
return $default;
}
$data = $data[$k];
} elseif ($data instanceof Varien_Object) {
$data = $data->getData($k);
} else {
return $default;
}
}
return $data;
}
// legacy functionality for $index
if (isset($this->_data[$key])) {
if (is_null($index)) {
return $this->_data[$key];
}
$value = $this->_data[$key];
if (is_array($value)) {
//if (isset($value[$index]) && (!empty($value[$index]) || strlen($value[$index]) > 0)) {
/**
* If we have any data, even if it empty - we should use it, anyway
*/
if (isset($value[$index])) {
return $value[$index];
}
return null;
} elseif (is_string($value)) {
$arr = explode("\n", $value);
return (isset($arr[$index]) && (!empty($arr[$index]) || strlen($arr[$index]) > 0)) ? $arr[$index] : null;
} elseif ($value instanceof Varien_Object) {
return $value->getData($index);
}
return $default;
}
return $default;
}