I am trying to insert test product into database with the following code -

    $product = Mage::getModel("catalog/product");
            ->setMetaTitle('test meta title 2')
            ->setMetaKeyword('test meta keyword 2')
            ->setMetaDescription('test meta description 2')            
            ->setDescription('This is a long description')
            ->setShortDescription('This is a short description')

            ->setMediaGallery (array('images'=>array (), 'values'=>array ()))
            ->addImageToMediaGallery('media/catalog/product/1/0/10243-1.png', array('image','thumbnail','small_image'), false, false)

                               'use_config_manage_stock' => 0,
                               'is_in_stock' => 1,
                               'qty' => 999

            ->setCategoryIds(array(3, 7)); 

But when I run this code, product does not appears in product list. I checked the database catalog tables, I found that catalog_product_entity_varchar table stores wrong value in value field. It inserts each time value like -5.html, -6.html when I run the code. Is that the reason for not showing product in admin grid or in frontend?

Any comments appreciated.


  • You reindexed data and cleared the cache after adding your products? If not, pls try because you description seems to me like the products are there but you just cant see them. – Stefan Gregori Mar 26 '15 at 14:37
  • I have already disabled cache and index management. – SandyK Mar 27 '15 at 6:48

Replacing attribute id 9 with 4, resolves the problem.

| improve this answer | |

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.