Updating Meta Title in Magento via PHP script causes unwanted events
===

On our Magento 1.5.0.1 I wrote a PHP script to update all of our product meta titles to be based on the name and SKU of each product. The script is run by calling PHP via SSH.

After running the script I noticed in our M2E Pro (the eBay syncing module) that every single product appears to have become disabled.

![Magento Screenshot][1]

Looking at the actual products they aren't disabled, so it appears my script is somehow faking the event.

Out of our 3,000+ products, though, one of them was disabled and subsequently M2E Pro removed the listing from eBay.

Here is my script:

	<?php
	set_time_limit(0);
	define('MAGENTO', "/home/discount/public_html");
	require_once MAGENTO . '/app/Mage.php';
	error_reporting(E_ALL);
	ini_set('display_errors', '1');
	umask(0);
	Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
	$storeId = Mage::app()->getStore('default')->getId();

	$products = Mage::getModel('catalog/product')
		->getCollection()
		->addAttributeToSelect('sku')
		->addAttributeToSelect('name')
		->addAttributeToSelect('meta_title');

	$total = count($products);
	$count = 1;

	foreach ($products as $product)
	{
		$mt = sprintf("%s [%s]", $product->getName(), $product->getSku());
		$sku = $product->getSku();
		if ($product->getMetaTitle() != $mt)
		{
			$percent = $count / $total;
			echo $sku." ".$percent."\n";
			$product->setMetaTitle($mt);
			$product->save();
		}
	}
	?>

I'd like to know what I need to do to my script to make it correctly update the meta title without causing odd events?


  [1]: http://i.stack.imgur.com/HJgsG.png