removing categorty in product page is giving errorMagento2: Could not save product “330664” with position 0 to category 3567How to solve the error : “Could not save product ”20072“ with position 0 to category 7” in magento 2Magento 2.2.4: Could not save product “3395” with position 1 to category 1882Magento 2 Cannot save product (Invalid option value)Get product number in categoryMagento 2: How to Set Bulk Product Position in Category?Magento reindexingMageto2 product listing page random productJS error on product page Cannot read property '' of undefined _getAttributeCodeById which doesnt allow to load configrable price and imageProduct category update issue in magento2Magento 2.2.3 CE unable to add/remove item from wishlist?Magento 2 breadcrumbs issue on product view page?Magento 2.2.4: Could not save product “3395” with position 1 to category 1882

How to not starve gigantic beasts

Why didn't the Space Shuttle bounce back into space as many times as possible so as to lose a lot of kinetic energy up there?

What makes accurate emulation of old systems a difficult task?

Is the claim "Employers won't employ people with no 'social media presence'" realistic?

How do I reattach a shelf to the wall when it ripped out of the wall?

Does tea made with boiling water cool faster than tea made with boiled (but still hot) water?

Get consecutive integer number ranges from list of int

A ​Note ​on ​N!

How could Tony Stark make this in Endgame?

Does a large simulator bay have standard public address announcements?

Which big number is bigger?

Re-entry to Germany after vacation using blue card

Why does Mind Blank stop the Feeblemind spell?

How did Captain America manage to do this?

Apply MapThread to all but one variable

Can someone publish a story that happened to you?

How to fry ground beef so it is well-browned

How much cash can I safely carry into the USA and avoid civil forfeiture?

Multiple options vs single option UI

Can SQL Server create collisions in system generated constraint names?

Philosophical question on logistic regression: why isn't the optimal threshold value trained?

Should the Death Curse affect an undead PC in the Tomb of Annihilation adventure?

Function pointer with named arguments?

Why does nature favour the Laplacian?



removing categorty in product page is giving error


Magento2: Could not save product “330664” with position 0 to category 3567How to solve the error : “Could not save product ”20072“ with position 0 to category 7” in magento 2Magento 2.2.4: Could not save product “3395” with position 1 to category 1882Magento 2 Cannot save product (Invalid option value)Get product number in categoryMagento 2: How to Set Bulk Product Position in Category?Magento reindexingMageto2 product listing page random productJS error on product page Cannot read property '' of undefined _getAttributeCodeById which doesnt allow to load configrable price and imageProduct category update issue in magento2Magento 2.2.3 CE unable to add/remove item from wishlist?Magento 2 breadcrumbs issue on product view page?Magento 2.2.4: Could not save product “3395” with position 1 to category 1882






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








-1















We are facing issues - https://prnt.sc/mgdybf why we are not able to remove the Deal and Pre Owned category.





Could not save product "26652" with position 0 to category 435





What is this error message about? How to solve this issue?



Regards
Rachna










share|improve this question

















  • 1





    Possible duplicate of How to solve the error : "Could not save product "20072" with position 0 to category 7" in magento 2

    – sv3n
    6 hours ago











  • Or magento.stackexchange.com/questions/213541/…

    – sv3n
    6 hours ago

















-1















We are facing issues - https://prnt.sc/mgdybf why we are not able to remove the Deal and Pre Owned category.





Could not save product "26652" with position 0 to category 435





What is this error message about? How to solve this issue?



Regards
Rachna










share|improve this question

















  • 1





    Possible duplicate of How to solve the error : "Could not save product "20072" with position 0 to category 7" in magento 2

    – sv3n
    6 hours ago











  • Or magento.stackexchange.com/questions/213541/…

    – sv3n
    6 hours ago













-1












-1








-1








We are facing issues - https://prnt.sc/mgdybf why we are not able to remove the Deal and Pre Owned category.





Could not save product "26652" with position 0 to category 435





What is this error message about? How to solve this issue?



Regards
Rachna










share|improve this question














We are facing issues - https://prnt.sc/mgdybf why we are not able to remove the Deal and Pre Owned category.





