I have some php code which I use SKU for it:
$sku = $id
$_product=Mage::getModel('catalog/product')->loadByAttribute('sku',$sku); //Get Product by ID (ASIN)
$qtyStock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty(); //if in stock
$_prodcats = $_product->getCategoryIds();
What I would like to add to this code if $sku is wrong (Not found in database with $_product line) to be able to change it manually for example if the $sku is not existent change it to $sku = "909010";
Thank you for the help