How do i delete products which are not in a category?How to tell which products are not catgorized via phpmyadminWrong number of products in categoryFrom which category are products from search resultProducts not showingProducts are not showing in category Magento 2some products are not billing and checking outWhy is magento 1.9 presenting same products whatever the category when all cache are activated?Magento: Delete products and 301 redirect to relevant it's parent categoryCore URL re-write table - delete URL entries for deleted productsMagento2.3.0 Categories - I wish the products which are in child category will be visible in each parent category by default

Emphasize numbers in tables

Was Wolfgang Unziker the last Amateur GM?

German idiomatic equivalents of 能骗就骗 (if you can cheat, then cheat)

Could citing a database like libgen get one into trouble?

What is the meaning of ゴト in the context of 鮎

Sentences with no verb, but an ablative

Are there advantages in writing by hand over typing out a story?

Are the plates of a battery really charged?

How might boat designs change in order to allow them to be pulled by dragons?

Why am I getting an electric shock from the water in my hot tub?

How to extract coefficients of a generating function like this one, using a computer?

Find the closest three-digit hex colour

What could a Medieval society do with excess animal blood?

Why did the Middle Kingdom stop building pyramid tombs?

Does the Grothendieck group of finitely generated modules form a commutative ring where the multiplication structure is induced from tensor product?

Variable declaration inside main loop

How far can gerrymandering go?

Disk usage confusion: 10G missing on Linux home partition on SSD

Finding an optimal set without forbidden subsets

Which high-degree derivatives play an essential role?

Is it OK to say "The situation is pregnant with a crisis"?

Square wave to sawtooth wave using two BJT

Why are symbols not written in words?

Can I hire several veteran soldiers to accompany me?



How do i delete products which are not in a category?


How to tell which products are not catgorized via phpmyadminWrong number of products in categoryFrom which category are products from search resultProducts not showingProducts are not showing in category Magento 2some products are not billing and checking outWhy is magento 1.9 presenting same products whatever the category when all cache are activated?Magento: Delete products and 301 redirect to relevant it's parent categoryCore URL re-write table - delete URL entries for deleted productsMagento2.3.0 Categories - I wish the products which are in child category will be visible in each parent category by default













4















our site has over 90,000 products which need to be deleted and are not in categories, but the products in the categories we want to keep, how do i solve this?










share|improve this question









New contributor



joe willmott is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • Can you please specify Magento version ?

    – Abdul Pathan
    Jun 24 at 10:31











  • explain briefly what you exactly doing ??

    – Rk Rathod
    Jun 24 at 10:31











  • Magento 1 ver. 1.9.3.7

    – joe willmott
    Jun 24 at 10:32











  • I am trying to delete all products which are not in active categories

    – joe willmott
    Jun 24 at 10:32















4















our site has over 90,000 products which need to be deleted and are not in categories, but the products in the categories we want to keep, how do i solve this?










share|improve this question









New contributor



joe willmott is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • Can you please specify Magento version ?

    – Abdul Pathan
    Jun 24 at 10:31











  • explain briefly what you exactly doing ??

    – Rk Rathod
    Jun 24 at 10:31











  • Magento 1 ver. 1.9.3.7

    – joe willmott
    Jun 24 at 10:32











  • I am trying to delete all products which are not in active categories

    – joe willmott
    Jun 24 at 10:32













4












4








4








our site has over 90,000 products which need to be deleted and are not in categories, but the products in the categories we want to keep, how do i solve this?










share|improve this question









New contributor



joe willmott is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











our site has over 90,000 products which need to be deleted and are not in categories, but the products in the categories we want to keep, how do i solve this?







magento-1.9 product category-products delete






share|improve this question









New contributor



joe willmott is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










share|improve this question









New contributor



joe willmott is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








share|improve this question




share|improve this question








edited Jun 24 at 10:33









Shoaib Munir

4,6846 gold badges22 silver badges67 bronze badges




4,6846 gold badges22 silver badges67 bronze badges






New contributor



joe willmott is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








asked Jun 24 at 10:26









joe willmottjoe willmott

312 bronze badges




312 bronze badges




New contributor



joe willmott is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




New contributor




