일부 규칙에 따라 고객 그룹을 전환하는 확장 프로그램을 사용하고 있습니다. 이 코드를 사용하여 EAV로 고객에게 속성을 추가했습니다.Magento에서 customer로 설정된 속성의 기본값 가져 오기
$setup->addAttribute('customer', 'autoswitchgroup', array(
'type' => 'varchar',
'input' => 'select',
'label' => 'Autoswitch Group',
'global' => 1,
'visible' => 1,
'required' => 0,
'user_defined' => 1,
'default' => 'yes',
'visible_on_front' => 1,
'source' => 'bitstream_all/entity_autoswitchgroup',
));
내가이 코드를 사용하여 고객의 속성을 가져 볼 수있는 확장 코드를 통해 상대 : _getCustomer()이 객체로 정의
$customerAttributeValue = $this->_getCustomer()->getDataUsingMethod($attribute);
. (@return Varien_Object). 프론트 엔드에서
[_resourceCollectionName:protected] => customer/customer_collection
[_cacheTag:protected] =>
[_dataSaveAllowed:protected] => 1
[_isObjectNew:protected] =>
[_data:protected] => Array
(
[entity_id] => 1
[entity_type_id] => 1
[attribute_set_id] => 0
[website_id] => 1
[email] => ****
[group_id] => 11
[increment_id] => 000000001
[store_id] => 1
[created_at] => 2011-06-04 15:11:50
[updated_at] => 2012-03-05 14:04:54
[is_active] => 1
[created_in] => Lenjerii
[prefix] =>
[firstname] => Ovidiu
[middlename] =>
[lastname] => Ungureanu
[suffix] =>
[password_hash] => ****
[taxvat] =>
[facebook_uid] => ****
[gender] => 1
[dob] =>
[autoswitchgroup] => yes
[is_subscribed] => 1
[parent_id] => 0
[dob_is_formated] => 1
[confirmation] =>
)
[_hasDataChanges:protected] => 1
[_origData:protected] => Array
(
[entity_id] => 1
[entity_type_id] => 1
[attribute_set_id] => 0
[website_id] => 1
[email] => ****
[group_id] => 11
[increment_id] => 000000001
[store_id] => 1
[created_at] => 2011-06-04 15:11:50
[updated_at] => 2012-03-05 13:49:46
[is_active] => 1
[created_in] => Lenjerii
[prefix] =>
[firstname] => Ovidiu
[middlename] =>
[lastname] => Ungureanu
[suffix] =>
[password_hash] => ****
[taxvat] =>
[facebook_uid] => ****
[gender] => 1
)
[_idFieldName:protected] => entity_id
[_isDeleted:protected] =>
내가이 사용하여지고, 동일한 정보를 원하는 : 나는 고객 개체에 대해 살펴 경우
내가이 정보를 볼 $ 고객 = 마술사 :: getSingleton를 ('고객/세션 ') -> getCustomer(); 속성이 만든 - 나는 그것이 [autoswitchgroup] 얻을 관심이 무엇
[_resourceCollectionName:protected] => customer/customer_collection
[_cacheTag:protected] =>
[_dataSaveAllowed:protected] => 1
[_isObjectNew:protected] =>
[_data:protected] => Array
(
[website_id] => 1
[entity_id] => 1
[entity_type_id] => 1
[attribute_set_id] => 0
[email] => ***
[group_id] => 11
[increment_id] => 000000001
[store_id] => 1
[created_at] => 2011-06-04 15:11:50
[updated_at] => 2012-03-05 13:49:46
[is_active] => 1
[created_in] => Lenjerii
[prefix] =>
[firstname] => Ovidiu
[middlename] =>
[lastname] => Ungureanu
[suffix] =>
[password_hash] => ***
[taxvat] =>
[facebook_uid] => ***
[gender] => 1
[tax_class_id] => 3
)
[_hasDataChanges:protected] => 1
[_origData:protected] => Array
(
[website_id] => 1
[entity_id] => 1
[entity_type_id] => 1
[attribute_set_id] => 0
[email] => ***
[group_id] => 11
[increment_id] => 000000001
[store_id] => 1
[created_at] => 2011-06-04 15:11:50
[updated_at] => 2012-03-05 13:49:46
[is_active] => 1
[created_in] => Lenjerii
[prefix] =>
[firstname] => Ovidiu
[middlename] =>
[lastname] => Ungureanu
[suffix] =>
[password_hash] => ****
[taxvat] =>
[facebook_uid] => ****
[gender] => 1
)
: 여기
는 결과이다. 이 데이터베이스는 모든 사용자에게 데이터베이스에 저장되지 않으므로 기본값이 있습니다. 지금 내가 이해할 수없는 것은 고객 데이터에서 모듈을 얻는 방법이지만 프론트 엔드에서는 그것을 볼 수 없다는 것입니다.
더 많은 모듈이 [_ 데이터 : 보호됨]에 표시되지만 [_origData : 보호]에는 표시되지 않습니다. 두 곳 모두에서
객체는 _resourceCollectionName : 보호] => 고객/customer_collection ...는 희망이 너무 길어서 읽기가 아닙니다.
adminhtml 영역에만 'customer_load_after' 이벤트 관찰자가 등록되었을 수 있습니다. 그 관찰자 방법에서 기본값이 설정 될 수 있습니다. 그냥 생각. – Vinai
매직 가져 오기를 사용하여 값을 검색 할 수 없습니까? $ customer-> getAutoswitchgroup()처럼? – seanbreeden
@seanbreeden 아니요, 작동하지 않습니다. – Ovidiu