Programatically create product not showing in catalog product grid












1















I created a product using below script :



$product = Mage::getModel('catalog/product');
$product->setStoreId(1);
$product->setWebsiteIds(array(1));
$product->setTypeId('simple');
$product->addData(array(
'name' => 'Custom Name',
'attribute_set_id' => $product->getDefaultAttributeSetId(),
'status' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED,
'visibility' => Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE, // because I don't want to show on frontend
'weight' => 1,
'sku' => 'custom123',
'tax_class_id' => 0,
'description' => 'desciption',
'short_description' => 'short desciption',
'stock_data' => array(
'manage_stock' => 1,
'qty' => 999,
'is_in_stock' => 1
),
));
$product->save();


Above script create a row in database tablecatalog_product_entity but this product not showing in magento catalog product grid.



What do I do for showing product only in magento backend?










share|improve this question























  • Try after reindexing

    – Manikandan
    May 6 '16 at 6:30











  • I am having same problem and its not working even after Reindexing.

    – Shashank Kumrawat
    May 6 '16 at 6:33











  • use this sample product creation code and try whether it's displaying or not Refer this link - inchoo.net/magento/programming-magento/…

    – Manikandan
    May 6 '16 at 6:35











  • I have tried that also still it does not shown any product in GRID , although an product has been created in database.

    – Shashank Kumrawat
    May 6 '16 at 6:39











  • i think the tax class or some thing not added correctly. i will update an answer try that. it may help you

    – Manikandan
    May 6 '16 at 6:46
















1















I created a product using below script :



$product = Mage::getModel('catalog/product');
$product->setStoreId(1);
$product->setWebsiteIds(array(1));
$product->setTypeId('simple');
$product->addData(array(
'name' => 'Custom Name',
'attribute_set_id' => $product->getDefaultAttributeSetId(),
'status' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED,
'visibility' => Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE, // because I don't want to show on frontend
'weight' => 1,
'sku' => 'custom123',
'tax_class_id' => 0,
'description' => 'desciption',
'short_description' => 'short desciption',
'stock_data' => array(
'manage_stock' => 1,
'qty' => 999,
'is_in_stock' => 1
),
));
$product->save();


Above script create a row in database tablecatalog_product_entity but this product not showing in magento catalog product grid.



What do I do for showing product only in magento backend?










share|improve this question























  • Try after reindexing

    – Manikandan
    May 6 '16 at 6:30











  • I am having same problem and its not working even after Reindexing.

    – Shashank Kumrawat
    May 6 '16 at 6:33











  • use this sample product creation code and try whether it's displaying or not Refer this link - inchoo.net/magento/programming-magento/…

    – Manikandan
    May 6 '16 at 6:35











  • I have tried that also still it does not shown any product in GRID , although an product has been created in database.

    – Shashank Kumrawat
    May 6 '16 at 6:39











  • i think the tax class or some thing not added correctly. i will update an answer try that. it may help you

    – Manikandan
    May 6 '16 at 6:46














1












1








1








I created a product using below script :



$product = Mage::getModel('catalog/product');
$product->setStoreId(1);
$product->setWebsiteIds(array(1));
$product->setTypeId('simple');
$product->addData(array(
'name' => 'Custom Name',
'attribute_set_id' => $product->getDefaultAttributeSetId(),
'status' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED,
'visibility' => Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE, // because I don't want to show on frontend
'weight' => 1,
'sku' => 'custom123',
'tax_class_id' => 0,
'description' => 'desciption',
'short_description' => 'short desciption',
'stock_data' => array(
'manage_stock' => 1,
'qty' => 999,
'is_in_stock' => 1
),
));
$product->save();


Above script create a row in database tablecatalog_product_entity but this product not showing in magento catalog product grid.



What do I do for showing product only in magento backend?










share|improve this question














I created a product using below script :



$product = Mage::getModel('catalog/product');
$product->setStoreId(1);
$product->setWebsiteIds(array(1));
$product->setTypeId('simple');
$product->addData(array(
'name' => 'Custom Name',
'attribute_set_id' => $product->getDefaultAttributeSetId(),
'status' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED,
'visibility' => Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE, // because I don't want to show on frontend
'weight' => 1,
'sku' => 'custom123',
'tax_class_id' => 0,
'description' => 'desciption',
'short_description' => 'short desciption',
'stock_data' => array(
'manage_stock' => 1,
'qty' => 999,
'is_in_stock' => 1
),
));
$product->save();


Above script create a row in database tablecatalog_product_entity but this product not showing in magento catalog product grid.



What do I do for showing product only in magento backend?







magento-1.9 product






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked May 6 '16 at 6:07









Vinaya MaheshwariVinaya Maheshwari

1,16211846




