Open developer-gurpreet opened 5 years ago
@Gurpreet68 You can create an array in your config file
'US' => [
'merchantId' => env('mwsMerchantId'),
'marketplaceId' => env('mwsMarketplaceId_US'),
'keyId' => env('mwsKeyId'),
'secretKey' => env('mwsSecretKey'),
'mwsAuthToken' => env('mwsAuthToken'),
'amazonServiceUrl' => env('mwsAmazonServiceUrl_US'),
'muteLog' => env('mwsMuteLog', false),
],
'CA' => [
'merchantId' => env('mwsMerchantId'),
'marketplaceId' => env('mwsMarketplaceId_CA'),
'keyId' => env('mwsKeyId'),
'secretKey' => env('mwsSecretKey'),
'mwsAuthToken' => env('mwsAuthToken'),
'amazonServiceUrl' => env('mwsAmazonServiceUrl_CA'),
'muteLog' => env('mwsMuteLog', false),
],
'UK' => [
'merchantId' => env('mwsMerchantId'),
'marketplaceId' => env('mwsMarketplaceId_UK'),
'keyId' => env('mwsKeyId'),
'secretKey' => env('mwsSecretKey'),
'mwsAuthToken' => env('mwsAuthToken'),
'amazonServiceUrl' => env('mwsAmazonServiceUrl_UK'),
'muteLog' => env('mwsMuteLog', false),
],
and from your controller use the foreach loop
$stores = config('amazon-mws.store');
foreach ($stores as $key => $store){
$orders = new AmazonOrderList($key);
$orders->setLimits('Created', "- 30 days");
$channel = ($key == 'US') ? 'MFN' : 'AFN';
$orders->setFulfillmentChannelFilter($channel);
$filter = ($key == 'US') ? ["Unshipped", "PartiallyShipped", "Unfulfillable"] : ["Shipped","Unshipped", "PartiallyShipped", "Unfulfillable"];
$orders->setOrderStatusFilter($filter);
$orders->setUseToken();
$orders->fetchOrders();
$amazonOrders[] = $orders->getList();
}
Im getting .com orders successfully but I would like to access .ca orders as well, I checked "https://github.com/sonnenglas/amazon-mws-laravel/blob/stable/src/AmazonOrderList.php" but there you passed only $this->options['MarketplaceId.Id.1'] = $store[$s]['marketplaceId']; into constructor. my question is how we can pass multiple marketplaceIds?