joe willmott is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.














  • Can you please specify Magento version ?

    – Abdul Pathan
    Jun 24 at 10:31











  • explain briefly what you exactly doing ??

    – Rk Rathod
    Jun 24 at 10:31











  • Magento 1 ver. 1.9.3.7

    – joe willmott
    Jun 24 at 10:32











  • I am trying to delete all products which are not in active categories

    – joe willmott
    Jun 24 at 10:32

















  • Can you please specify Magento version ?

    – Abdul Pathan
    Jun 24 at 10:31











  • explain briefly what you exactly doing ??

    – Rk Rathod
    Jun 24 at 10:31











  • Magento 1 ver. 1.9.3.7

    – joe willmott
    Jun 24 at 10:32











  • I am trying to delete all products which are not in active categories

    – joe willmott
    Jun 24 at 10:32
















Can you please specify Magento version ?

– Abdul Pathan
Jun 24 at 10:31





Can you please specify Magento version ?

– Abdul Pathan
Jun 24 at 10:31













explain briefly what you exactly doing ??

– Rk Rathod
Jun 24 at 10:31





explain briefly what you exactly doing ??

– Rk Rathod
Jun 24 at 10:31













Magento 1 ver. 1.9.3.7

– joe willmott
Jun 24 at 10:32





Magento 1 ver. 1.9.3.7

– joe willmott
Jun 24 at 10:32













I am trying to delete all products which are not in active categories

– joe willmott
Jun 24 at 10:32





I am trying to delete all products which are not in active categories

– joe willmott
Jun 24 at 10:32










1 Answer
1






active

oldest

votes


















2














Create a custom script on root directory




delete_products.php




code would be this:



<?php
include_once __DIR__ . '/app/Mage.php';
Mage::app('admin');


//Getting all prdoucts collection
$collection = Mage::getResourceModel('productslider/product_collection')
->addAttributeToSelect('*');


foreach($collection as $prod)
$prodId = $prod->getId();
$_product = Mage::getModel('catalog/product')->load($prodId);
$categoryIds = $_product->getCategoryIds();
if(count($categoryIds) == 0)
//Delete prdouct
//$_product->delete();
echo $prodId;




I have used echo and commented delete function. You first need to dry run this script, and if it is giving you the products that need to be deleted, then uncomment delete code.






share|improve this answer























  • The main problem i also have is that i do not know who hosts the site and where any of the root files i need are. My compnay have set me the task to sort it out with no info, is there a way to see where the Cpanel is?

    – joe willmott
    Jun 24 at 10:45











  • I have no idea which hosting you are using. You need code access to do this task, otherwise this is nearly impossible

    – Shoaib Munir
    Jun 24 at 10:52













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
);



);






joe willmott is a new contributor. Be nice, and check out our Code of Conduct.









draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f279382%2fhow-do-i-delete-products-which-are-not-in-a-category%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














Create a custom script on root directory




delete_products.php




code would be this:



<?php
include_once __DIR__ . '/app/Mage.php';
Mage::app('admin');


//Getting all prdoucts collection
$collection = Mage::getResourceModel('productslider/product_collection')
->addAttributeToSelect('*');


foreach($collection as $prod)
$prodId = $prod->getId();
$_product = Mage::getModel('catalog/product')->load($prodId);
$categoryIds = $_product->getCategoryIds();
if(count($categoryIds) == 0)
//Delete prdouct
//$_product->delete();
echo $prodId;




I have used echo and commented delete function. You first need to dry run this script, and if it is giving you the products that need to be deleted, then uncomment delete code.






share|improve this answer























  • The main problem i also have is that i do not know who hosts the site and where any of the root files i need are. My compnay have set me the task to sort it out with no info, is there a way to see where the Cpanel is?

    – joe willmott
    Jun 24 at 10:45











  • I have no idea which hosting you are using. You need code access to do this task, otherwise this is nearly impossible

    – Shoaib Munir
    Jun 24 at 10:52















2














Create a custom script on root directory




delete_products.php




code would be this:



<?php
include_once __DIR__ . '/app/Mage.php';
Mage::app('admin');


//Getting all prdoucts collection
$collection = Mage::getResourceModel('productslider/product_collection')
->addAttributeToSelect('*');


