Netsuite PHP工具包-保存的搜索返回所有数据,而不是选定的列 [英] Netsuite PHP Toolkit - Saved search returns all data, not selected columns

查看:86
本文介绍了Netsuite PHP工具包-保存的搜索返回所有数据,而不是选定的列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我在Netsuite上进行的保存搜索中获取价格+库存的商品清单.这是我的代码:

I am trying to get a list of items with their price + stock from a saved search I set up on Netsuite. This is my code:

$service = new NetSuiteService();
$service->setSearchPreferences(false, 1000, false);

$search = new ItemSearchAdvanced();
$search->savedSearchId = "1226";  // Your SavedSearch ID.

$request = new SearchRequest();
$request->searchRecord = $search;

$searchResponse = $service->search($request);

if (!$searchResponse->searchResult->status->isSuccess) {
    echo "SEARCH ERROR";
} else {
    echo "SEARCH SUCCESS, records found: " . 
    $searchResponse->searchResult->totalRecords . "\n";

    var_dump($searchResponse);
}

但是,尽管它已根据我设置的标准过滤器过滤了结果,但它返回的是项目的每个字段,而不仅仅是返回我在结果中设置的列->保存的搜索中的列.

However, although it has filtered results according to the criteria filter I set, It is returning every field for the items, rather than just the columns I have set in results -> columns on the saved search.

这似乎使其非常缓慢,检索330个项目大约需要50秒钟.

This seems to be making it very slow, It takes around 50 seconds to retrieve the 330 items.

是否有一种方法,使其仅返回项目中的选择字段,或者仅返回我在保存的搜索中设置的列?

Is there a way to make it only return select fields from the item, or just the columns I have set up in the saved search?

谢谢!

推荐答案

$service->setSearchPreferences(false, 20, true);

上面的代码设置了搜索的首选项:

The above code sets the preferences for your search:

  1. 仅正文字段(布尔值)
  2. 页面大小(整数)
  3. 返回搜索列(布尔值)

控制您所遇到的行为的是#3.您将其设置为false(不返回搜索列).需要将其设置为true.

It's #3 that controls the behavior you are experiencing. You set it to false (don't return search columns). It needs to be set to true.

这篇关于Netsuite PHP工具包-保存的搜索返回所有数据,而不是选定的列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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