Could not save product "26652" with position 0 to category 435





What is this error message about? How to solve this issue?



Regards
Rachna







magento2 product category indexing






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Feb 7 at 13:13









Rachna ThakurRachna Thakur

365




365







  • 1





    Possible duplicate of How to solve the error : "Could not save product "20072" with position 0 to category 7" in magento 2

    – sv3n
    6 hours ago











  • Or magento.stackexchange.com/questions/213541/…

    – sv3n
    6 hours ago












  • 1





    Possible duplicate of How to solve the error : "Could not save product "20072" with position 0 to category 7" in magento 2

    – sv3n
    6 hours ago











  • Or magento.stackexchange.com/questions/213541/…

    – sv3n
    6 hours ago







1




1





Possible duplicate of How to solve the error : "Could not save product "20072" with position 0 to category 7" in magento 2

– sv3n
6 hours ago





Possible duplicate of How to solve the error : "Could not save product "20072" with position 0 to category 7" in magento 2

– sv3n
6 hours ago













Or magento.stackexchange.com/questions/213541/…

– sv3n
6 hours ago





Or magento.stackexchange.com/questions/213541/…

– sv3n
6 hours ago










1 Answer
1






active

oldest

votes


















1














Update



Some people have faced this issue already and have a solution. Check these posts



Magento2: Could not save product "330664" with position 0 to category 3567



https://github.com/magento/magento2/issues/8970



The error is from the CategoryLinkRepository File from module-catalog which handles the save functionality. Check your exception log for more details, which tells you exactly why you couldn't save the product. Hope am pointing you to the right direction. Check also deleteByIds method, it can be the potential cause of this issue.



/**
* @inheritdoc
*/
public function deleteByIds($categoryId, $sku)

$category = $this->categoryRepository->get($categoryId);
$product = $this->productRepository->get($sku);
$productPositions = $category->getProductsPosition();

$productID = $product->getId();
if (!isset($productPositions[$productID]))
throw new InputException(__('Category does not contain specified product'));

$backupPosition = $productPositions[$productID];
unset($productPositions[$productID]);

$category->setPostedProducts($productPositions);
try
$category->save();
catch (Exception $e)
throw new CouldNotSaveException(
__(
'Could not save product "%product" with position %position to category %category',
[
"product" => $product->getId(),
"position" => $backupPosition,
"category" => $category->getId()
]
),
$e
);

return true;




magentovendormagentomodule-catalogModelCategoryLinkRepository.php




/**
* @inheritdoc
*/
public function save(MagentoCatalogApiDataCategoryProductLinkInterface $productLink)

$category = $this->categoryRepository->get($productLink->getCategoryId());
$product = $this->productRepository->get($productLink->getSku());
$productPositions = $category->getProductsPosition();
$productPositions[$product->getId()] = $productLink->getPosition();
$category->setPostedProducts($productPositions);
try
$category->save();
catch (Exception $e)
throw new CouldNotSaveException(
__(
'Could not save product "%1" with position %2 to category %3',
$product->getId(),
$productLink->getPosition(),
$category->getId()
),
$e
);

return true;






