1

I am unable to save Category from magento admin.

When i click on save button below error displaying:

Notice: Undefined index: category_id in vendor/magento/module-catalog-url-rewrite/Model/Category/Plugin/Storage.php on line 49

Please help me to fix this issue.

  • 1
    Try composer update and see error still persist or not. – Ravi Bhalodia Sep 21 '16 at 10:53
  • Any updates on this? Did you fix it? – Roy Oct 20 '16 at 14:36
  • Unassigned all the products and saved the category, then again assigned the required products to the category. Now working fine – Sudheer Singamsetti Oct 26 '16 at 8:04
  • @Sudheer: Are you able to fix this issue, please let me know, I also facing this issue. – Purushotam Sharma Jun 6 '18 at 6:09
  • @PurushotamSharma: yes – Sudheer Singamsetti Jul 2 '18 at 15:23
3

Please update your vendor file Storage.php

vendor/magento/module-catalog-url-rewrite/Model/Category/Plugin/Storage.php

$toSave[] = [
                'url_rewrite_id' => $record->getUrlRewriteId(),
                'category_id' => $metadata['category_id'],
                'product_id' => $record->getEntityId(),
            ];

with the below code

if(!empty($metadata)){
                $toSave[] = [
                    'url_rewrite_id' => $record->getUrlRewriteId(),
                    'category_id' => $metadata['category_id'],
                    'product_id' => $record->getEntityId(),
                ];
            }
  • Better override this file instead of directly editing the core file. – MGento Aug 20 '18 at 6:27
  • this is not working.... – Sarfaraj Sipai Nov 19 '18 at 12:00
  • This is working fine !!!! – Ejilarasan J Sep 15 at 7:02
0

Unassigned all the products and saved the category, then again assigned the required products to the category.

  • i have did that but not working. – Sarfaraj Sipai Nov 19 '18 at 12:01
0

I also had this problem when was trying to save category with a huge amount of products. Try to switch "Store View" to some store (not "All store views") on the top of the category admin page and it should help

0

I had the same issue with 2.2.5 I could add the products to the category AFTER i have added the products to the correct website (update attributes => assign to website)

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.