postcodeservice/postcode-magento2

Notice: Undefined index: dataScopePrefix vendor/tig/postcode-magento2/Plugin/Address/LayoutProcessor.php on line 122

martijn-bigbridge opened this issue · 2 comments

Magento:2.2.6
TIG Magento 2 Postcode extension: 1.1.11
Checkout usage: Two Step Checkout Blank

At the checkout page I get this message.

Notice: Undefined index: dataScopePrefix in xxxx/vendor/tig/postcode-magento2/Plugin/Address/LayoutProcessor.php on line 122

Is it oke to ignore this message using this edit?

$billingFields['children']['form-fields']['children'] = $this->processAddress(
$billingFields['children']['form-fields']['children'],
'', <<-- // $billingFields['dataScopePrefix'],
[]
);

Hi @martijn-bigbridge,

The key dataScopePrefix is a ui component defined by Magento.

Magento file where you can find this.
https://github.com/magento/magento2/blob/5c82b225c700436ab0f14ad281b025fb0e75b3ad/app/code/Magento/Checkout/Block/Checkout/LayoutProcessor.php#L282

And example where it is used and for what.
https://github.com/magento/magento2/blob/5c82b225c700436ab0f14ad281b025fb0e75b3ad/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js#L152

The dataScopePrefix is used in more places, so i should advice to try and find out why this key is not defined.

Also i noticed that you specify the line 122, but that refers to the $billingForm array which is in the billing field per billing method renderer. But than you ask about the row which uses the $billingFields array as input. Which refers to line 152 which means you are in the processSingleBillingForm method.

If what i say is correct, you could try to change the checkout/option/display_billing_address_on value to Payment method instead of Payment Page. Go to Stores => Configuration => Checkout => Checkout Options => Display Billing Address On.

image

If you still get the same error after changing this config to Payment Method. You can (temporary) put it back on Payment Page and replace $billingFields['dataScopePrefix'] with the string billingAddressshared which is the prefix default defined by Magento.

But be aware if you update the extension with composer you will lose your changes.

@tig-rikjonkmans

Thanks for the information.
Our client want to use Billing address on the "Payment Page", but for now we can fix it with the default Magento value.