Magento2 - create new/update category programmatically for specific storeView not workingHow to update product position (number) in specific category programmaticallyProgrammatically create a Smart Category Rulesupdate category attributes programmaticallysaving new category programmatically with setPathShipment create not working programmaticallyCannot create category in magento2Programmatically created product Urls are not generated for french storeview in Magento 2Magento2: How can update & create the CMS static Page programmaticallyMagento 2 Use Default Value for Category Image is not working for a specific storeviewMagento 2 category updated programmatically not working

What is the most expensive material in the world that could be used to create Pun-Pun's lute?

Critique of timeline aesthetic

How exactly does Hawking radiation decrease the mass of black holes?

Minor Revision with suggestion of an alternative proof by reviewer

How to limit Drive Letters Windows assigns to new removable USB drives

What is the smallest unit of eos?

What makes accurate emulation of old systems a difficult task?

How can I practically buy stocks?

How to fry ground beef so it is well-browned

Phrase for the opposite of "foolproof"

Why does Mind Blank stop the Feeblemind spell?

555 timer FM transmitter

Extension of 2-adic valuation to the real numbers

Can someone publish a story that happened to you?

Could the terminal length of components like resistors be reduced?

What is causing the white spot to appear in some of my pictures

What are the steps to solving this definite integral?

What does ゆーか mean?

Two field separators (colon and space) in awk

Don’t seats that recline flat defeat the purpose of having seatbelts?

A ​Note ​on ​N!

How to have a sharp product image?

How to denote matrix elements succinctly?

On The Origin of Dissonant Chords



Magento2 - create new/update category programmatically for specific storeView not working


How to update product position (number) in specific category programmaticallyProgrammatically create a Smart Category Rulesupdate category attributes programmaticallysaving new category programmatically with setPathShipment create not working programmaticallyCannot create category in magento2Programmatically created product Urls are not generated for french storeview in Magento 2Magento2: How can update & create the CMS static Page programmaticallyMagento 2 Use Default Value for Category Image is not working for a specific storeviewMagento 2 category updated programmatically not working






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








2















When I try to update a category category name programmatically only for StoreView 2, it does not work.



The changes will go to StoreView 1 every time and not to the StoreView that I defined:





use MagentoFrameworkAppBootstrap;

include('app/bootstrap.php');

$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$category = $objectManager->get('MagentoCatalogModelCategory')->load(78);

$d["updated_at"] = "2016-10-14 10:22:34";
$d["entity_id"] = "78";
$d["psl_wawi_cat_id"] = "42";
$d["position"] = "10";
$d["is_active"] = "1";
$d["store_id"] = "2";
$d["store"] = "2";
$d["storeid"] = "2";
$d["is_anchor"] = "1";
$d["name"] = "TESTA-1_ENG";
$d["custom_design_from"] = "";
$d["custom_design_to"] = "";
$d["include_in_menu"] = "1";
$d["default_sort_by"] = "";
$d["path"] = "1/2/74/78";
$d["level"] = "3";
$d["url_key"] = "testa-1-eng";
$d["attribute_set_id"] = "3";
$category->setData($d);
$category->setStoreId(2);

$categoryFactory=$objectManager->get('MagentoCatalogApiCategoryRepositoryInterface')->save($category);



After running this script the name of the category is "TESTA-1_ENG" in StoreView 1 but not in StoreView 2.
StoreView 2 still has the original name from the create process.



I think this may be a bug?
Every save process will only affect StoreView 1 and not to the StoreView that I defined.










share|improve this question
















