Displaying shop products automatically after import

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