Check if the SKU is Exist ?
<?php $sku = "Your Product Sku "; $id = Mage::getModel('catalog/product')->getIdBySku($sku); if($id){ echo "SKU {$sku} exists"; } else{ echo "SKU {$sku} does not exist"; } ?>
When this code will useful.
- When you import magento products via code then this code is very useful.
- If you want to load product via sku then this is very useful.
- if you want to update any particular product via code then also this is useful.
0 Comments