bumped to the homepage by Community 7 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.





















    2















    When I try to update a category category name programmatically only for StoreView 2, it does not work.



    The changes will go to StoreView 1 every time and not to the StoreView that I defined:





    use MagentoFrameworkAppBootstrap;

    include('app/bootstrap.php');

    $bootstrap = Bootstrap::create(BP, $_SERVER);
    $objectManager = $bootstrap->getObjectManager();
    $category = $objectManager->get('MagentoCatalogModelCategory')->load(78);

    $d["updated_at"] = "2016-10-14 10:22:34";
    $d["entity_id"] = "78";
    $d["psl_wawi_cat_id"] = "42";
    $d["position"] = "10";
    $d["is_active"] = "1";
    $d["store_id"] = "2";
    $d["store"] = "2";
    $d["storeid"] = "2";
    $d["is_anchor"] = "1";
    $d["name"] = "TESTA-1_ENG";
    $d["custom_design_from"] = "";
    $d["custom_design_to"] = "";
    $d["include_in_menu"] = "1";
    $d["default_sort_by"] = "";
    $d["path"] = "1/2/74/78";
    $d["level"] = "3";
    $d["url_key"] = "testa-1-eng";
    $d["attribute_set_id"] = "3";
    $category->setData($d);
    $category->setStoreId(2);

    $categoryFactory=$objectManager->get('MagentoCatalogApiCategoryRepositoryInterface')->save($category);



    After running this script the name of the category is "TESTA-1_ENG" in StoreView 1 but not in StoreView 2.
    StoreView 2 still has the original name from the create process.



    I think this may be a bug?
    Every save process will only affect StoreView 1 and not to the StoreView that I defined.










    share|improve this question
















    bumped to the homepage by Community 7 hours ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

















      2












      2








      2








      When I try to update a category category name programmatically only for StoreView 2, it does not work.



      The changes will go to StoreView 1 every time and not to the StoreView that I defined:





      use MagentoFrameworkAppBootstrap;

      include('app/bootstrap.php');

      $bootstrap = Bootstrap::create(BP, $_SERVER);
      $objectManager = $bootstrap->getObjectManager();
      $category = $objectManager->get('MagentoCatalogModelCategory')->load(78);

      $d["updated_at"] = "2016-10-14 10:22:34";
      $d["entity_id"] = "78";
      $d["psl_wawi_cat_id"] = "42";
      $d["position"] = "10";
      $d["is_active"] = "1";
      $d["store_id"] = "2";
      $d["store"] = "2";
      $d["storeid"] = "2";
      $d["is_anchor"] = "1";
      $d["name"] = "TESTA-1_ENG";
      $d["custom_design_from"] = "";
      $d["custom_design_to"] = "";
      $d["include_in_menu"] = "1";
      $d["default_sort_by"] = "";
      $d["path"] = "1/2/74/78";
      $d["level"] = "3";
      $d["url_key"] = "testa-1-eng";
      $d["attribute_set_id"] = "3";
      $category->setData($d);
      $category->setStoreId(2);

      $categoryFactory=$objectManager->get('MagentoCatalogApiCategoryRepositoryInterface')->save($category);



      After running this script the name of the category is "TESTA-1_ENG" in StoreView 1 but not in StoreView 2.
      StoreView 2 still has the original name from the create process.



      I think this may be a bug?
      Every save process will only affect StoreView 1 and not to the StoreView that I defined.










      share|improve this question
















      When I try to update a category category name programmatically only for StoreView 2, it does not work.



      The changes will go to StoreView 1 every time and not to the StoreView that I defined:





      use MagentoFrameworkAppBootstrap;

      include('app/bootstrap.php');

      $bootstrap = Bootstrap::create(BP, $_SERVER);
      $objectManager = $bootstrap->getObjectManager();
      $category = $objectManager->get('MagentoCatalogModelCategory')->load(78);

      $d["updated_at"] = "2016-10-14 10:22:34";
      $d["entity_id"] = "78";
      $d["psl_wawi_cat_id"] = "42";
      $d["position"] = "10";
      $d["is_active"] = "1";
      $d["store_id"] = "2";
      $d["store"] = "2";
      $d["storeid"] = "2";
      $d["is_anchor"] = "1";
      $d["name"] = "TESTA-1_ENG";
      $d["custom_design_from"] = "";
      $d["custom_design_to"] = "";
      $d["include_in_menu"] = "1";
      $d["default_sort_by"] = "";
      $d["path"] = "1/2/74/78";
      $d["level"] = "3";
      $d["url_key"] = "testa-1-eng";
      $d["attribute_set_id"] = "3";
      $category->setData($d);
      $category->setStoreId(2);

      $categoryFactory=$objectManager->get('MagentoCatalogApiCategoryRepositoryInterface')->save($category);



      After running this script the name of the category is "TESTA-1_ENG" in StoreView 1 but not in StoreView 2.
      StoreView 2 still has the original name from the create process.



      I think this may be a bug?
      Every save process will only affect StoreView 1 and not to the StoreView that I defined.







      magento-2.1 category programmatically






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Oct 22 '18 at 9:20









      Shashank Kumrawat

      1,3211343




      1,3211343










      asked Oct 14 '16 at 11:06









      user3710936user3710936

      113




      113





      bumped to the homepage by Community 7 hours ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 7 hours ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






















          1 Answer
          1






          active

          oldest

          votes


















          0














          You must load category with specific store id, If you need to change details of specific store.



          Please use below code to modify category details for specific store.



          $category = $objectManager->create('MagentoCatalogModelCategoryFactory')->create()->setStoreId(2)->load(78);
          $category->setName('TESTA-1_ENG');
          $category->save();





          share|improve this answer























          • no its not working, category name is not updating

            – jafar pinjar
            Sep 10 '18 at 12:44











          • It is working fine for me.

            – Bhavin iFlair
            Sep 12 '18 at 12:03











          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%2f140890%2fmagento2-create-new-update-category-programmatically-for-specific-storeview-no%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









          0














          You must load category with specific store id, If you need to change details of specific store.



          Please use below code to modify category details for specific store.



          $category = $objectManager->create('MagentoCatalogModelCategoryFactory')->create()->setStoreId(2)->load(78);
          $category->setName('TESTA-1_ENG');
          $category->save();





          share|improve this answer























          • no its not working, category name is not updating

            – jafar pinjar
            Sep 10 '18 at 12:44











          • It is working fine for me.

            – Bhavin iFlair
            Sep 12 '18 at 12:03















          0














          You must load category with specific store id, If you need to change details of specific store.



          Please use below code to modify category details for specific store.



          $category = $objectManager->create('MagentoCatalogModelCategoryFactory')->create()->setStoreId(2)->load(78);
          $category->setName('TESTA-1_ENG');
          $category->save();





          share|improve this answer























          • no its not working, category name is not updating

            – jafar pinjar
            Sep 10 '18 at 12:44











          • It is working fine for me.

            – Bhavin iFlair
            Sep 12 '18 at 12:03













          0












          0








          0







          You must load category with specific store id, If you need to change details of specific store.



          Please use below code to modify category details for specific store.



          $category = $objectManager->create('MagentoCatalogModelCategoryFactory')->create()->setStoreId(2)->load(78);
          $category->setName('TESTA-1_ENG');
          $category->save();





          share|improve this answer













          You must load category with specific store id, If you need to change details of specific store.



          Please use below code to modify category details for specific store.



          $category = $objectManager->create('MagentoCatalogModelCategoryFactory')->create()->setStoreId(2)->load(78);
          $category->setName('TESTA-1_ENG');
          $category->save();






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Aug 24 '17 at 10:23









          Bhavin iFlairBhavin iFlair

          64617




          64617












          • no its not working, category name is not updating

            – jafar pinjar
            Sep 10 '18 at 12:44











          • It is working fine for me.

            – Bhavin iFlair
            Sep 12 '18 at 12:03

















          • no its not working, category name is not updating

            – jafar pinjar
            Sep 10 '18 at 12:44











          • It is working fine for me.

            – Bhavin iFlair
            Sep 12 '18 at 12:03
















          no its not working, category name is not updating

          – jafar pinjar
          Sep 10 '18 at 12:44





          no its not working, category name is not updating

          – jafar pinjar
          Sep 10 '18 at 12:44













          It is working fine for me.

          – Bhavin iFlair
          Sep 12 '18 at 12:03





          It is working fine for me.

          – Bhavin iFlair
          Sep 12 '18 at 12:03

















          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%2f140890%2fmagento2-create-new-update-category-programmatically-for-specific-storeview-no%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

          Was Woodrow Wilson really a Liberal?Was World War I a war of liberals against authoritarians?Founding Fathers...