So, I was looking for a way to change the availability of stocks in a warehouse when the quantity field is greater than 0. The system already automatically changes the availability of stock in the warehouse after setting the quantity to 0 and saving the product. I would like to return it in stock when you set the quantity is greater than 0 and save the product.
Well, I think I found a simple way that in itself makes me nervous. Therefore, I wanted to publish a guru to you to make sure that it is safe, correct and normal to do it.
In app / design / adminhtml / default / default / template / catalog / product / tab / inventory.phtml
I changed this:
<?php foreach ($this->getStockOption() as $option): ?> <?php $_selected = ($option['value'] == $this->getFieldValue('is_in_stock')) ? 'selected="selected"' : '' ?> <option value="<?php echo $option['value'] ?>" <?php echo $_selected ?>><?php echo $option['label'] ?></option> <?php endforeach; ?>
For this:
<?php if( ($this->getFieldValue('qty')*1) > 0): ?> <option selected="selected" value="1">In Stock</option> <?php else: ?> <option selected="selected" value="0">Out of Stock</option> <?php endif; ?>
All I have to work on at the moment is a live site, so you can understand my concern ...
Please let me know if this will have the intended effect (it seems so, but it seems simplified ....)
Geoff
source share