简体   繁体   English

Magento soap api catalog_product.list分页

[英]Magento soap api catalog_product.list Pagination

I'm currently using the Magento api and I need you help guys, 我目前正在使用Magento api,我需要你们帮助,

I have 1200 products that I need list in the page… (all products from all categories) 我需要在页面中列出1200种产品...(所有类别的所有产品)

I use 我用

 $this->magento_api->call($session,'catalog_product.list');

and it's works as well.. All products is listed. 它也有效..所有产品都列出来了。

but now… I got problems because… 1 200 products in 1 page is a little too much.. so I want to know if it's possible to get… maybe .. 25/50 products and create a pagination? 但是现在......我遇到了问题,因为...... 1页中的1 200个产品有点太多了......所以我想知道是否有可能获得...也许.. 25/50产品并创造一个分页?

thanks for your Help, 谢谢你的帮助,

See this answer: https://stackoverflow.com/a/7797226/612717 请参阅此答案: https//stackoverflow.com/a/7797226/612717

Basically you have to pass a filter/ComplexFilter specifying from and to into the returned collection. 基本上,您必须将指定fromto的过滤器/ ComplexFilter传递给返回的集合。 eg 例如

$complexFilter->complex_filter = array(
    array(
        'key' => 'CREATED_AT',
        'value' => array('key' => 'from', 'value' => '2012-12-17 00:00:00')
    ), 
    array(
        'key' => 'created_at',
        'value' => array('key' => 'to', 'value' => '2013-01-21 12:02:02')
    ), 
);

Of course CREATED_AT could also be based on ID or any other column in database. 当然, CREATED_AT也可以基于ID或数据库中的任何其他列。

Another fine way to achieve the same is via GET filters (assuming you want to pass this control from web). 实现相同目标的另一个好方法是通过GET过滤器 (假设你想从web传递这个控件)。 A full blown example using the models and collection methods can also be found here . 这里还可以找到使用模型和收集方法的完整示例。

Well, there is no answer for this question? 嗯,这个问题没有答案吗?

Have you tried $collection->setPage($pageNum, $pageSize); 你试过$collection->setPage($pageNum, $pageSize);

You can also upgrade into Magento 2.x now @Jean-philippe Emond 您现在也可以升级到Magento 2.x @ Jean-philippe Emond

In Magento 2, there will be an option /V1/products/?searchCriteria[currentPage]=1&searchCriteria[pageSize]=100 在Magento 2中,将有一个选项/V1/products/?searchCriteria[currentPage]=1&searchCriteria[pageSize]=100

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM