| @@ -7,11 +7,13 @@ | ||
| 7 | 7 | use ImportWP\Common\Importer\Exception\MapperException; |
| 8 | 8 | use ImportWP\Common\Importer\Exception\ParserException; |
| 9 | 9 | use ImportWP\Common\Importer\Exception\RecordUpdatedSkippedException; |
| 10 | 10 | use ImportWP\Common\Importer\File\CSVFile; |
| 11 | +use ImportWP\Common\Importer\File\JSONFile; | |
| 11 | 12 | use ImportWP\Common\Importer\File\XMLFile; |
| 12 | 13 | use ImportWP\Common\Importer\MapperInterface; |
| 13 | 14 | use ImportWP\Common\Importer\Parser\CSVParser; |
| 15 | +use ImportWP\Common\Importer\Parser\JSONParser; | |
| 14 | 16 | use ImportWP\Common\Importer\Parser\XMLParser; |
| 15 | 17 | use ImportWP\Common\Importer\ParserInterface; |
| 16 | 18 | use ImportWP\Common\Importer\State\ImporterState; |
| 17 | 19 | use ImportWP\Common\Properties\Properties; |
| @@ -131,8 +133,23 @@ | ||
| 131 | 133 | return $this; |
| 132 | 134 | } |
| 133 | 135 | |
| 134 | 136 | /** |
| 137 | + * Load JSON File | |
| 138 | + * | |
| 139 | + * @param string $file_path | |
| 140 | + * | |
| 141 | + * @return $this | |
| 142 | + */ | |
| 143 | + public function jsonFile($file_path) | |
| 144 | + { | |
| 145 | + $file = new JSONFile($file_path, $this->config); | |
| 146 | + $this->parser = new JSONParser($file); | |
| 147 | + | |
| 148 | + return $this; | |
| 149 | + } | |
| 150 | + | |
| 151 | + /** | |
| 135 | 152 | * Set record to start importing from |
| 136 | 153 | * |
| 137 | 154 | * @param int $start |
| 138 | 155 | */ |
| @@ -532,9 +549,9 @@ | ||
| 532 | 549 | if (!empty($unqiue_identifier_settings) && isset($unqiue_identifier_settings['field'], $unqiue_identifier_settings['value'])) { |
| 533 | 550 | |
| 534 | 551 | $unique_identifier_str = ' using unique identifier '; |
| 535 | 552 | if ($unqiue_identifier_settings['field'] === '_iwp_ref_uid') { |
| 536 | - $unique_identifier_str .= sprintf('("%s")', $unqiue_identifier_settings['value']); | |
| 553 | + $unique_identifier_str .= sprintf('("_iwp_ref_uid" = "%s")', $unqiue_identifier_settings['value']); | |
| 537 | 554 | } else { |
| 538 | 555 | $unique_identifier_str .= sprintf('("%s" = "%s")', $unqiue_identifier_settings['field'], $unqiue_identifier_settings['value']); |
| 539 | 556 | } |
| 540 | 557 | } |