Ok so i got an answer to my question about AUTO turning on the Stock Availability status to 'In Stock' (from 'Out of Stock') after we increase quantity from 0. The answer was to try this module below,but its not working for me.could you please tell if i am placing the files right way?
My Module Namespace : Apollo
Module Name: Proaval
I have set all these directories:
- App/Code/Local/Apollo/Proaval/Block
- App/Code/Local/Apollo/Proaval/controllers
- App/Code/Local/Apollo/Proaval/etc
- App/Code/Local/Apollo/Proaval/Helper
- App/Code/Local/Apollo/Proaval/Model
- App/Code/Local/Apollo/Proaval/sql
My Apollo_Proaval.xml is in App/etc/modules, which has the following code:
<?xml version="1.0" ?>
<config>
<modules>
<Apollo_Proaval>
<active>true</active>
<codePool>local</codePool>
</Apollo_Proaval>
</modules>
</config>
Next, please check my config.xml in app/code/local/Apollo/Proaval/etc/config.xml
<?xml version="1.0"?>
<config>
<global>
<events>
<catalog_product_save_after>
<observers>
<Save_product_data>
<type>singleton</type>
<class>Magetest_test_Model_Observer</class>
<method>changeStockStatus</method>
</Save_product_data>
</observers>
</catalog_product_save_after>
</events>
</global>
</config>
And finally here is the Oberver.php located in app/code/local/Apollo/Proaval/Observer.php
<?php
public function changeStockStatus($observer) {
$product = $observer->getProduct();
$stockData = $product->getStockData();
if ( $product && $stockData['qty'] > 0) {
$stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product->getEntityId()); // Load the stock for this product
$stock->setData('is_in_stock', 1); // Set the Product to InStock
$stock->save(); // Save
}
}
What i am suspecting is there is perhaps something wrong with config.xml?Please check it once.