core_config_data値が空のフィールドの場合は変更させないでください
-
30-10-2019 - |
質問
いくつかのフィールドを追加しました core_config_data
終えた system.xml
私のモジュールの。以下に示すように:
<groups>
<hot_deals translate="label">
<label>Hot deals</label>
<frontend_type>text</frontend_type>
<sort_order>0</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<fields>
<deals_category_id translate="label">
<label>Deals category id</label>
<frontend_type>text</frontend_type>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</deals_category_id>
</fields>
</hot_deals>
</groups>
上記のsystem.xmlファイルを変更して、ユーザーがフィールドを空にして保存しようとした場合にテキストフィールドがデフォルト値を保持するようにすることにより、上記のテキストフィールドにいくつかのデフォルト値を適用したい。他のケースでは、ユーザーが値を変更した場合、新しい値をテーブルに保存する必要があります。
出来ますか?
PHTMLファイルでこれを簡単に使用できます if else statement
しかし、問題は、この変更が必要な多くのPHTMLファイルがあることです。
正しい解決策はありません
所属していません magento.stackexchange