Currently our store's configurable products have the short & long descriptions contained within the parent product. The child product description fields are blank. We're setting up a Google Shopping campaign, and need those descriptions copied from the parent product to the child.
I'm attempting this by using a PHP shell script. I've adapted the script I found here. My version is:
<?php
require_once '../app/Mage.php';
Mage::app();
$products = Mage::getModel('catalog/product')->getCollection()
->addAttributeToFilter('type_id', Mage_Catalog_Model_Product_Type::TYPE_SIMPLE)
->addAttributeToFilter('short_description','')
$products->load();
foreach($products as $product) {
$parentIds = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId());
foreach($parentIds as $parentId) {
$parent = Mage::getModel('catalog/product')->load($parentId);
$product->setShortDescription($parent->getShortDescription());
$product->save();
continue;
}
}
When I run this, I get a php parse error on line 8 $products->load();
- Am I on the right track here?
- Why am I getting that parse error?
edit: I don't necessarily have to use a shell script either. If there's a better way I'm missing, please share.