Prestashop - API 只获取选定的值而不是 "display = full"
Prestashop - API get only selected values instead of "display = full"
我需要从 api 获取路径和参考编号。我在那里显示了有效的解决方案,但它加载了太多数据并且需要时间。
$opt = array( 'resource' => 'products',
'display' => 'full' );
$xml = $webService->get($opt);
$productNodes = $xml->products->children();
$products = array();
foreach ($productNodes as $product) {
$reference = (string) $product->reference;
$path = $url.'/index.php?controller=product&id_product=' . $product->id;
$products[] = array('reference' => $reference, 'path' => $path);
}
可能是因为 $opt = array( 'resource' => 'products','display' => 'full' );
我找到了 that I can obtain only needed tables,但它对 reference
和 path
表不起作用,或者谁能告诉我哪里出了问题?
$opt = array( 'resource' => 'products',
'display' => '[reference,path]' );
它returns以下错误:
未捕获异常 'PrestaShopWebserviceException',消息为“对 PrestaShop Web 服务的调用失败并返回 HTTP 状态 400。这意味着:错误请求
非常感谢您的帮助。
将path
(错误字段)替换为列表中的其他内容
id, id_manufacturer, id_supplier, id_category_default, new, cache_default_attribute, id_default_image, id_default_combination, id_tax_rules_group, position_in_category, manufacturer_name, quantity, type, id_shop_default, reference, supplier_reference, location, width, height, depth, weight, quantity_discount, ean13, upc, cache_is_pack, cache_has_attachments, is_virtual, on_sale, online_only, ecotax, minimal_quantity, price, wholesale_price, unity, unit_price_ratio, additional_shipping_cost, customizable, text_fields, uploadable_files, active, redirect_type, id_product_redirected, available_for_order, available_date, condition, show_price, indexed, visibility, advanced_stock_management, date_add, date_upd, meta_description, meta_keywords, meta_title, link_rewrite, name, description, description_short, available_now, available_later
and/or 检查响应不仅 headers,而且 xml body 也包含错误消息。
我需要从 api 获取路径和参考编号。我在那里显示了有效的解决方案,但它加载了太多数据并且需要时间。
$opt = array( 'resource' => 'products',
'display' => 'full' );
$xml = $webService->get($opt);
$productNodes = $xml->products->children();
$products = array();
foreach ($productNodes as $product) {
$reference = (string) $product->reference;
$path = $url.'/index.php?controller=product&id_product=' . $product->id;
$products[] = array('reference' => $reference, 'path' => $path);
}
可能是因为 $opt = array( 'resource' => 'products','display' => 'full' );
我找到了 that I can obtain only needed tables,但它对 reference
和 path
表不起作用,或者谁能告诉我哪里出了问题?
$opt = array( 'resource' => 'products',
'display' => '[reference,path]' );
它returns以下错误:
未捕获异常 'PrestaShopWebserviceException',消息为“对 PrestaShop Web 服务的调用失败并返回 HTTP 状态 400。这意味着:错误请求
非常感谢您的帮助。
将path
(错误字段)替换为列表中的其他内容
id, id_manufacturer, id_supplier, id_category_default, new, cache_default_attribute, id_default_image, id_default_combination, id_tax_rules_group, position_in_category, manufacturer_name, quantity, type, id_shop_default, reference, supplier_reference, location, width, height, depth, weight, quantity_discount, ean13, upc, cache_is_pack, cache_has_attachments, is_virtual, on_sale, online_only, ecotax, minimal_quantity, price, wholesale_price, unity, unit_price_ratio, additional_shipping_cost, customizable, text_fields, uploadable_files, active, redirect_type, id_product_redirected, available_for_order, available_date, condition, show_price, indexed, visibility, advanced_stock_management, date_add, date_upd, meta_description, meta_keywords, meta_title, link_rewrite, name, description, description_short, available_now, available_later
and/or 检查响应不仅 headers,而且 xml body 也包含错误消息。