Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRITICAL: Notice: Undefined index: dataScopePrefix #65

Open
hiteshagrawal84 opened this issue Apr 23, 2019 · 20 comments
Open

CRITICAL: Notice: Undefined index: dataScopePrefix #65

hiteshagrawal84 opened this issue Apr 23, 2019 · 20 comments

Comments

@hiteshagrawal84
Copy link

Hi

I am getting below error on checkout page

[2019-04-23 07:10:21] report.CRITICAL: Notice: Undefined index: dataScopePrefix in /var/www/html/fatcat/vendor/magento/module-customer-custom-attributes/Block/Checkout/LayoutProcessor.php on line 72 [] []

@anjuvineesh
Copy link

Is this issue solved yet? I'm also facing the same

@bayas025
Copy link

Facing same issue, Is there any solution?

@hiteshgb
Copy link

Yes I have fixed it but I don't remember how i fixed it but if you need code I can provide my code. for city dropdown

@bayas025
Copy link

Please, It will help me to debug at my end also.

@hiteshgb
Copy link

Sure no issue. will send you code by tomorrow. just give me a reminder tomorrow.

@bayas025
Copy link

Sure

@hiteshgb
Copy link

Also I would like you to join our page https://www.facebook.com/phpdevelopers and spread over your friends, I have created this page to keep updated people about new openings for php and magento developers so needed people can get jobs and also we are posting latest tech news daily basis.

Appreciate if you like to contribute your few secs for us.

@bayas025
Copy link

could you please give me your code so if it help me to resolve my issue

@hiteshgb
Copy link

`<?php

namespace Namespace\Checkout\Plugin\Checkout;

use Magento\Checkout\Block\Checkout\LayoutProcessor;
use Namespace\Checkout\Helper\Data;

/**

  • Add area
    */
    class LayoutProcessorPlugin
    {

    /**

    • @var Data
      */
      protected $helper;

    /**

    • LayoutProcessor constructor.
    • @param Data $helper
      */
      public function __construct(Data $helper)
      {
      $this->helper = $helper;
      }

    /**

    • @param \Magento\Checkout\Block\Checkout\LayoutProcessor $subject

    • @param array $jsLayout

    • @return array
      */
      public function afterProcess(
      LayoutProcessor $subject,
      array $jsLayout
      ) {
      $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
      ['shippingAddress']['children']['shipping-address-fieldset']['children']['drop_down'] = [
      'component' => 'Ffc_Checkout/js/form/element/city',
      'config' => [
      'customScope' => 'shippingAddress',
      'template' => 'ui/form/field',
      'elementTmpl' => 'ui/form/element/select',
      'id' => 'city',
      ],
      'dataScope' => 'shippingAddress.city',
      'label' => 'Area',
      'provider' => 'checkoutProvider',
      'visible' => true,
      'validation' => [
      "required-entry" => true,
      ],
      'sortOrder' => 110,
      'id' => 'city',
      'options' => [
      [
      'value' => '',
      'label' => 'Please Select',
      ],
      ]

      ];

      if (isset($jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']
      ['children']['shippingAddress']['children']['shipping-address-fieldset']['children'])) {
      $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']
      ['children']['shippingAddress']['children']['shipping-address-fieldset']['children']
      ['telephone'] = $this->helper->telephoneFieldConfig("shippingAddress");
      }

      // Added auto completion address field for google address suggestion
      $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']
      ['children']['shippingAddress']['children']['shipping-address-fieldset']['children']
      ['street']['children'][0]['component'] = 'Amasty_Checkout/js/form/element/autocomplete';

      return $jsLayout;
      }
      }//end class
      `

@Elema82
Copy link

Elema82 commented Mar 2, 2020

Hi! I need to solve the same problem @hiteshgb can you tell me how to add this class in this extension? thanks!
I added this class and is broken my store

