How to set default value for configuration field with type time

The name of the pictureThe name of the pictureThe name of the pictureClash 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.










share|improve this question









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
















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.










share|improve this question









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












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.










share|improve this question









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






share|improve this question









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.











share|improve this question









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.









share|improve this question




share|improve this question








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
















  • 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










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>





share|improve this answer




















  • 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

















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






share|improve this answer




















  • 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










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);






Jeka is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















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






























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>





share|improve this answer




















  • 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














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>





share|improve this answer




















  • 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












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>





share|improve this answer












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>






share|improve this answer












share|improve this answer



share|improve this answer










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
















  • 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












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






share|improve this answer




















  • 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














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






share|improve this answer




















  • 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












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






share|improve this answer












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







share|improve this answer












share|improve this answer



share|improve this answer










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
















  • 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










Jeka is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















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.













 


draft saved


draft discarded














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













































































Comments

Popular posts from this blog

What does second last employer means? [closed]

List of Gilmore Girls characters

One-line joke