Magento 1.6,谷歌购物/产品/内容

时间:2011-08-26 21:11:36

标签: shopping

Magento 1.6在本周开始时已经出局,但是从mage_googleshopping扩展程序(http://www.magentocommerce.com/magento-connect/Magento+Core/extension/6887/mage_googleshopping)升级到1.5.1 v.1.6不可行。

mage_googleshopping仅与1.5兼容。任何工作替代方案都可以在干净的Magento 1.6安装上使用mage_googleshopping扩展,或者我们必须等待与v.1.6一致的稳定扩展版本?

干杯, 波格丹

1 个答案:

答案 0 :(得分:5)

我浏览了互联网,并为此搜索了一个问题,最终我变成了这个单独符文的脚本,但它连接到了Magento DB。这些脚本会生成该文件,该文件可以按照计划上传到Google。

除了脚本完全可编辑之外,您还可以完全监控其背后的所有进程。仍然无法从1.6 Magento版本中删除Magento脚本。

该脚本不是由我开发的,但我确实根据Google从22/9/2011强制执行的最新规则对其进行了更新。

<code>
<?php
define('SAVE_FEED_LOCATION','google_base_feed.txt');
set_time_limit(1800);
require_once '../app/Mage.php';
Mage::app('default');
try{
    $handle = fopen(SAVE_FEED_LOCATION, 'w');

    $heading = array('id','mpn','title','description','link','image_link','price','brand','product_type','condition', 'google_product_category', 'manufacturer', 'availability');
    $feed_line=implode("\t", $heading)."\r\n";
    fwrite($handle, $feed_line);

    $products = Mage::getModel('catalog/product')->getCollection();
    $products->addAttributeToFilter('status', 1);
    $products->addAttributeToFilter('visibility', 4);
    $products->addAttributeToSelect('*');
    $prodIds=$products->getAllIds();

    $product = Mage::getModel('catalog/product');

    $counter_test = 0;

    foreach($prodIds as $productId) {

        if (++$counter_test < 30000){

            $product->load($productId);

            $product_data = array();
            $product_data['sku'] = $product->getSku();
            $product_data['mpn'] = $product->getSku();

            $title_temp = $product->getName();
            if (strlen($title_temp) > 70){
                $title_temp = str_replace("Supply", "", $title_temp);
                $title_temp = str_replace("  ", " ", $title_temp);
            }
            $product_data['title'] = $title_temp;


            $product_data['description'] = substr(iconv("UTF-8","UTF-8//IGNORE",$product->getDescription()), 0, 900);
            $product_data['Deeplink'] = "http://www.directmall.co.uk/".$product->getUrlPath(); 
            $product_data['image_link'] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'catalog/product'.$product->getImage();

            $price_temp = round($product->getPrice(),2);
            $product_data['price'] = round($product->getPrice(),2) + 5;

            $product_data['brand'] = $product->getData('brand');

            $product_data['product_type'] = 'Laptop Chargers &amp; Adapters';
            $product_data['condition'] = "new";
            $product_data['category'] = $product_data['brand'];
            $product_data['manufacturer'] = $product_data['brand'];

            $product_data['availability'] = "in stock";

            foreach($product_data as $k=>$val){
                $bad=array('"',"\r\n","\n","\r","\t");
                $good=array(""," "," "," ","");
                $product_data[$k] = '"'.str_replace($bad,$good,$val).'"';
            }

            echo $counter_test  . " ";

            $feed_line = implode("\t", $product_data)."\r\n";
            fwrite($handle, $feed_line);
            fflush($handle);

        }

    }

    fclose($handle);
}
catch(Exception $e){
    die($e->getMessage());
}</code>
  1. 将www.directmall.co.uk更改为您需要的内容。
  2. 分配适当的权限。
  3. 根据Google的要求进行全面更新。