いくつかのルールに基づいて顧客グループを切り替える拡張機能を使用しています。 このコードを使用して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
)
:ここ
は結果です。これはすべてのユーザーにとってデータベースの明快さには保存されません。そのため、私はデフォルト値を持っています。 私が理解していないことは、モジュール上で顧客データでどうやって取得するのですが、フロントエンドでは表示されません。
さらに、onモジュールは[_ data:protected]に表示されますが、[_origData:protected]には表示されません。
両方の場所でオブジェクトが_resourceCollectionNameです:うまくいけば、これが長すぎて読めない保護] =>顧客/ customer_collection ...
。
adminhtml領域にのみ登録された 'customer_load_after'イベントオブザーバが存在する可能性があります。そのオブザーバーメソッドでは、デフォルト値が設定されている可能性があります。ちょうどアイデア。 – Vinai
マジックゲットを使って値を取得できませんか? $ customer-> getAutoswitchgroup()のように? – seanbreeden
@seanbreedenいいえ、動作していません。 – Ovidiu