Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Magento SOAP API产品列表分页_Magento_Soap - Fatal编程技术网

Magento SOAP API产品列表分页

Magento SOAP API产品列表分页,magento,soap,Magento,Soap,我试图通过soapi(V2)阅读Magento的产品列表,并尝试进行一些/任何类型的分页 简单场景: var filters = new filters(); var products = catalogProductList(out pe, Connection.Session, filters, null); 这导致Magento崩溃:“允许的内存大小为1073741824字节,已耗尽(尝试分配72字节)。 我试图通过在产品id上指定两个复杂过滤器来添加分页: filters.comple

我试图通过soapi(V2)阅读Magento的产品列表,并尝试进行一些/任何类型的分页

简单场景:

var filters = new filters();
var products = catalogProductList(out pe, Connection.Session, filters, null);
这导致Magento崩溃:
“允许的内存大小为1073741824字节,已耗尽(尝试分配72字节)。

我试图通过在
产品id
上指定两个复杂过滤器来添加分页:

filters.complex_filter = new complexFilter[]
{
    new complexFilter()
    {
        key = "product_id",
        value = new associativeEntity()
        {
            key = "gt",
            value = "400"
        }
    },
    new complexFilter()
    {
        key = "product_id",
        value = new associativeEntity()
        {
            key = "lt",
            value = "1000"
        }
    }
};
但是在这种情况下,只应用第二个过滤器,而忽略第一个过滤器

我正在考虑阅读分类树,然后是指定的产品,但是有很多产品没有指定给任何类别或多个类别,所以我要么错过它们,要么多次得到它们

有没有一种方法可以使用某种类型的分页来阅读产品列表,这样我就不会立即阅读完整的列表?
(注意:请求增加内存实际上不是一个选项)

我已经在PHP中成功地完成了以下操作:

$filters = new StdClass();
$filters->complexFilter = array(
    array( 'key' =>'sku', 'value' => array('lt'=>'03969999')),
    array( 'key' => 'sku', 'value' => array('gt'=>'03969000')),
);
虽然根据

<complexType name="filters"><all><element name="filter" type="typens:associativeArray" minOccurs="0"/><element name="complex_filter" type="typens:complexFilterArray" minOccurs="0"/></all></complexType>


可能需要“$filters->complex_filter=array();”?第一个代码似乎对我有用。

非常难看,但对我有用:

public catalogProductEntity[]GetProducts()
{
int storeId;
catalogProductEntity[]catalogEntity;
List res=新列表();
Client.catalogProductCurrentStore(out-storeId,SessionId,null);
var filters=新过滤器();
filters.complex_filter=新的complexFilter[1];
filters.complex_filter[0]=新的complexFilter();
complexFilter=filters.complex_filter[0];
filter.key=“name”;
filter.value=新的AssociationEntity();
AssociationEntity assoc=filter.value;
assoc.key=“like”;
//从A到Z。

对于(char i='A';i来说,您需要的答案似乎在


显然,您可以在两个筛选条件中的一个条件中大写
PRODUCT_ID
,以解决Magento的限制,即防止在同一个键上出现两个筛选条件。

我已经为此想出了一个很好的解决方案。希望这对其他人有所帮助

$in = array();
for ($i = ($page * $size) - $size; $i < ($page * $size); $i++) {
    $in[] = $i + 1;
}
$complexFilter = array('complex_filter' => 
    array(
        array(
            'key' => 'product_id',
            'value' => array(
                'key' => 'in', 
                'value' => join(",", $in)
            )
        )
    )
);
$in=array();
对于($i=($page*$size)-$size;$i<($page*$size);$i++){
【】中的美元=美元i+1;
}
$complexFilter=数组('complexFilter'=>
排列(
排列(
“密钥”=>“产品id”,
'值'=>数组(
'键'=>'在'',
'value'=>join(“,”,$in)
)
)
)
);

哪种语言是您请求的客户端?Java?您在这方面取得过任何进展吗?遇到了与您相同的问题。“gt”过滤器由于某些原因而被忽略,因为有任何帮助?这家伙告诉我们为什么两个类似的过滤器不起作用。