Hi,
I've made a script to set meta title and meta description for a specific storage, with data coming from a csv. They got actually saved, but the odd thing is other fields (seems like random) got the "Use default" flag unset.
Why is this?
Here is excerpt of my script:
if (($handle = fopen($src, "r")) !== FALSE) {
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
if ($data[0] == 'sku')
continue;
$sku = trim($data[0]);
$**bleep** = trim($data[1]);
$desc = trim($data[2]);
if ($sku != '') {
$product = Mage::getModel('catalog/product')->loadByAttribute('sku', $sku);
if (!is_object($product) || !$product->getEntityId()) {
echo "\nNon trovo il prodotto: $sku\n";
continue;
}
$product->setStoreId(4)->load($product->getId())->setMetaTitle($**bleep**)->setMetaDescription($desc);
try {
$product->save();
$i++;
} catch (Exception $ex) {
die($ex->getMessage());
}
}
}
}
thanks a lot