Question

I'm getting this error when going to a custom extension's (IWD_Opc) admin configuration page.

Undefined index: label in .../vendor/magento/framework/Data/Form/Element/Select.php on line 68

Any ideas what this error means or how to go about fixing it?

Using Magento 2.2.2.

This seems to be connected with /etc/adminhtml/system.xml with one of the fields, still not sure which one or why this is happening...

EDIT

It's connected with a new custom payment method and the system config field:

<field id="default_payment_method" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
      <label>Default Payment Method</label>
      <source_model>IWD\Opc\Model\Config\Source\Payment</source_model>
</field>

Model code is:

use Magento\Payment\Model\Config\Source\Allmethods;

class Payment extends Allmethods
{
    public function toOptionArray()
    {
        $options = parent::toOptionArray();
        array_unshift($options, ['value' => '', 'label' => '-- Please select a payment method --']);
        return $options;
    }
}

So I presume that my custom payment method is not registered properly to be included in the Allmethods class?

Was it helpful?

Solution

Was just a typo in my custom payment method's /etc/config.xml

<group>Offline</group>

Should be

<group>offline</group>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top