我想根据商品的类别将product_type添加到我的Magento Google Base输出中,但似乎无法实现。 我有以下代码:
// Get categories from product to include as product_type
$categoryIds = $object->getCategoryIds();
foreach($categoryIds as $categoryId) {
$category = Mage::getModel('catalog/category')->load($categoryId);
$this->_setAttribute('product_type', $category->getName(), 'text' );
}
问题在于它返回所有类别,而不仅仅是产品所在的类别。有人有解决方法吗?