Prestashop Webservice - Outuput特定细节

时间:2016-06-27 13:06:57

标签: prestashop prestashop-1.6

这是我现在的代码:

public static function listProducts() {

    require_once('inc/config/config.php');

    try {
        $webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG);
        $opt = array('resource' => 'products', 'display' => 'full');
        $xml = $webService->get($opt);
        $resources = $xml->products->children();
    }
    catch (PrestaShopWebserviceException $e) {
        $trace = $e->getTrace();
        if($trace[0]['args'][0] = 404) echo "BAD ID";
        else if ($trace[0]['args'][0] = 401) echo "BAD AUTH KEY";
        else echo 'OTHER ERROR';
    }

    $output = json_encode($resources, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
    echo $output;
}

如何输出有关我产品的特定资源/详细信息? 现在这输出一切。 谢谢!

1 个答案:

答案 0 :(得分:0)

我建议您使用1.5版本的webservices文档,但缺少详细信息。

sudo R CMD javareconf

http://doc.prestashop.com/display/PS15/Chapter+8+-+Advanced+Use#Chapter8-AdvancedUse-SortingFilters