title: Magento: Auto-changing the “Stock Availability” from “Out of Stock” to “In Stock” (& vice-versa) on Quantity Change
body: <p>So I’ve been looking for a way to change the Stock Availability back to In Stock when the quantity field is greater than 0. The system already automatically changes the Stock Availability to Out of Stock when you set the quantity to 0 and save the product. I would like a way to set it back to In Stock when you set the quantity greater than 0 and save the product.</p>
  
  <p>Well, I think I found a simple way, which in itself makes me nervous. So I wanted to post to you gurus to see if this is safe, correct, and ok to do.</p>
  
  <p>In <strong>app/design/adminhtml/default/default/template/catalog/product/tab/inventory.phtml</strong></p>
  
  <p>I have changed this:</p>
  
  <pre><code>&lt;?php foreach ($this-&gt;getStockOption() as $option): ?&gt;
          &lt;?php $_selected = ($option['value'] == $this-&gt;getFieldValue('is_in_stock')) ? 'selected="selected"' : '' ?&gt;
          &lt;option value="&lt;?php echo $option['value'] ?&gt;" &lt;?php echo $_selected ?&gt;&gt;&lt;?php echo $option['label'] ?&gt;&lt;/option&gt;
  &lt;?php endforeach; ?&gt;
  </code></pre>
  
  <p>To this:</p>
  
  <pre><code>&lt;?php if( ($this-&gt;getFieldValue('qty')*1) &gt; 0): ?&gt;
          &lt;option selected="selected" value="1"&gt;In Stock&lt;/option&gt;
  &lt;?php else: ?&gt;
      &lt;option selected="selected" value="0"&gt;Out of Stock&lt;/option&gt;
  &lt;?php endif; ?&gt;
  </code></pre>
  
  <p>All I have to work on at this point is a live site, so you can understand my concern…</p>
  
  <p>Please let me know if this will have the intended effect (it appears so but it seems to simplistic....)</p>