share|improve this answer

























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "479"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f260866%2fremoving-categorty-in-product-page-is-giving-error%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Update



    Some people have faced this issue already and have a solution. Check these posts



    Magento2: Could not save product "330664" with position 0 to category 3567



    https://github.com/magento/magento2/issues/8970



    The error is from the CategoryLinkRepository File from module-catalog which handles the save functionality. Check your exception log for more details, which tells you exactly why you couldn't save the product. Hope am pointing you to the right direction. Check also deleteByIds method, it can be the potential cause of this issue.



    /**
    * @inheritdoc
    */
    public function deleteByIds($categoryId, $sku)

    $category = $this->categoryRepository->get($categoryId);
    $product = $this->productRepository->get($sku);
    $productPositions = $category->getProductsPosition();

    $productID = $product->getId();
    if (!isset($productPositions[$productID]))
    throw new InputException(__('Category does not contain specified product'));

    $backupPosition = $productPositions[$productID];
    unset($productPositions[$productID]);

    $category->setPostedProducts($productPositions);
    try
    $category->save();
    catch (Exception $e)
    throw new CouldNotSaveException(
    __(
    'Could not save product "%product" with position %position to category %category',
    [
    "product" => $product->getId(),
    "position" => $backupPosition,
    "category" => $category->getId()
    ]
    ),
    $e
    );

    return true;




    magentovendormagentomodule-catalogModelCategoryLinkRepository.php




    /**
    * @inheritdoc
    */
    public function save(MagentoCatalogApiDataCategoryProductLinkInterface $productLink)

    $category = $this->categoryRepository->get($productLink->getCategoryId());
    $product = $this->productRepository->get($productLink->getSku());
    $productPositions = $category->getProductsPosition();
    $productPositions[$product->getId()] = $productLink->getPosition();
    $category->setPostedProducts($productPositions);
    try
    $category->save();
    catch (Exception $e)
    throw new CouldNotSaveException(
    __(
    'Could not save product "%1" with position %2 to category %3',
    $product->getId(),
    $productLink->getPosition(),
    $category->getId()
    ),
    $e
    );

    return true;






    share|improve this answer





























      1














      Update



      Some people have faced this issue already and have a solution. Check these posts



      Magento2: Could not save product "330664" with position 0 to category 3567



      https://github.com/magento/magento2/issues/8970



      The error is from the CategoryLinkRepository File from module-catalog which handles the save functionality. Check your exception log for more details, which tells you exactly why you couldn't save the product. Hope am pointing you to the right direction. Check also deleteByIds method, it can be the potential cause of this issue.



      /**
      * @inheritdoc
      */
      public function deleteByIds($categoryId, $sku)

      $category = $this->categoryRepository->get($categoryId);
      $product = $this->productRepository->get($sku);
      $productPositions = $category->getProductsPosition();

      $productID = $product->getId();
      if (!isset($productPositions[$productID]))
      throw new InputException(__('Category does not contain specified product'));

      $backupPosition = $productPositions[$productID];
      unset($productPositions[$productID]);

      $category->setPostedProducts($productPositions);
      try
      $category->save();
      catch (Exception $e)
      throw new CouldNotSaveException(
      __(
      'Could not save product "%product" with position %position to category %category',
      [
      "product" => $product->getId(),
      "position" => $backupPosition,
      "category" => $category->getId()
      ]
      ),
      $e
      );

      return true;




      magentovendormagentomodule-catalogModelCategoryLinkRepository.php




      /**
      * @inheritdoc
      */
      public function save(MagentoCatalogApiDataCategoryProductLinkInterface $productLink)

      $category = $this->categoryRepository->get($productLink->getCategoryId());
      $product = $this->productRepository->get($productLink->getSku());
      $productPositions = $category->getProductsPosition();
      $productPositions[$product->getId()] = $productLink->getPosition();
      $category->setPostedProducts($productPositions);
      try
      $category->save();
      catch (Exception $e)
      throw new CouldNotSaveException(
      __(
      'Could not save product "%1" with position %2 to category %3',
      $product->getId(),
      $productLink->getPosition(),
      $category->getId()
      ),
      $e
      );

      return true;






      share|improve this answer



























        1












        1








        1







        Update



        Some people have faced this issue already and have a solution. Check these posts



        Magento2: Could not save product "330664" with position 0 to category 3567



        https://github.com/magento/magento2/issues/8970



        The error is from the CategoryLinkRepository File from module-catalog which handles the save functionality. Check your exception log for more details, which tells you exactly why you couldn't save the product. Hope am pointing you to the right direction. Check also deleteByIds method, it can be the potential cause of this issue.



        /**
        * @inheritdoc
        */
        public function deleteByIds($categoryId, $sku)

        $category = $this->categoryRepository->get($categoryId);
        $product = $this->productRepository->get($sku);
        $productPositions = $category->getProductsPosition();

        $productID = $product->getId();
        if (!isset($productPositions[$productID]))
        throw new InputException(__('Category does not contain specified product'));

        $backupPosition = $productPositions[$productID];
        unset($productPositions[$productID]);

        $category->setPostedProducts($productPositions);
        try
        $category->save();
        catch (Exception $e)
        throw new CouldNotSaveException(
        __(
        'Could not save product "%product" with position %position to category %category',
        [
        "product" => $product->getId(),
        "position" => $backupPosition,
        "category" => $category->getId()
        ]
        ),
        $e
        );

        return true;




        magentovendormagentomodule-catalogModelCategoryLinkRepository.php




        /**
        * @inheritdoc
        */
        public function save(MagentoCatalogApiDataCategoryProductLinkInterface $productLink)

        $category = $this->categoryRepository->get($productLink->getCategoryId());
        $product = $this->productRepository->get($productLink->getSku());
        $productPositions = $category->getProductsPosition();
        $productPositions[$product->getId()] = $productLink->getPosition();
        $category->setPostedProducts($productPositions);
        try
        $category->save();
        catch (Exception $e)
        throw new CouldNotSaveException(
        __(
        'Could not save product "%1" with position %2 to category %3',
        $product->getId(),
        $productLink->getPosition(),
        $category->getId()
        ),
        $e
        );

        return true;






        share|improve this answer















        Update



        Some people have faced this issue already and have a solution. Check these posts



        Magento2: Could not save product "330664" with position 0 to category 3567



        https://github.com/magento/magento2/issues/8970



        The error is from the CategoryLinkRepository File from module-catalog which handles the save functionality. Check your exception log for more details, which tells you exactly why you couldn't save the product. Hope am pointing you to the right direction. Check also deleteByIds method, it can be the potential cause of this issue.



        /**
        * @inheritdoc
        */
        public function deleteByIds($categoryId, $sku)

        $category = $this->categoryRepository->get($categoryId);
        $product = $this->productRepository->get($sku);
        $productPositions = $category->getProductsPosition();

        $productID = $product->getId();
        if (!isset($productPositions[$productID]))
        throw new InputException(__('Category does not contain specified product'));

        $backupPosition = $productPositions[$productID];
        unset($productPositions[$productID]);

        $category->setPostedProducts($productPositions);
        try
        $category->save();
        catch (Exception $e)
        throw new CouldNotSaveException(
        __(
        'Could not save product "%product" with position %position to category %category',
        [
        "product" => $product->getId(),
        "position" => $backupPosition,
        "category" => $category->getId()
        ]
        ),
        $e
        );

        return true;




        magentovendormagentomodule-catalogModelCategoryLinkRepository.php




        /**
        * @inheritdoc
        */
        public function save(MagentoCatalogApiDataCategoryProductLinkInterface $productLink)

        $category = $this->categoryRepository->get($productLink->getCategoryId());
        $product = $this->productRepository->get($productLink->getSku());
        $productPositions = $category->getProductsPosition();
        $productPositions[$product->getId()] = $productLink->getPosition();
        $category->setPostedProducts($productPositions);
        try
        $category->save();
        catch (Exception $e)
        throw new CouldNotSaveException(
        __(
        'Could not save product "%1" with position %2 to category %3',
        $product->getId(),
        $productLink->getPosition(),
        $category->getId()
        ),
        $e
        );

        return true;







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Feb 7 at 13:38

























        answered Feb 7 at 13:33









        HaijeromeHaijerome

        1,0661119




        1,0661119



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f260866%2fremoving-categorty-in-product-page-is-giving-error%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Nidaros erkebispedøme

            Birsay

            Where did Arya get these scars? Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manara Favourite questions and answers from the 1st quarter of 2019Why did Arya refuse to end it?Has the pronunciation of Arya Stark's name changed?Has Arya forgiven people?Why did Arya Stark lose her vision?Why can Arya still use the faces?Has the Narrow Sea become narrower?Does Arya Stark know how to make poisons outside of the House of Black and White?Why did Nymeria leave Arya?Why did Arya not kill the Lannister soldiers she encountered in the Riverlands?What is the current canonical age of Sansa, Bran and Arya Stark?