Magento - 使用Google基本描述的简短描述

时间:2010-04-03 19:57:57

标签: magento google-base

我正在使用magento,它内置了向Google基础添加产品的功能。我想更改它,以便它使用简短描述作为Google基础中的描述。与详细描述相反。

4 个答案:

答案 0 :(得分:1)

根据this Screencast,您应该可以设置属性属性映射。这不适合你吗?

仔细观察,我没有谷歌基础帐户,所以我无法对此进行测试,但是,当我搜索Google Base模块时,看起来这就是它抓住描述的地方

app/code/core/Mage/GoogleBase/Model/Service/Item.php    
protected function _setUniversalData()
{
    //...
    if ($object->getDescription()) {
        $content = $service->newContent()->setText( $object->getDescription() );
        $entry->setContent($content);
    }
    //...
}

我的一般方法是在_setUniversalData类上为Mage_GoogleBase_Model_Service_Item方法创建一个覆盖,看起来像这样

protected function _setUniversalData()
{
    parent::_setUniversalData();

    //your code to parse through this object, find the long desription, 
    //and replace with the short.  The following is pseudo code and just 
    //a guess at what would work
    $service = $this->getService();
    $object = $this->getObject();
    $entry = $this->getEntry();     

    $new_text   = $object->getShortDescription(); //not sure on getter method
    $content = $service->newContent()->setText( $new_text );
    $entry->setContent($content);

    return $this;
}
祝你好运!

答案 1 :(得分:1)

想出我所要做的就是改变:

if ($object->getDescription()) {
    $content = $service->newContent()->setText( $object->getDescription() );
    $entry->setContent($content);
}

if ($object->getDescription()) {
    $content = $service->newContent()->setText( $object->getShortDescription() );
    $entry->setContent($content);
}

在app / code / core / Mage / GoogleBase / Model / Service / Item.php

答案 2 :(得分:0)

我最终让模块工作并设法修复所有错误。

我整理了有关如何设置Magento Google Base Feed的简短分步指南,包括帐户配置,添加条件属性&映射属性并在此处发布http://blog.pod1.com/e-commerce/magento-google-base-feed/

答案 3 :(得分:0)

Magento 1.7.0.2 Google Shopping 1.7.0.0

app/code/core/Mage/GoogleShopping/Model/Attribute/Content.php

更改$description = $this->getGroupAttributeDescription();

$description = $this->getGroupAttributeShortDescription();