Skip to content

Instantly share code, notes, and snippets.

@Beagon
Created November 7, 2018 09:05
Show Gist options
  • Select an option

  • Save Beagon/8fde4800a5c8730db728ab647cea72e8 to your computer and use it in GitHub Desktop.

Select an option

Save Beagon/8fde4800a5c8730db728ab647cea72e8 to your computer and use it in GitHub Desktop.
Magento 1, delete products between ID X and ID Y
<?php
// Put this in your Magento 1 root, replace the variables with your ID's
// Useful for deleting products when making an importer and starting from scratch.
$idStart = 50000;
$idEnd = 99999;
require_once('app/Mage.php');
umask(0);
Mage::app('admin');
$productCollection = Mage::getModel('catalog/product')
->getCollection()
->addFieldToFilter('entity_id', array('gteq'=> $idStart, 'lteq' => $idEnd));
$productCollection->delete();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment