I need to find similar SKU numbers of a product. for example S0001-1, S0001-2, S0001-3. That all are similar SKU, I filtered it with this code.
<?php
$product = Mage::registry('product');
$sku = $product->getSku();
$sku = explode('-', $sku);
$collection = Mage::getModel('catalog/product')->getCollection()
->addAttributeToSelect('*')
->addAttributeToFilter('sku', array('like' => '%' . $sku[0] . '%'))
->addAttributeToFilter('visibility', 4)
->addAttributeToFilter('status', 1);
?>
but problem is that it is showing JS0001-1 also.
Can you please suggest how can i skip JS0001, and I can get result which has only S0001 not JS001
thanks