我需要检索我在Magento插件的system.xml文件中设置的配置设置。
我已经在我的配置文件中设置了插件字段,并尝试在javscript文件中检索它们。这可能吗?
'function
Private Function GetNumbers(ByVal sumValue As Integer) As Integer()
Dim seqNumbers As Integer() = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536}
Dim seqNumbersInSum As New ArrayList
'run through all numbers of the sequence.
For seqIndex As Integer = UBound(seqNumbers) To 0 Step -1
'don't use numbers of the sequence larger than the current sum value.
If seqNumbers(seqIndex) > sumValue Then
Continue For
End If
'subtract the current sequence number from sum value. Also add the used sequence number to the array list of used sequence numbers.
sumValue -= seqNumbers(seqIndex)
seqNumbersInSum.Add(seqNumbers(seqIndex))
'in case the sum the result is 0 all sequence numbers are found.
If sumValue = 0 Then
Exit For
End If
Next
'return the used sequence numbers.
Return seqNumbersInSum.ToArray(GetType(Integer))
End Function
'usage
GetNumbers(162) ' {128, 32, 2}
GetNumbers(80) ' {64, 16}
GetNumbers(64) ' {64}
以下是我在JavaScript文件中尝试过的内容
<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="custompayment" translate="label" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Emipro Payment</label>
<field id="active" translate="label comment" sortOrder="1" type="select" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Enable</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="title" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Title</label>
</field>
<field id="businessID" translate="label" type="text" sortOrder="65" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Business ID</label>
</field>
<field id="password" translate="label" type="text" sortOrder="66" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Password</label>
</field>
</group>
</section>
</system>
</config>