How to set default value for configuration field with type time
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
4
down vote
favorite
How can I set a default value for a field from system.xml with type time?
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<section id="my_checkout" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Checkout</label>
<tab>my_tab</tab>
<resource>My_Checkout::config</resource>
<group id="cut_off_time" translate="label" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Delivery Cut-off Time</label>
<field id="cut_off_time_start" type="time" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Start Time</label>
</field>
</group>
</section>
</system>
For field "cut_off_time_start" with type TIME.
magento2 configuration default-values time
New contributor
Jeka is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
4
down vote
favorite
How can I set a default value for a field from system.xml with type time?
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<section id="my_checkout" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Checkout</label>
<tab>my_tab</tab>
<resource>My_Checkout::config</resource>
<group id="cut_off_time" translate="label" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Delivery Cut-off Time</label>
<field id="cut_off_time_start" type="time" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Start Time</label>
</field>
</group>
</section>
</system>
For field "cut_off_time_start" with type TIME.
magento2 configuration default-values time
New contributor
Jeka is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Can you please upload your system.xml?
– Rohan Hapani
2 hours ago
I added example system.xml in question.
– Jeka
57 mins ago
add a comment |Â
up vote
4
down vote
favorite
up vote
4
down vote
favorite
How can I set a default value for a field from system.xml with type time?
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<section id="my_checkout" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Checkout</label>
<tab>my_tab</tab>
<resource>My_Checkout::config</resource>
<group id="cut_off_time" translate="label" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Delivery Cut-off Time</label>
<field id="cut_off_time_start" type="time" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Start Time</label>
</field>
</group>
</section>
</system>
For field "cut_off_time_start" with type TIME.
magento2 configuration default-values time
New contributor
Jeka is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
How can I set a default value for a field from system.xml with type time?
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<section id="my_checkout" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Checkout</label>
<tab>my_tab</tab>
<resource>My_Checkout::config</resource>
<group id="cut_off_time" translate="label" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Delivery Cut-off Time</label>
<field id="cut_off_time_start" type="time" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Start Time</label>
</field>
</group>
</section>
</system>
For field "cut_off_time_start" with type TIME.
magento2 configuration default-values time
magento2 configuration default-values time
New contributor
Jeka is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Jeka is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited 59 mins ago
New contributor
Jeka is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 2 hours ago
Jeka
234
234
New contributor
Jeka is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Jeka is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Jeka is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Can you please upload your system.xml?
– Rohan Hapani
2 hours ago
I added example system.xml in question.
– Jeka
57 mins ago
add a comment |Â
Can you please upload your system.xml?
– Rohan Hapani
2 hours ago
I added example system.xml in question.
– Jeka
57 mins ago
Can you please upload your system.xml?
– Rohan Hapani
2 hours ago
Can you please upload your system.xml?
– Rohan Hapani
2 hours ago
I added example system.xml in question.
– Jeka
57 mins ago
I added example system.xml in question.
– Jeka
57 mins ago
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
2
down vote
accepted
Try this format:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<my_checkout>
<cut_off_time>
<cut_off_time_start>02,00,00</cut_off_time_start>
</cut_off_time>
</my_checkout>
</default>
</config>
You are cool!!! Thank you!!!
– Jeka
38 mins ago
@Jeka Does it works for you?
– Siarhey Uchukhlebau
37 mins ago
I tried separate by "." and ":" but correctly separate by ",".
– Jeka
33 mins ago
Yes, it work for me. Thank you.
– Jeka
33 mins ago
@Jeka Glad to hear it. If my answer has been helpful, please, accept it
– Siarhey Uchukhlebau
32 mins ago
add a comment |Â
up vote
0
down vote
Step 1 : create file in this location for creating configuration fields –
app/code///etc/adminhtml/system.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<section id="payment">
<group id="wkmodule" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1">
<label><![CDATA[Test Payment Module]]></label>
<field id="active" translate="label" type="select" sortOrder="101" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enabled</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
</group>
</section>
Step 2 : Create file to set default values here :
app/code///etc/config.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<payment>
<wkmodule>
<active>0</active>
<------>x</---->
</wkmodule>
</payment>
</default>
For more reference Click here
I know how to set the default value for the "select" and the "text", but I do not know how to do it for the "time".
– Jeka
57 mins ago
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
Try this format:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<my_checkout>
<cut_off_time>
<cut_off_time_start>02,00,00</cut_off_time_start>
</cut_off_time>
</my_checkout>
</default>
</config>
You are cool!!! Thank you!!!
– Jeka
38 mins ago
@Jeka Does it works for you?
– Siarhey Uchukhlebau
37 mins ago
I tried separate by "." and ":" but correctly separate by ",".
– Jeka
33 mins ago
Yes, it work for me. Thank you.
– Jeka
33 mins ago
@Jeka Glad to hear it. If my answer has been helpful, please, accept it
– Siarhey Uchukhlebau
32 mins ago
add a comment |Â
up vote
2
down vote
accepted
Try this format:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<my_checkout>
<cut_off_time>
<cut_off_time_start>02,00,00</cut_off_time_start>
</cut_off_time>
</my_checkout>
</default>
</config>
You are cool!!! Thank you!!!
– Jeka
38 mins ago
@Jeka Does it works for you?
– Siarhey Uchukhlebau
37 mins ago
I tried separate by "." and ":" but correctly separate by ",".
– Jeka
33 mins ago
Yes, it work for me. Thank you.
– Jeka
33 mins ago
@Jeka Glad to hear it. If my answer has been helpful, please, accept it
– Siarhey Uchukhlebau
32 mins ago
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
Try this format:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<my_checkout>
<cut_off_time>
<cut_off_time_start>02,00,00</cut_off_time_start>
</cut_off_time>
</my_checkout>
</default>
</config>
Try this format:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<my_checkout>
<cut_off_time>
<cut_off_time_start>02,00,00</cut_off_time_start>
</cut_off_time>
</my_checkout>
</default>
</config>
answered 44 mins ago


