What does Mage_Catalog_Model_Product_Status::STATUS_DISABLED Do?Programmatically installing a moduleHow can I...

How can my powered armor quickly replace its ceramic plates?

Early credit roll before the end of the film

Why did other German political parties disband so fast when Hitler was appointed chancellor?

My cat mixes up the floors in my building. How can I help him?

How can I get my players to come to the game session after agreeing to a date?

How do Chazal know that the descendants of a Mamzer may never marry into the general populace?

How to prevent cleaner from hanging my lock screen in Ubuntu 16.04

Who is this Ant Woman character in this image alongside the Wasp?

What is the wife of a henpecked husband called?

What is 6÷2×(1+2) =?

How to deal with an incendiary email that was recalled

How can animals be objects of ethics without being subjects as well?

What's a good word to describe a public place that looks like it wouldn't be rough?

What are the differences between a+i and &a[i] for pointer arithmetic in C++?

How long is the D&D Starter Set campaign?

One Half of Ten; A Riddle

Would a National Army of mercenaries be a feasible idea?

It took me a lot of time to make this, pls like. (YouTube Comments #1)

Intern applicant asking for compensation equivalent to that of permanent employee

Dilemma of explaining to interviewer that he is the reason for declining second interview

We are very unlucky in my court

What are "industrial chops"?

How to limit sight distance to 1 km

How should I handle players who ignore the session zero agreement?



What does Mage_Catalog_Model_Product_Status::STATUS_DISABLED Do?


Programmatically installing a moduleHow can I enforce the import of a product status on a product import?Magmi CLI does not find class 'Mage'Changing product status with Magento (1.9) script not visible in AdminMagento orders stuck in payment_review: how does one release? and is stock reserved?What exactly does the admin install script do?What is the reason for Item Status = “canceled” and not able to create InvoiceWhat happens if I CTRL + C halfway through a cli command?In Magento 2, What is use of setIsObjectNew while saving a model factory object?CLI to find out what version my modules are?













3















I wrote a script that searches for products with no active categories and disables the products. This was in regards to our customer turning off some old categories, but the products still being searchable. We figured it was best to set their status to disabled in bulk.



So in order to do this we call this line:




Mage::getModel('catalog/product_status')->updateProductStatus($prod->getId(), $store_id, Mage_Catalog_Model_Product_Status::STATUS_DISABLED);




So a week later, we need to re-enable a product. I log into the admin panel, and the status is still showing as "enabled". It took me running my script again hard coding the id to get it to show up in the store again:




Mage::getModel('catalog/product_status')->updateProductStatus(370, $store_id, Mage_Catalog_Model_Product_Status::STATUS_ENABLED);




Obvioulsy my intention was that the status in the admin panel would be disabled, and then any user with admin access would be able to turn these products back on. So I'm asking the community, what do the above lines actually do? And how can I do what I intended.










share|improve this question





























    3















    I wrote a script that searches for products with no active categories and disables the products. This was in regards to our customer turning off some old categories, but the products still being searchable. We figured it was best to set their status to disabled in bulk.



    So in order to do this we call this line:




    Mage::getModel('catalog/product_status')->updateProductStatus($prod->getId(), $store_id, Mage_Catalog_Model_Product_Status::STATUS_DISABLED);




    So a week later, we need to re-enable a product. I log into the admin panel, and the status is still showing as "enabled". It took me running my script again hard coding the id to get it to show up in the store again:




    Mage::getModel('catalog/product_status')->updateProductStatus(370, $store_id, Mage_Catalog_Model_Product_Status::STATUS_ENABLED);




    Obvioulsy my intention was that the status in the admin panel would be disabled, and then any user with admin access would be able to turn these products back on. So I'm asking the community, what do the above lines actually do? And how can I do what I intended.










    share|improve this question



























      3












      3








      3








      I wrote a script that searches for products with no active categories and disables the products. This was in regards to our customer turning off some old categories, but the products still being searchable. We figured it was best to set their status to disabled in bulk.



      So in order to do this we call this line:




      Mage::getModel('catalog/product_status')->updateProductStatus($prod->getId(), $store_id, Mage_Catalog_Model_Product_Status::STATUS_DISABLED);




      So a week later, we need to re-enable a product. I log into the admin panel, and the status is still showing as "enabled". It took me running my script again hard coding the id to get it to show up in the store again:




      Mage::getModel('catalog/product_status')->updateProductStatus(370, $store_id, Mage_Catalog_Model_Product_Status::STATUS_ENABLED);




      Obvioulsy my intention was that the status in the admin panel would be disabled, and then any user with admin access would be able to turn these products back on. So I'm asking the community, what do the above lines actually do? And how can I do what I intended.










      share|improve this question
















      I wrote a script that searches for products with no active categories and disables the products. This was in regards to our customer turning off some old categories, but the products still being searchable. We figured it was best to set their status to disabled in bulk.



      So in order to do this we call this line:




      Mage::getModel('catalog/product_status')->updateProductStatus($prod->getId(), $store_id, Mage_Catalog_Model_Product_Status::STATUS_DISABLED);




      So a week later, we need to re-enable a product. I log into the admin panel, and the status is still showing as "enabled". It took me running my script again hard coding the id to get it to show up in the store again:




      Mage::getModel('catalog/product_status')->updateProductStatus(370, $store_id, Mage_Catalog_Model_Product_Status::STATUS_ENABLED);




      Obvioulsy my intention was that the status in the admin panel would be disabled, and then any user with admin access would be able to turn these products back on. So I'm asking the community, what do the above lines actually do? And how can I do what I intended.







      cli status magento1.9.0.1






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 32 mins ago









      Teja Bhagavan Kollepara

      2,96341847




      2,96341847










      asked Dec 15 '14 at 19:34









      CD BrianCD Brian

      11019




      11019






















          1 Answer
          1






          active

          oldest

          votes


















          5














          This is kind of a two part question.



          First you are saying:




          This was in regards to our customer turning off some old categories, but the products still being searchable.




          Instead of "disabling", I would create a script that changes the visibility from "Catalog, Search" to just "Catalog"



          This code would look like something like this:



          $productId = ???;
          $product = Mage::getModel('catalog/product');
          $product->load($productId);
          $product->setVisibility(2);
          $product->save();


          You would also need code to search and switch the visibility back in the event it goes back into a Category.



          Note: Since you have multiple websites, you may need to add code specifically to a website ID. Also, since you have multiple admins changing product data, a admin logger would be a great idea since I have heard horror stories about random admin users changing product data.



          The second part of the question is




          What do the above lines actually do?




          The code does disabled and enable products, however it seems that you ran into a issue. There are other ways in doing this as well, however what you posted above is the most common way (especially on SE). Things I would look at is if your "status" attribute is a global or website variable. By default is "website". I would take a look at what when you are in the admin panel is if you are on the default view or if you are in the website specific view. The code above will always appear to be "Enabled" in the default view, but it will get disabled in the website view.



          I would create a custom log in your script to see write what product was changed, and when it was changed.






          share|improve this answer
























          • Thanks! You were right it disabled it on the store scope not the global scope!

            – CD Brian
            Jan 16 '15 at 19:50











          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%2f48419%2fwhat-does-mage-catalog-model-product-statusstatus-disabled-do%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









          5














          This is kind of a two part question.



          First you are saying:




          This was in regards to our customer turning off some old categories, but the products still being searchable.




          Instead of "disabling", I would create a script that changes the visibility from "Catalog, Search" to just "Catalog"



          This code would look like something like this:



          $productId = ???;
          $product = Mage::getModel('catalog/product');
          $product->load($productId);
          $product->setVisibility(2);
          $product->save();


          You would also need code to search and switch the visibility back in the event it goes back into a Category.



          Note: Since you have multiple websites, you may need to add code specifically to a website ID. Also, since you have multiple admins changing product data, a admin logger would be a great idea since I have heard horror stories about random admin users changing product data.



          The second part of the question is




          What do the above lines actually do?




          The code does disabled and enable products, however it seems that you ran into a issue. There are other ways in doing this as well, however what you posted above is the most common way (especially on SE). Things I would look at is if your "status" attribute is a global or website variable. By default is "website". I would take a look at what when you are in the admin panel is if you are on the default view or if you are in the website specific view. The code above will always appear to be "Enabled" in the default view, but it will get disabled in the website view.



          I would create a custom log in your script to see write what product was changed, and when it was changed.






          share|improve this answer
























          • Thanks! You were right it disabled it on the store scope not the global scope!

            – CD Brian
            Jan 16 '15 at 19:50
















          5














          This is kind of a two part question.



          First you are saying:




          This was in regards to our customer turning off some old categories, but the products still being searchable.




          Instead of "disabling", I would create a script that changes the visibility from "Catalog, Search" to just "Catalog"



          This code would look like something like this:



          $productId = ???;
          $product = Mage::getModel('catalog/product');
          $product->load($productId);
          $product->setVisibility(2);
          $product->save();


          You would also need code to search and switch the visibility back in the event it goes back into a Category.



          Note: Since you have multiple websites, you may need to add code specifically to a website ID. Also, since you have multiple admins changing product data, a admin logger would be a great idea since I have heard horror stories about random admin users changing product data.



          The second part of the question is




          What do the above lines actually do?




          The code does disabled and enable products, however it seems that you ran into a issue. There are other ways in doing this as well, however what you posted above is the most common way (especially on SE). Things I would look at is if your "status" attribute is a global or website variable. By default is "website". I would take a look at what when you are in the admin panel is if you are on the default view or if you are in the website specific view. The code above will always appear to be "Enabled" in the default view, but it will get disabled in the website view.



          I would create a custom log in your script to see write what product was changed, and when it was changed.






          share|improve this answer
























          • Thanks! You were right it disabled it on the store scope not the global scope!

            – CD Brian
            Jan 16 '15 at 19:50














          5












          5








          5







          This is kind of a two part question.



          First you are saying:




          This was in regards to our customer turning off some old categories, but the products still being searchable.




          Instead of "disabling", I would create a script that changes the visibility from "Catalog, Search" to just "Catalog"



          This code would look like something like this:



          $productId = ???;
          $product = Mage::getModel('catalog/product');
          $product->load($productId);
          $product->setVisibility(2);
          $product->save();


          You would also need code to search and switch the visibility back in the event it goes back into a Category.



          Note: Since you have multiple websites, you may need to add code specifically to a website ID. Also, since you have multiple admins changing product data, a admin logger would be a great idea since I have heard horror stories about random admin users changing product data.



          The second part of the question is




          What do the above lines actually do?




          The code does disabled and enable products, however it seems that you ran into a issue. There are other ways in doing this as well, however what you posted above is the most common way (especially on SE). Things I would look at is if your "status" attribute is a global or website variable. By default is "website". I would take a look at what when you are in the admin panel is if you are on the default view or if you are in the website specific view. The code above will always appear to be "Enabled" in the default view, but it will get disabled in the website view.



          I would create a custom log in your script to see write what product was changed, and when it was changed.






          share|improve this answer













          This is kind of a two part question.



          First you are saying:




          This was in regards to our customer turning off some old categories, but the products still being searchable.




          Instead of "disabling", I would create a script that changes the visibility from "Catalog, Search" to just "Catalog"



          This code would look like something like this:



          $productId = ???;
          $product = Mage::getModel('catalog/product');
          $product->load($productId);
          $product->setVisibility(2);
          $product->save();


          You would also need code to search and switch the visibility back in the event it goes back into a Category.



          Note: Since you have multiple websites, you may need to add code specifically to a website ID. Also, since you have multiple admins changing product data, a admin logger would be a great idea since I have heard horror stories about random admin users changing product data.



          The second part of the question is




          What do the above lines actually do?




          The code does disabled and enable products, however it seems that you ran into a issue. There are other ways in doing this as well, however what you posted above is the most common way (especially on SE). Things I would look at is if your "status" attribute is a global or website variable. By default is "website". I would take a look at what when you are in the admin panel is if you are on the default view or if you are in the website specific view. The code above will always appear to be "Enabled" in the default view, but it will get disabled in the website view.



          I would create a custom log in your script to see write what product was changed, and when it was changed.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Dec 15 '14 at 20:20









          kab8609kab8609

          3,31811839




          3,31811839













          • Thanks! You were right it disabled it on the store scope not the global scope!

            – CD Brian
            Jan 16 '15 at 19:50



















          • Thanks! You were right it disabled it on the store scope not the global scope!

            – CD Brian
            Jan 16 '15 at 19:50

















          Thanks! You were right it disabled it on the store scope not the global scope!

          – CD Brian
          Jan 16 '15 at 19:50





          Thanks! You were right it disabled it on the store scope not the global scope!

          – CD Brian
          Jan 16 '15 at 19:50


















          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%2f48419%2fwhat-does-mage-catalog-model-product-statusstatus-disabled-do%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

          “%fieldName is a required field.”, in Magento2 REST API Call for GET Method Type The Next...

          How to change City field to a dropdown in Checkout step Magento 2Magento 2 : How to change UI field(s)...

          變成蝙蝠會怎樣? 參考資料 外部連結 导航菜单Thomas Nagel, "What is it like to be a...