Skip to content

Set Google Shopping Sellers tasks

georgesvash edited this page Jul 19, 2019 · 1 revision

Set Google Shopping Sellers tasks

Original docs can be found at https://docs.dataforseo.com/#setting-google-shopping-shops-tasks

Attention Please notice that the get() method isn't used. The static call ::getAfterMerge() is used instead. Note that the first setOpt() call should be static

Method: ::getAfterMerge($pool) - creates a single payload out of the list of objects, makes a single call to the API, whereas the payload contains arrays with postIds or without, and returns an object ResponseCollection

Use case with several arrays in the payload.

require_once '../vendor/autoload.php';

use DFSClient\DFSClient;
use DFSClient\Models\MerchantApi\Google_Shopping\SettingGoogleShoppingShopsTasks;

$DFSClient = new DFSClient('Your Login','Your Password');
$model   = new SettingGoogleShoppingShopsTasks();

$pool=[]; // array with objects.

for($i=0; $i<3; $i++){
    $pool[] = $model::setOpt('priority', 1)
        ->setOpt('se_id', 2933 )
        ->setOpt('loc_name_canonical', "London,England,United Kingdom")
        ->setOpt('product_id', "1924701347928518037")
        ->setPostId($i); //- you can use postId method, if you want set custom id for payload array.
}

$completed = SettingGoogleShoppingShopsTasks::getAfterMerge($pool);

if (!$completed->isSuccessful())
    dd($completed);

foreach ($completed as $key=>$item){
    dump($item);
}

Getting Started

  1. Home
  2. Installation
  3. Configuration
  4. Base Usage
  5. Response Collection
  6. Abstract Model

DataForSEO APIs

Clone this wiki locally