`<?php

namespace Eadesigndev\RomCity\Plugin\Checkout;

use Magento\Checkout\Block\Checkout\LayoutProcessor;
use Eadesigndev\RomCity\Helper\Data;

/**

Add area
*/
class LayoutProcessorPlugin
{

/**

@var Data
 */
protected $helper;
/**

LayoutProcessor constructor.
@param Data $helper
 */
public function __construct(Data $helper)
{
    $this->helper = $helper;
}
/**

@param \Magento\Checkout\Block\Checkout\LayoutProcessor $subject

@param array $jsLayout

@return array
 */
public function afterProcess(
    LayoutProcessor $subject,
    array $jsLayout
) {
    $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
    ['shippingAddress']['children']['shipping-address-fieldset']['children']['drop_down'] = [
        'component' => 'Ffc_Checkout/js/form/element/city',
        'config' => [
            'customScope' => 'shippingAddress',
            'template' => 'ui/form/field',
            'elementTmpl' => 'ui/form/element/select',
            'id' => 'city',
        ],
        'dataScope' => 'shippingAddress.city',
        'label' => 'Area',
        'provider' => 'checkoutProvider',
        'visible' => true,
        'validation' => [
            "required-entry" => true,
        ],
        'sortOrder' => 110,
        'id' => 'city',
        'options' => [
            [
                'value' => '',
                'label' => 'Please Select',
            ],
        ]

    ];

    if (isset($jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']
        ['children']['shippingAddress']['children']['shipping-address-fieldset']['children'])) {
        $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']
        ['children']['shippingAddress']['children']['shipping-address-fieldset']['children']
        ['telephone'] = $this->helper->telephoneFieldConfig("shippingAddress");
    }

// Added auto completion address field for google address suggestion
$jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']
['children']['shippingAddress']['children']['shipping-address-fieldset']['children']
['street']['children'][0]['component'] = 'Amasty_Checkout/js/form/element/autocomplete';

    return $jsLayout;
}

}//end class`

@hiteshgb
Copy link

hiteshgb commented Mar 3, 2020

@Elema82 You need to add code as per your requirement not complete class as it is as per my store. Please let me know if still you are facing issue.

@Elema82
Copy link

Elema82 commented Mar 3, 2020

@hiteshgb thanks. yes, I founded this error when I tried to enter on the checkout.
I modified the file 'Eadesigndev\RomCity\Plugin\Checkout\BillingAddressLayoutProcessor.php' on line 50 and I added this line:
''dataScopePrefix' => 'shippingAddress' "

and I still with the same error.

On my store I have magento 2.3.3 version

Captura de Pantalla 2020-03-03 a la(s) 09 58 41

Captura de Pantalla 2020-03-03 a la(s) 10 09 18

@hiteshgb
Copy link

hiteshgb commented Mar 3, 2020

okay allow me some time I will give you the solution to fix it. please let me know if you are using CE or EE version.

@Elema82
Copy link

Elema82 commented Mar 3, 2020

I'm working with magento cloud, I think that is the enterprise edition

@Elema82
Copy link

Elema82 commented Mar 4, 2020

hi @hiteshgb I added on this file Eadesigndev/RomCity/Plugin/Checkout/BillingAddressLayoutProcessor.php line 87 :

$this->result['components']['checkout']['children']['steps']['children']['billing-step']['children'] ['payment']['children']['payments-list']['children'][$paymentMethodForm]['dataScopePrefix'] = 'customCheckoutForm';

and I dont see the warning again

@hiteshagrawal84
Copy link
Author

okay so its working fine now?

@Elema82
Copy link

Elema82 commented Mar 5, 2020

this warning? its ok, I found other bugs

@vrajeshpatel4u
Copy link

Any Update here ? I am also facing same issue.

@reense
Copy link

reense commented Jul 9, 2021

@Elema82 did you ever find the root cause of this problem? I'm facing this issue as well on Magento Commerce 2.4.2.

@giangvdm
Copy link

hi @hiteshgb I added on this file Eadesigndev/RomCity/Plugin/Checkout/BillingAddressLayoutProcessor.php line 87 :

$this->result['components']['checkout']['children']['steps']['children']['billing-step']['children'] ['payment']['children']['payments-list']['children'][$paymentMethodForm]['dataScopePrefix'] = 'customCheckoutForm';

and I dont see the warning again

This seems to be a reasonable quick fix for now. It works for me. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants