私はShopwareを学んでいます。私は解決する方法を理解できない何かに遭遇しました。フロントエンドのアカウントプロフィールフォームの顧客属性を更新する
私は顧客に属性を追加するテストプラグインを作成しています。私は登録フォームにコレスポンデントフィールドを追加して、ドキュメントのどこかで読んだように自動的に値をdbに保存します。
ここで、パスワードフィールドの後のアカウントプロファイルページで属性を編集できるようにしたかったのです。私はそこに入力を入れ、dbから値を表示することさえできました。しかし、値を変更して保存すると、その値は更新されません。私はそれがフィールド名を正しく取得することの問題であるかどうかわからない、または別のものを無効にする必要があるかどうかはわかりません。それとも不可能なのでしょうか?どのようにこれを達成するための任意の助けが大いに感謝されるでしょう。
以下関連するコード:
プラグイン/ personal_fieldset.tpl
{extends file="parent:frontend/register/personal_fieldset.tpl"}
{block name='frontend_register_personal_fieldset_password_description'}
{$smarty.block.parent}
<div class="register--test-field">
<input autocomplete="section-personal test-field"
name="register[personal][attribute][testField]"
type="text"
placeholder="Test Field"
id="testfield"
value="{$form_data.attribute.testField|escape}"
class="register--field{if $errorFlags.testField} has--error{/if}"
/>
</div>
{/block}
アカウントレジスタ
public function install(InstallContext $context)
{
$service = $this->container->get('shopware_attribute.crud_service');
$service->update('s_user_attributes', 'test_field', 'string');
$metaDataCache = Shopware()->Models()->getConfiguration()->getMetadataCacheImpl();
$metaDataCache->deleteAll();
Shopware()->Models()->generateAttributeModels(['s_user_attributes']);
return true;
}
ブートストラップ/ profile.tpl
{extends file="parent:frontend/account/profile.tpl"}
{block name='frontend_account_profile_profile_required_info'}
<div class="profile--test-field">
<input autocomplete="section-personal test-field"
name="profile[attribute][testfield]"
type="text"
placeholder="Test Field"
id="testfield"
value="{$sUserData.additional.user.test_field|escape}"
class="profile--field{if $errorFlags.testField} has--error{/if}"
/>
</div>
{$smarty.block.parent}
{/block}