Siarhey Uchukhlebau
8,83692656
8,83692656
You are cool!!! Thank you!!!
– Jeka
38 mins ago
@Jeka Does it works for you?
– Siarhey Uchukhlebau
37 mins ago
I tried separate by "." and ":" but correctly separate by ",".
– Jeka
33 mins ago
Yes, it work for me. Thank you.
– Jeka
33 mins ago
@Jeka Glad to hear it. If my answer has been helpful, please, accept it
– Siarhey Uchukhlebau
32 mins ago
add a comment |Â
You are cool!!! Thank you!!!
– Jeka
38 mins ago
@Jeka Does it works for you?
– Siarhey Uchukhlebau
37 mins ago
I tried separate by "." and ":" but correctly separate by ",".
– Jeka
33 mins ago
Yes, it work for me. Thank you.
– Jeka
33 mins ago
@Jeka Glad to hear it. If my answer has been helpful, please, accept it
– Siarhey Uchukhlebau
32 mins ago
You are cool!!! Thank you!!!
– Jeka
38 mins ago
You are cool!!! Thank you!!!
– Jeka
38 mins ago
@Jeka Does it works for you?
– Siarhey Uchukhlebau
37 mins ago
@Jeka Does it works for you?
– Siarhey Uchukhlebau
37 mins ago
I tried separate by "." and ":" but correctly separate by ",".
– Jeka
33 mins ago
I tried separate by "." and ":" but correctly separate by ",".
– Jeka
33 mins ago
Yes, it work for me. Thank you.
– Jeka
33 mins ago
Yes, it work for me. Thank you.
– Jeka
33 mins ago
@Jeka Glad to hear it. If my answer has been helpful, please, accept it
– Siarhey Uchukhlebau
32 mins ago
@Jeka Glad to hear it. If my answer has been helpful, please, accept it
– Siarhey Uchukhlebau
32 mins ago
add a comment |Â
up vote
0
down vote
Step 1 : create file in this location for creating configuration fields –
app/code///etc/adminhtml/system.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<section id="payment">
<group id="wkmodule" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1">
<label><![CDATA[Test Payment Module]]></label>
<field id="active" translate="label" type="select" sortOrder="101" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enabled</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
</group>
</section>
Step 2 : Create file to set default values here :
app/code///etc/config.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<payment>
<wkmodule>
<active>0</active>
<------>x</---->
</wkmodule>
</payment>
</default>
For more reference Click here
I know how to set the default value for the "select" and the "text", but I do not know how to do it for the "time".
– Jeka
57 mins ago
add a comment |Â
up vote
0
down vote
Step 1 : create file in this location for creating configuration fields –
app/code///etc/adminhtml/system.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<section id="payment">
<group id="wkmodule" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1">
<label><![CDATA[Test Payment Module]]></label>
<field id="active" translate="label" type="select" sortOrder="101" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enabled</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
</group>
</section>
Step 2 : Create file to set default values here :
app/code///etc/config.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<payment>
<wkmodule>
<active>0</active>
<------>x</---->
</wkmodule>
</payment>
</default>
For more reference Click here
I know how to set the default value for the "select" and the "text", but I do not know how to do it for the "time".
– Jeka
57 mins ago
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Step 1 : create file in this location for creating configuration fields –
app/code///etc/adminhtml/system.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<section id="payment">
<group id="wkmodule" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1">
<label><![CDATA[Test Payment Module]]></label>
<field id="active" translate="label" type="select" sortOrder="101" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enabled</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
</group>
</section>
Step 2 : Create file to set default values here :
app/code///etc/config.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<payment>
<wkmodule>
<active>0</active>
<------>x</---->
</wkmodule>
</payment>
</default>
For more reference Click here
Step 1 : create file in this location for creating configuration fields –
app/code///etc/adminhtml/system.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<section id="payment">
<group id="wkmodule" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1">
<label><![CDATA[Test Payment Module]]></label>
<field id="active" translate="label" type="select" sortOrder="101" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enabled</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
</group>
</section>
Step 2 : Create file to set default values here :
app/code///etc/config.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<payment>
<wkmodule>
<active>0</active>
<------>x</---->
</wkmodule>
</payment>
</default>
For more reference Click here
answered 2 hours ago


Chirag Patel
1,656119
1,656119
I know how to set the default value for the "select" and the "text", but I do not know how to do it for the "time".
– Jeka
57 mins ago
add a comment |Â
I know how to set the default value for the "select" and the "text", but I do not know how to do it for the "time".
– Jeka
57 mins ago
I know how to set the default value for the "select" and the "text", but I do not know how to do it for the "time".
– Jeka
57 mins ago
I know how to set the default value for the "select" and the "text", but I do not know how to do it for the "time".
– Jeka
57 mins ago
add a comment |Â
Jeka is a new contributor. Be nice, and check out our Code of Conduct.
Jeka is a new contributor. Be nice, and check out our Code of Conduct.
Jeka is a new contributor. Be nice, and check out our Code of Conduct.
Jeka is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f245691%2fhow-to-set-default-value-for-configuration-field-with-type-time%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Can you please upload your system.xml?
– Rohan Hapani
2 hours ago
I added example system.xml in question.
– Jeka
57 mins ago