Skip to content

Commit

Permalink
Support JAPAN
Browse files Browse the repository at this point in the history
  • Loading branch information
najamhaq committed Sep 9, 2019
1 parent c5759ff commit 604ed3c
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions includes/classes/AmazonFeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,19 +296,32 @@ protected function parseXML($xml){

/**
* Generates array for Header.
*
* This method creates the Header array to use with cURL. It contains the Content MD5.
* @return array
*/
protected function genHeader(){
$return[0] = "Content-MD5:".$this->feedMD5;
$return[1] = 'Content-Type: text/xml';
if (strpos($this->options['FeedType'], "_FLAT_FILE_") !== false){
$return[1] = 'Content-Type: text/tab-separated-values';
protected function genHeader()
{
$contentType = 'text/xml';
if (strpos($this->options['FeedType'], "_FLAT_FILE_") !== false) {
switch ($this->options['MarketplaceIdList.Id.1']) {
case 'AAHKV2X7AFYLW': //china
$charset = 'UTF-8';
break;
case 'A1VC38T7YXB528': //japan
$charset = 'Shift_JIS';
break;
default:
$charset = 'iso-8859-1';
break;
}
$contentType = "text/tab-separated-values {$charset}";
}
return $return;

return [
"Content-MD5:{$this->feedMD5}",
"Content-Type: {$contentType}",
];
}

/**
* Returns the response data in array.
*
Expand Down

0 comments on commit 604ed3c

Please sign in to comment.