0

I'm running version 1.9.3.2 of Magento Community with the compilation disabled.

Cache folder has been renamed to completely replace it. When I try to delete a Custom Option for a simple product I get the following Warning and nothing appears to happen.

Warning: array_key_exists() expects parameter 2 to be array, null given in /home/devhillcountry/public_html/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php on line 507 

I upgraded this past weekend. This problem was occurring before the upgrade in version 1.9.3.1. Any idea what is causing this and how to fix it?

  • I have an update on this issue. Recently, I created a CMS page and as I was writing the content, I found that I could not save the page. Upon analysis of the problem, I found that I could save the page with this text in the content area. <p>If you do not find what you are looking for, please do not hesitate to call us <span class="C020498-12B">877-755-4455</span>. </p> <p> </p> <h2 style="text-align: center;">Clicking one of the options below will take you to that section.</h2> <p style="text-align: center;"> </p> <p – homepagestore Jul 6 '17 at 20:37
3

Warning: array_key_exists() expects parameter 2 to be array, null given in /home/devhillcountry/public_html/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php on line 507

The action, in which this problem occurs in, is named validateAction. This action is called when Magento tries to validate product attributes.

$attributes = $product->getAttributes();
foreach ($attributes as $attrKey => $attribute) {
    if ($attribute->getBackend()->getType() == 'datetime') {
        if (array_key_exists($attrKey, $productData) && $productData[$attrKey] != ''){
            $dateFields[] = $attrKey;
        }
    }
}

In this bit, it loops through all of the attributes that belongs to the product to find all of the dates associated with the product and appends these to the $dateFields array, which will later be localized to internal format.

$productData[$attrKey] is expected to be an array, null given. This may hint to either missing files or compatibility issues caused by a 3rd party extension.

Try saving the product and see what the console output is. You may see a prototype error, which may give you an idea of the location where the problem occurs.

  • Thank you for the quick response. I saw it a few days ago and went about trying to confirm your suggestions. I created a fresh install of Magento 1.9.3.2, downloaded it to a separate folder and then compared the fresh install to my install using WinMerge. I could find no missing files. Next I looked in all the logs to see if I could see anything that would give a clue, nothing. Next I tried editing many different products with the same custom options to make sure the error was consistent. I found that the error does not occur for every product tested. Some save properly. – richardwendrock May 27 '17 at 21:15
  • On line 482 of ProductController.php shows instruction $productData = $this->getRequest()->getPost('product'); When the routine fails $productData is null. I can't see a reason why the product details are not being returned. Any ideas about how to pinpoint the cause would be appreciated. – richardwendrock May 28 '17 at 14:56
  • Would it be possible somehow to pinpoint the common attribute that causes the request not to post the product information? Does the problem occur during creating a new product with values of only the required attributes? Additionally, logging the request object and comparing it between problematic and not problematic products could be of value. – Andreas Samoilov May 28 '17 at 17:44
  • With the help of our developer, I was able to identify the cause of this problem. The description of the product has this line of text. <p>No more hassles trying to round up the right cables, we already know what you need. Just select the options you want, and we will handle the rest.</p> The word select is causing the problem. If you change the word select to choose. The error goes away and the product can be saved. This product uses custom code to format the product page. Most likely there is an error in the developers code. – richardwendrock Jun 8 '17 at 17:09
  • I still need to determine where the error is occurring when the word select or selection appears in the description. I tested this condition in a normal simple product that uses no special code and found the error does not occur. To be continued... – richardwendrock Jun 8 '17 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.