Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>After searching for a long time and failing to extract a solution from mage core files, I created an attribute which does the same as <code>status</code> attribute. I named that attribute as <code>Archive</code> (Yes/No). This new attribute will justify whether a product is discontinued or not.</p> <p>Atlast, I filter all my product listing, product details and home page related to this new attribute <code>Archive</code> only. </p> <p>I am planning to write a MVC action, which will change all the products <code>status</code> as <code>enabled</code> and at the same time triggering the <code>Archive</code> as yes for the <code>status = disabled</code> products. I will share the code here soon.</p> <p><strong>Code</strong>:</p> <p>Write a dummy controller which runs the following code when the url is called:</p> <pre><code>public function updateproductsAction() { Mage::app()-&gt;setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); $collectionConfigurable = Mage::getResourceModel('catalog/product_collection') -&gt;addAttributeToFilter('type_id', array('eq' =&gt; 'configurable')) -&gt;addAttributeToFilter('entity_id', array('gt' =&gt; 0)); // This line should be removed to affect all the configurable products. (to avoid execution time-out) echo 'Total are ' . count($collectionConfigurable) . '&lt;br/&gt;'; $i = 1; foreach($collectionConfigurable as $p) { $product = Mage::getModel('catalog/product')-&gt;load($p-&gt;getId()); $product-&gt;save(); echo $i++ . ') The product Id with ' . $p-&gt;getId() . " is done...." . "&lt;br/&gt;"; // if the execution time-out occurs, note down the last product id and change the value above in addAttributeToFilter. so the execution runs from the last stopped product. } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload