Displaying shop products automatically after import

  • 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.

  • drewm

    Approved the thread.
  • I just used the example script with a few extra fields and basic default product template.


    Then to display products:-


    PHP
    1. <?php perch_shop_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


    PHP
    1. $Posts = new PerchShop_Products();
    2. $result = $Importer->add_item($productData);
    3. /**
    4. * Index product
    5. */
    6. if ($result) {
    7. $newProduct = $Products->find($result['id']);
    8. $newProduct->index();
    9. }