2015-10-26 20 views
1

我需要从api获取路径和参考号。我有工作解决方案显示在那里,但它加载了太多的数据,这需要时间。可能是因为$opt = array('resource' => 'products','display' => 'full');Prestashop - API只获取选定的值而不是“display = full”

$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); 
    } 

它,我发现that I can obtain only needed tables,但它不工作的referencepath表,或可能有人告诉我有什么不对?

$opt = array('resource' => 'products', 
       'display' => '[reference,path]'); 

它返回以下错误:

未捕获的异常“PrestaShopWebserviceException”有消息“这调用的Prestashop Web服务失败并返回400 HTTP状态这意味着:坏请求

非常感谢你的帮助。

回答

2

从列表替换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

和/或响应不仅头部检查,但和xml体内过多包含错误信息。

+0

你说得对,应该有身份证,我已经混在一起了,非常感谢! –