如何延长Magento的API catalog_product.list包括更多的产品信息的XML-RPC [英] How to extend Magento API catalog_product.list to include more product information XML-RPC

查看:109
本文介绍了如何延长Magento的API catalog_product.list包括更多的产品信息的XML-RPC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,这里是我的情况。

Ok, here is my situation.

我们正在使用的Magento商店作为一个在线目录为iPad应用程序的服装店。

We are using Magento Store as a online catalog for an iPad App for a Clothing store.

有多个类别和几百产品。

There are multiple categories and a few hundred products.

从所有提供给我们的标准API调用使用XML-RPC我们设法让我们的漂亮的iPad应用工作。

From all the standard api calls available to us using XML-RPC we have managed to get our nice iPad application working.

它怎么过采取的方式长时间来加载分类列表。这样做的原因是只catalog_product.list返回有关产品的基本信息如ID和SKU。所以,我们接下来要为我们的名单上的每一件产品都得到我们所需要的其它信息的新的连接。例如名称,价格,拇指图片。为使说100产品的一个新的XML-RPC连接是非常耗时。目前超过30秒。当然第一次加载后,我们可以在iPad本地存储此信息,但其importan第一负载快为好。

It does how ever take way to long to load category listings. The reason for this is the catalog_product.list only returns basic information about a product e.g. id and sku. So we then have to make a new connection for every product on our list to get the other information we need. e.g. Name, Price, Thumb Images . Making a new XML-RPC connection for say 100 products is very time consuming. more than 30 seconds currently. Naturally after the first load we could store this info locally in the ipad but its importan the first load is fast as well.

当前方法的取样返回:catelog_product.list

Sample Return of current method: catelog_product.list

position = "";
    "product_id" = 805;
    set = 4;
    sku = 1901252;
    type = simple;
},
    {
    position = "";
    "product_id" = 807;
    set = 4;
    sku = 2143405;
    type = simple;
},

问题1)

有没有办法解决这个问题,现有标准的Magento API的方式?

Is there a way to solve this problem with the existing standard Magento API?

问题2)

如果没有,那么我在哪里需要看所以它包含了额外的信息,我们需要更新catalog_product.list方法。

If not then where do I need to be looking to update the catalog_product.list method so it includes the extra info we need.

请注意:我是pretty熟悉PHP,但我不是很familar与Magento的和其框架的确切结构

Note: I'm pretty familiar with PHP but I'm not very familar with the exact structure of Magento and its framework.

任何帮助将大大AP preciated。

Any help would be greatly appreciated.

推荐答案

\\程序\\ code \\核心\\法师\\目录\\型号\\产品\\ Api.php ,寻找项目的方法,并期待在接下来的一段code的(在我的CE系列80 1.6)

Go to \app\code\core\Mage\Catalog\Model\Product\Api.php, find items method and look at next piece of code (line 80 in my CE 1.6)

        $result[] = array( // Basic product data
            'product_id' => $product->getId(),
            'sku'        => $product->getSku(),
            'name'       => $product->getName(),
            'set'        => $product->getAttributeSetId(),
            'type'       => $product->getTypeId(),
            'category_ids'       => $product->getCategoryIds()
        );

在这里添加所需的属性,甚至写 $结果[] = $产品 - >的getData(); 来获取所有标准属性。如果你需要一些自定义属性那里,看code

Add needed attributes here or even write $result[] = $product->getData(); to fetch all standard attributes. If you need some custom attribute there, look at the code

    $collection = Mage::getModel('catalog/product')->getCollection()
        ->addStoreFilter($this->_getStoreId($store))
        ->addAttributeToSelect('name');

以上(在我的CE 1.6第58行),并添加行 - > addAttributeToSelect('< your_attribute_ code>')

这篇关于如何延长Magento的API catalog_product.list包括更多的产品信息的XML-RPC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