I am using a function to automatically update product prices in Magento, but sometimes the supplier doesn't add a price for a product.
I would like to skip the product price update for a certain product if the value is zero (so I can manually put in a price).
Please see the code below. I tried to use $product->setPrice($price != 0);
but that didn't work. My code is:
public function updateProductPriceAndStock($sku)
{
$_product = Mage::getModel('catalog/product')->loadByAttribute('sku',$sku);
if($_product)
{
$product = Mage::getModel("catalog/product")->load($_product->getId());
$product->setStockData($this->getProductStockFromErp($sku));
$product->setCost($this->getProductCostFromErp($sku));
$price = $this->getProductPriceFromErp($sku);
$product->setPrice($price);
$product->setMsrp($price);
$product->save();
$this->_counts++;
unset($product);
}
unset($_product);
}