foreach($collection as $prod)
$prodId = $prod->getId();
$_product = Mage::getModel('catalog/product')->load($prodId);
$categoryIds = $_product->getCategoryIds();
if(count($categoryIds) == 0)
//Delete prdouct
//$_product->delete();
echo $prodId;




I have used echo and commented delete function. You first need to dry run this script, and if it is giving you the products that need to be deleted, then uncomment delete code.






share|improve this answer























  • The main problem i also have is that i do not know who hosts the site and where any of the root files i need are. My compnay have set me the task to sort it out with no info, is there a way to see where the Cpanel is?

    – joe willmott
    Jun 24 at 10:45











  • I have no idea which hosting you are using. You need code access to do this task, otherwise this is nearly impossible

    – Shoaib Munir
    Jun 24 at 10:52













2












2








2







Create a custom script on root directory




delete_products.php




code would be this:



<?php
include_once __DIR__ . '/app/Mage.php';
Mage::app('admin');


//Getting all prdoucts collection
$collection = Mage::getResourceModel('productslider/product_collection')
->addAttributeToSelect('*');


foreach($collection as $prod)
$prodId = $prod->getId();
$_product = Mage::getModel('catalog/product')->load($prodId);
$categoryIds = $_product->getCategoryIds();
if(count($categoryIds) == 0)
//Delete prdouct
//$_product->delete();
echo $prodId;




I have used echo and commented delete function. You first need to dry run this script, and if it is giving you the products that need to be deleted, then uncomment delete code.






share|improve this answer













Create a custom script on root directory




delete_products.php




code would be this:



<?php
include_once __DIR__ . '/app/Mage.php';
Mage::app('admin');


//Getting all prdoucts collection
$collection = Mage::getResourceModel('productslider/product_collection')
->addAttributeToSelect('*');


foreach($collection as $prod)
$prodId = $prod->getId();
$_product = Mage::getModel('catalog/product')->load($prodId);
$categoryIds = $_product->getCategoryIds();
if(count($categoryIds) == 0)
//Delete prdouct
//$_product->delete();
echo $prodId;




I have used echo and commented delete function. You first need to dry run this script, and if it is giving you the products that need to be deleted, then uncomment delete code.







share|improve this answer












share|improve this answer



share|improve this answer










answered Jun 24 at 10:42









Shoaib MunirShoaib Munir

4,6846 gold badges22 silver badges67 bronze badges




4,6846 gold badges22 silver badges67 bronze badges












  • The main problem i also have is that i do not know who hosts the site and where any of the root files i need are. My compnay have set me the task to sort it out with no info, is there a way to see where the Cpanel is?

    – joe willmott
    Jun 24 at 10:45











  • I have no idea which hosting you are using. You need code access to do this task, otherwise this is nearly impossible

    – Shoaib Munir
    Jun 24 at 10:52

















  • The main problem i also have is that i do not know who hosts the site and where any of the root files i need are. My compnay have set me the task to sort it out with no info, is there a way to see where the Cpanel is?

    – joe willmott
    Jun 24 at 10:45











  • I have no idea which hosting you are using. You need code access to do this task, otherwise this is nearly impossible

    – Shoaib Munir
    Jun 24 at 10:52
















The main problem i also have is that i do not know who hosts the site and where any of the root files i need are. My compnay have set me the task to sort it out with no info, is there a way to see where the Cpanel is?

– joe willmott
Jun 24 at 10:45





The main problem i also have is that i do not know who hosts the site and where any of the root files i need are. My compnay have set me the task to sort it out with no info, is there a way to see where the Cpanel is?

– joe willmott
Jun 24 at 10:45













I have no idea which hosting you are using. You need code access to do this task, otherwise this is nearly impossible

– Shoaib Munir
Jun 24 at 10:52





I have no idea which hosting you are using. You need code access to do this task, otherwise this is nearly impossible

– Shoaib Munir
Jun 24 at 10:52










joe willmott is a new contributor. Be nice, and check out our Code of Conduct.









draft saved

draft discarded


















joe willmott is a new contributor. Be nice, and check out our Code of Conduct.












joe willmott is a new contributor. Be nice, and check out our Code of Conduct.











joe willmott is a new contributor. Be nice, and check out our Code of Conduct.














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%2f279382%2fhow-do-i-delete-products-which-are-not-in-a-category%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

Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form