I have created one category for displaying new arrivals and have added all items under this category. Now i need to delete old items (30 days old & 7 days old) from that category. This should happen daily and automatically.

1 Answer 1


You can achieve this by two methods.

1) Cron

you need to create a cron which will execute as per your required time frame and make the changes accordingly.

you can follow the following url to create a cron.

Remove product from category using cron


2) Observer

you need to create a observer which will execute on controller_action_predispatch event and makes the changes accordingly. for creating observer you can follow the following url.


how to create an new observer on the event catalog_product_save_before

Code to delete product from category


where 7 is the category id and 13409 is product id

  • This my code : <?php require_once 'app/Mage.php'; Mage::getSingleton('catalog/category_api')->removeProduct('1','3'); ?> its not working
    – zus
    Dec 12, 2017 at 9:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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