1,16211846













  • Try after reindexing

    – Manikandan
    May 6 '16 at 6:30











  • I am having same problem and its not working even after Reindexing.

    – Shashank Kumrawat
    May 6 '16 at 6:33











  • use this sample product creation code and try whether it's displaying or not Refer this link - inchoo.net/magento/programming-magento/…

    – Manikandan
    May 6 '16 at 6:35











  • I have tried that also still it does not shown any product in GRID , although an product has been created in database.

    – Shashank Kumrawat
    May 6 '16 at 6:39











  • i think the tax class or some thing not added correctly. i will update an answer try that. it may help you

    – Manikandan
    May 6 '16 at 6:46



















  • Try after reindexing

    – Manikandan
    May 6 '16 at 6:30











  • I am having same problem and its not working even after Reindexing.

    – Shashank Kumrawat
    May 6 '16 at 6:33











  • use this sample product creation code and try whether it's displaying or not Refer this link - inchoo.net/magento/programming-magento/…

    – Manikandan
    May 6 '16 at 6:35











  • I have tried that also still it does not shown any product in GRID , although an product has been created in database.

    – Shashank Kumrawat
    May 6 '16 at 6:39











  • i think the tax class or some thing not added correctly. i will update an answer try that. it may help you

    – Manikandan
    May 6 '16 at 6:46

















Try after reindexing

– Manikandan
May 6 '16 at 6:30





Try after reindexing

– Manikandan
May 6 '16 at 6:30













I am having same problem and its not working even after Reindexing.

– Shashank Kumrawat
May 6 '16 at 6:33





I am having same problem and its not working even after Reindexing.

– Shashank Kumrawat
May 6 '16 at 6:33













use this sample product creation code and try whether it's displaying or not Refer this link - inchoo.net/magento/programming-magento/…

– Manikandan
May 6 '16 at 6:35





use this sample product creation code and try whether it's displaying or not Refer this link - inchoo.net/magento/programming-magento/…

– Manikandan
May 6 '16 at 6:35













I have tried that also still it does not shown any product in GRID , although an product has been created in database.

– Shashank Kumrawat
May 6 '16 at 6:39





I have tried that also still it does not shown any product in GRID , although an product has been created in database.

– Shashank Kumrawat
May 6 '16 at 6:39













i think the tax class or some thing not added correctly. i will update an answer try that. it may help you

– Manikandan
May 6 '16 at 6:46





i think the tax class or some thing not added correctly. i will update an answer try that. it may help you

– Manikandan
May 6 '16 at 6:46










2 Answers
2






active

oldest

votes


















0














By missing of some required field, product doesn't show up in the backend.



Your products are showing in the database, so try to do the following:



Go to catalog -> manage products. Your current url will look like:



[yoursite.com]/index.php/admin/catalog_product/index/key/[your_key]/



Change this url to [yoursite.com]/index.php/admin/catalog_product/edit/id/[product_id]/key/[your_key]/



You can find the product ids in the database. When you enter this url, you can edit the product and check/edit product attributes, like tax class, status, etc and make sure alle required attributes are set.



I have refer to this answer






share|improve this answer


























  • I tried it before, but not working for me.

    – Vinaya Maheshwari
    May 6 '16 at 6:49











  • do you have the product id?

    – Manikandan
    May 6 '16 at 6:50











  • In database table catalog_product_entity I found a new row, when run above script.

    – Vinaya Maheshwari
    May 6 '16 at 6:52











  • did you get the product id from the database?

    – Manikandan
    May 6 '16 at 6:53











  • when I set this product visibilty as catalog, search then it showing in frontend search page, but not showing in backend grid.

    – Vinaya Maheshwari
    May 6 '16 at 6:53



















0














problem is in line 'visibility' => Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE,



