Last active
August 29, 2015 13:57
-
-
Save denishvachhani/9777761 to your computer and use it in GitHub Desktop.
Magento – How to Check if the SKU is Exist?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In 3 options above code will be 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.