Question

I'm logging a bunch of stuff in our database. Is there a quick and easy way to check if a SKU exists or not? This way I can remove anything malformed from our import process.

Was it helpful?

Solution

$sku = 'sku here';
$id = Mage::getModel('catalog/product')->getIdBySku($sku);
if (false !== $id) {
   //sku exists
}
else {
   //sku does not exist
}
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top