replace VISIBILITY_NOT_VISIBLE with VISIBILITY_BOTH






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "479"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f114188%2fprogramatically-create-product-not-showing-in-catalog-product-grid%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    By missing of some required field, product doesn't show up in the backend.



    Your products are showing in the database, so try to do the following:



    Go to catalog -> manage products. Your current url will look like:



    [yoursite.com]/index.php/admin/catalog_product/index/key/[your_key]/



    Change this url to [yoursite.com]/index.php/admin/catalog_product/edit/id/[product_id]/key/[your_key]/



    You can find the product ids in the database. When you enter this url, you can edit the product and check/edit product attributes, like tax class, status, etc and make sure alle required attributes are set.



    I have refer to this answer






    share|improve this answer


























    • I tried it before, but not working for me.

      – Vinaya Maheshwari
      May 6 '16 at 6:49











    • do you have the product id?

      – Manikandan
      May 6 '16 at 6:50











    • In database table catalog_product_entity I found a new row, when run above script.

      – Vinaya Maheshwari
      May 6 '16 at 6:52











    • did you get the product id from the database?

      – Manikandan
      May 6 '16 at 6:53











    • when I set this product visibilty as catalog, search then it showing in frontend search page, but not showing in backend grid.

      – Vinaya Maheshwari
      May 6 '16 at 6:53
















    0














    By missing of some required field, product doesn't show up in the backend.



    Your products are showing in the database, so try to do the following:



    Go to catalog -> manage products. Your current url will look like:



    [yoursite.com]/index.php/admin/catalog_product/index/key/[your_key]/



    Change this url to [yoursite.com]/index.php/admin/catalog_product/edit/id/[product_id]/key/[your_key]/



    You can find the product ids in the database. When you enter this url, you can edit the product and check/edit product attributes, like tax class, status, etc and make sure alle required attributes are set.



    I have refer to this answer






    share|improve this answer


























    • I tried it before, but not working for me.

      – Vinaya Maheshwari
      May 6 '16 at 6:49











    • do you have the product id?

      – Manikandan
      May 6 '16 at 6:50











    • In database table catalog_product_entity I found a new row, when run above script.

      – Vinaya Maheshwari
      May 6 '16 at 6:52











    • did you get the product id from the database?

      – Manikandan
      May 6 '16 at 6:53











    • when I set this product visibilty as catalog, search then it showing in frontend search page, but not showing in backend grid.

      – Vinaya Maheshwari
      May 6 '16 at 6:53














    0












    0








    0







    By missing of some required field, product doesn't show up in the backend.



    Your products are showing in the database, so try to do the following:



    Go to catalog -> manage products. Your current url will look like:



    [yoursite.com]/index.php/admin/catalog_product/index/key/[your_key]/



    Change this url to [yoursite.com]/index.php/admin/catalog_product/edit/id/[product_id]/key/[your_key]/



    You can find the product ids in the database. When you enter this url, you can edit the product and check/edit product attributes, like tax class, status, etc and make sure alle required attributes are set.



    I have refer to this answer






    share|improve this answer















    By missing of some required field, product doesn't show up in the backend.



    Your products are showing in the database, so try to do the following:



    Go to catalog -> manage products. Your current url will look like:



    [yoursite.com]/index.php/admin/catalog_product/index/key/[your_key]/



    Change this url to [yoursite.com]/index.php/admin/catalog_product/edit/id/[product_id]/key/[your_key]/



    You can find the product ids in the database. When you enter this url, you can edit the product and check/edit product attributes, like tax class, status, etc and make sure alle required attributes are set.



    I have refer to this answer







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited May 23 '17 at 12:37









    Community

    1




    1










    answered May 6 '16 at 6:48









    ManikandanManikandan

    750721




    750721













    • I tried it before, but not working for me.

      – Vinaya Maheshwari
      May 6 '16 at 6:49











    • do you have the product id?

      – Manikandan
      May 6 '16 at 6:50











    • In database table catalog_product_entity I found a new row, when run above script.

      – Vinaya Maheshwari
      May 6 '16 at 6:52











    • did you get the product id from the database?

      – Manikandan
      May 6 '16 at 6:53











    • when I set this product visibilty as catalog, search then it showing in frontend search page, but not showing in backend grid.

      – Vinaya Maheshwari
      May 6 '16 at 6:53



















    • I tried it before, but not working for me.

      – Vinaya Maheshwari
      May 6 '16 at 6:49











    • do you have the product id?

      – Manikandan
      May 6 '16 at 6:50











    • In database table catalog_product_entity I found a new row, when run above script.

      – Vinaya Maheshwari
      May 6 '16 at 6:52











    • did you get the product id from the database?

      – Manikandan
      May 6 '16 at 6:53











    • when I set this product visibilty as catalog, search then it showing in frontend search page, but not showing in backend grid.

      – Vinaya Maheshwari
      May 6 '16 at 6:53

















    I tried it before, but not working for me.

    – Vinaya Maheshwari
    May 6 '16 at 6:49





    I tried it before, but not working for me.

    – Vinaya Maheshwari
    May 6 '16 at 6:49













    do you have the product id?

    – Manikandan
    May 6 '16 at 6:50





    do you have the product id?

    – Manikandan
    May 6 '16 at 6:50













    In database table catalog_product_entity I found a new row, when run above script.

    – Vinaya Maheshwari
    May 6 '16 at 6:52





    In database table catalog_product_entity I found a new row, when run above script.

    – Vinaya Maheshwari
    May 6 '16 at 6:52













    did you get the product id from the database?

    – Manikandan
    May 6 '16 at 6:53





    did you get the product id from the database?

    – Manikandan
    May 6 '16 at 6:53













    when I set this product visibilty as catalog, search then it showing in frontend search page, but not showing in backend grid.

    – Vinaya Maheshwari
    May 6 '16 at 6:53





    when I set this product visibilty as catalog, search then it showing in frontend search page, but not showing in backend grid.

    – Vinaya Maheshwari
    May 6 '16 at 6:53













    0














    problem is in line 'visibility' => Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE,



    replace VISIBILITY_NOT_VISIBLE with VISIBILITY_BOTH






    share|improve this answer




























      0














      problem is in line 'visibility' => Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE,



      replace VISIBILITY_NOT_VISIBLE with VISIBILITY_BOTH






      share|improve this answer


























        0












        0








        0







        problem is in line 'visibility' => Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE,



        replace VISIBILITY_NOT_VISIBLE with VISIBILITY_BOTH






        share|improve this answer













        problem is in line 'visibility' => Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE,



        replace VISIBILITY_NOT_VISIBLE with VISIBILITY_BOTH







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 17 at 6:41









        Jigs ParmarJigs Parmar

        1,102323




        1,102323






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f114188%2fprogramatically-create-product-not-showing-in-catalog-product-grid%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            William S. Burroughs

            Eda skans

            1924