I've imported approx 500 Products into Perch Shop but none of them appear on the front end until I re-save individually. (The status for all is set to 'active'.) Is there something I need to do when importing to enable them immediately.
Displaying shop products automatically after import
- Tinterweb
- Thread is marked as Resolved.
-
-
drewm
Approved the thread. -
There shouldn't be. Can you show us what you're doing?
-
I just used the example script with a few extra fields and basic default product template.
PHP- <?php
- include('perch/runtime.php');
- $API = new PerchAPI(1.0, 'my_importer');
- $Importer = $API->get('PerchShopProductImporter');
- try {
- $Importer->add_item([
- 'sku' => '1234',
- 'title' => 'Sample Chair',
- 'slug' => 'sample-chair',
- 'description' => 'A contemporary chair with a lovely design',
- 'image' => '',
- 'image_assetID' => 542,
- 'img_desc' => 'Sample Chair',
- 'status' => true,
- 'brand' => 1,
- 'category' => ['products/chairs/','products/side-chairs/'],
- 'furntype' => ['furniture-type/contemporary/'],
- 'venuetype' => ['venue-type/bar/','venue-type/bistro/','venue-type/cafe/','venue-type/restaurant/'],
- 'catalog_only' => true,
- 'price' => ['gbp' => 0],
- 'tax_group' => 1,
- 'stock_status' => 1,
- 'stock_level' => 1000,
- 'stock_location' => true,
- 'max_in_cart' => 1,
- 'requires_shipping' => false,
- 'weight' => 1000,
- 'depth' => 500,
- 'width' => 430,
- 'height' => 840
- ]);
- } catch (Exception $e) {
- die('Error => '.$e->getMessage());
- }
- ?>
Then to display products:-
-
It looks like when you are importing the new product you aren't indexing them. As perch shop requires an index table to filter on it won't match the non indexed products, which is why saving is fixing the issue.
Hopefully the snippet below will help
-
Thanks, I've only just seen this, that's great thanks