Product ProductUpdate - mobly/sellercenter-sdk GitHub Wiki
try {
// factory returning instance of Product client
$client = \SellerCenter\SDK\Sdk::getProduct(['store' => 'mobly-br', 'environment' => 'staging',]);
$collection = new \SellerCenter\SDK\Product\ProductCollection();
$product1 = new \SellerCenter\SDK\Product\Product();
$product1->setSellerSku('ABC123MOB');
$product1->setName('Product New Name');
$product1->setBrand('Correct Brand Name');
$product1->setQuantity(500);
$product2 = new \SellerCenter\SDK\Product\Product();
$product2->setSellerSku('ABC456MOB');
$product2->setName('New Product-2 Name');
$collection->add($product1);
$collection->add($product2);
$result = $client->productUpdate($collection);
} catch (\SellerCenter\SDK\Common\Exception\SdkException $e) {
header('Content-Type: text/plain');
echo $e->getTraceAsString();
}
<Request>
<Product>
<SellerSku>ABC123MOB</SellerSku>
<Name>Product New Name</Name>
<Brand>Correct Brand Name</Brand>
<Quantity>500</Quantity>
</Product>
<Product>
<SellerSku>ABC456MOB</SellerSku>
<Name>New Product-2 Name</Name>
</Product>
</Request>
The result of ->productUpdate()
will be an instance of SellerCenter\SDK\Common\Api\Response\Success\SuccessResponse
which is a representation of a SuccessResponse from SellerCenter API.
$result->getHead()
// returns a representation of response's Head
$result->getHead()->getRequestId()
// returns the Feed ID that you can use to check result of the queue processing by SellerCenter
- Get available brand names with
$client->getBrands()
-
StatusEnum::ACTIVE()
is just one way to set acceptable "status" values, you can also fill param asnew StatusEnum('active')
or any other valid value -
TaxClassEnum::DEFAULT()
is just one way to set acceptable "tax class" values, you can also fill param asnew TaxClassEnum('default')
or any other valid value -
ShipmentTypeEnum:: DROPSHIPPING()
is just one way to set acceptable "shipment type" values, you can also fill param asnew ShipmentTypeEnum('dropshipping')
or any other valid value -
ConditionEnum::NEW()
is just one way to set acceptable "condition" values, you can also fill param asnew ConditionEnum('new')
or any other valid value