1

Magento 1.5.1.0

We have a store with about 70,000 active products. Some of the products are showing up in the frontend, but not in the backend. When trying to access one of those products in the backend using its id (see "hack" below), I was told the product no longer existed.

Products may have been deleted using the admin import option for deleting. But I don't think so.

I came upon the problem while trying to update a bunch of products. I received the following error:

Product Type is invalid or not supported in rows: 

with a list of about 500 rows.

The whole csv was formatted the same way. I cannot find any problems with the sku field, but it appears that the system is not recognizing them as existing products.

I tried searching for one of those products in the backend and got no results, whether using sku, name, or id range. I tried this backend "hack" where you click on a product, then replace the id in the url with the id of the product you want to see. But submitting that url resulted in this error:

This product no longer exists.

But the product is searchable on the front end and appears in the catalog and product page.

I traced the This product no longer exists. error to this file, where $product->getId() is returning false.:

app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php

Here's the first part of the function where the error is generated:

public function editAction()
    {
        $productId  = (int) $this->getRequest()->getParam('id');
        $product = $this->_initProduct();

        if ($productId && !$product->getId()) {
            $this->_getSession()->addError(Mage::helper('catalog')->__('This product no longer exists.'));
            $this->_redirect('*/*/');
            return;
        }

The Product Type is invalid or not supported in rows error is generated in this file:

/app/code/core/Mage/ImportExport/Import/Entity/Product.php

in public function validateRow around line 1433, with this code:

if (!isset($rowData[self::COL_TYPE])
                    || !isset($this->_productTypeModels[$rowData[self::COL_TYPE]])
                ) {
                    $this->addRowError(self::ERROR_INVALID_TYPE, $rowNum);

which is itself contained inside the else statement of this if block:

if (isset($this->_oldSku[$sku])) { 

And what that apparently means is that the code did not locate the sku in that array (where skus are keys).

But the product appears in the product flat table, even after reindex. A query for the all ghost items' status shows they are all enabled:

SELECT value, COUNT(*) FROM catalog_product_entity_int WHEREattribute_id = 84 AND entity_id IN (75962, ... etc) ) GROUP BY value

Any ideas?

3

Since the flat table is generated from eav tables as a way speed up the frontend, it's possible that there is a discrepancy between that and the original tables. The next step for debugging would probably be to do a search for a sku where you know this problem is occurring in the catalog_product_entity table. If it's not there, it was probably deleted in one way or another.

If you don't have a recent db backup and want those products back, your best bet is probably to use a previous import file or to salvage what you can from the flat table.

3

Products are stored in the catalog_product_entity table. If there's not an ID in that table, then someone and/or some process has deleted the product from your store. That's consistent with the

This product no longer exists

error message. End of story — the product is no longer in your system. Everything flows from catalog_product_entity.

Me educated guess is that your reindex is failing for some reason (bad extension and/or customizations?) or the reindexing logic in the version of Magento you're using isn't smart enough to clean up products that have been deleted. Hop into

#File: app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php

if you're interested in debugging why a reindex isn't removing products that no longer exist in your system.

2

I was getting this exact same error when uploading new products manually. It was saying "The Product has been saved", but then was not saving the product in the backend or in the flat table. I went to the System -> Index Management area, selected all of the indexes and clicked the Submit button next to Reindex Data. All of the indexes already showed that they were up to date, but I thought I would try reindexing the data anyways. After reindexing, I could manually add products into the system.

Not sure if that will help anyone. It helped me, so I thought I'd share.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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