1

I've run into an interesting situation problem with Magento EE 1.13.1

We have a custom module to sync product data between Magento and an external ERP system. Most of the time it works without an issue, but, on rare occasions, our customer reports that products are disappearing from the front end. The products display correctly after executing a command line reindex of the catalog_product_price index.

In this implementation, we are using the Magento product API model to create and update products by calling the API methods directly.

For example, when creating a product, first an array is created with all the product data -

$productData['sku'] = $sku;
$productData['name'] = $productName;
$productData['description'] = $productName;
(etc)

then the stock data is added -

$productData['stock_data']['qty'] = $available;
$productData['stock_data']['is_in_stock'] = true;

Finally the array is passed to the API create method -

$magentoApi = Mage::getModel('catalog/product_api');
$productId = $magentoApi->create('simple', '4', $sku, $productData, null);

So the result is that the product is created properly, but occasionally the indexes are not being updated. Do you think we should modify the code to force a reindex after creating or updating a product? I thought Magento was doing this automatically in 1.13 onward or am I mistaken?

Thanks for any pointers or suggestions.

1 Answer 1

2

This happened to us as well. Our solution was to always schedule a full reindex. We set it up so our script would first import the products in, then once that was complete, do a full reindex.

1
  • Thanks - we're doing that too as a workaround - a full command line reindex every hour (seems to defeat the purpose of 1.13 ;-) However, the indexing can conflict with admin usage and our customer reports occasional errors when saving products in admin while the indexers are running. I'd just like to find out how I can rewrite the code to avoid the issue. For example, should we be updating some table to trigger a partial index or just rebuild the indexes whenever the importer creates/updates a product or changes inventory?
    – GregC
    Dec 8, 2014 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.