如何在 facebook business sdk php 上创建产品目录批次,电子商务

问题描述 投票:0回答:2

我使用 facebook business sdk 11.0 用于创建新产品类别电子商务

https://github.com/facebook/facebook-php-business-sdk

我试图阅读文档,但我仍然无法理解它。

尝试但显示错误 (#100) 参数请求是必需的

$api = Api::init($app_id, $app_secret, $access_token);
        $api->setLogger(new CurlLogger());

        $fields = array(
        );
        $params = array(
            'retailer_id' => 'retailer-6',
            "availability" => "in stock",
            "brand" => "Nike",
            "category" => "t-shirts",
            "description" => "product description",
            "image_url" => "http://www.images.example.com/t-shirts/1.png",
            "name" => "product name",
            "price" => "10.00",
            "currency" => "USD",
            "condition" => "new",
            "url" => "http://www.images.example.com/t-shirts/1.png",
            "retailer_product_group_id" => "product-group-1"
        );
        echo json_encode((new ProductCatalog($id))->createBatch(
            $fields,
            $params
        )->exportAllData(), JSON_PRETTY_PRINT);
php laravel facebook-graph-api facebook-javascript-sdk facebook-ads-api
2个回答
0
投票
$api = Api::init($app_id, $app_secret, $access_token);
        $api->setLogger(new CurlLogger());

        $fields = array(
        );
        $data[] = array(
            'method'=>'CREATE',
            'retailer_id'=>'retailer-6',
            'data'=>array(
                "availability" => "in stock",
                "brand" => "Nike",
                "category" => "t-shirts",
                "description" => "product description",
                "image_url" => "http://www.images.example.com/t-shirts/1.png",
                "name" => "product name",
                "price" => "1000", //it will be 1000 otherwise it will through error
                "currency" => "INR",
                "condition" => "new",
                "url" => "http://www.images.example.com/t-shirts/1.png",
                "retailer_product_group_id" => "product-group-1"
            )
        );
        
        $params = array(
            'access_token'=>$access_token,
            'requests'=>$data
        );
        echo json_encode((new ProductCatalog($product_catalog_id))->createBatch(
            $fields,
            $params
        )->exportAllData(), JSON_PRETTY_PRINT);


Try this one it will work.

0
投票

我怎样才能获得所有这些凭证(api 秘密访问令牌、产品目录……等等?

© www.soinside.com 2019 - 2024. All rights reserved.