Hello,
I am using the product importer to import products, but they are not indexed after import. I have to save them manually to make them show up in the webshop.
A piece of my code:
Code
- foreach($result['data'] as $productData){
- $result = $AssetImporter->add_item([
- 'type' => 'image',
- 'bucket' => $productData['dutchname'],
- 'path' => $productData['images'][0],
- ]);
- $productData['assetID'] = (int) $result['id'];
- $ProductImporter->add_item([
- 'status' => true,
- 'stock_status' => '0',
- 'sku' => $productData['productcode'],
- 'title' => $productData['dutchname'],
- 'slug' => strtolower(trim(preg_replace('/[^A-Za-z0-9-]+/', '-', $productData['dutchname']))) . strtolower(trim(preg_replace('/[^A-Za-z0-9-]+/', '-', $productData['productcode']))),
- 'potmaat' => $productData['potsize'],
- 'hoogte' => $productData['height'],
- 'promotietekst' => $productData['promotionaltext'],
- 'beschrijving' => $productData['description'],
- 'specificaties' => $productData['specifications'],
- 'verzorgingstips' => $productData['caretips'],
- 'kweker' => $productData['grower'],
- 'over_de_kweker' => $productData['aboutgrower'],
- 'category' => 'planten/plant/',
- 'image0' => '',
- 'image0_assetID' => $productData['assetID'],
- 'price' => ['eur'=>str_replace(".", ",", $productData['purchaseprice'])],
- 'aantal_per_order' => $productData['numberperorder'],
- ]);
- }