Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9185351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:15:23+00:00 2026-06-17T19:15:23+00:00

I need to run some SQL to clear some custom tables in Magento when

  • 0

I need to run some SQL to clear some custom tables in Magento when a category is being deleted. With that in mind, I have been following the examples laid out here: Magento – Overriding core files

I have entered this into my config.xml:

<global>
    <models>
        <catalog>
            <rewrite>
                <category_api>MyCompany_MyModule_Model_Catalog_Category_Apis</category_api>
            </rewrite>
        </catalog>                      
    </models>
</global>

I then created the file structure:

MyCompany
-> MyModule
  -> Model
    ->Catalog
      ->Category
        ->Api.php

In Api.php file I have the following:

class MyCompany_MyModule_Model_Catalog_Category_Api extends Mage_Catalog_Model_Category_Api
{
    public function delete($categoryId)
    {
        Mage::log('I have overidden deletion of: ' . $categoryId);

        return true;
    }

}

I am getting nothing come out in the system.log when using this setup so I assume I am doing something wrong.

EDIT:

Changing my XML to <category> </category> seems to make it include my files as I now get an error:

Fatal error: Call to a member function setStoreId() on a non-object in C:\xampp\htdocs\magento\app\code\core\Mage\Adminhtml\controllers\Catalog\CategoryController.php on line 52

Do I need to do something special when overriding the class?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T19:15:24+00:00Added an answer on June 17, 2026 at 7:15 pm

    Would it not better to create an observer to catch the event catalog_category_delete_after. Using events is preferred to function overrides and is more flexible too. Since your delete procedure does not alter catalog_category deletion but adds more functionality to it, using events seems to be a better option

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some SQL joining multiple tables in Access. When attempting to run it,
I have some existing SQL statements that I'd like to use as a custom
I need to run some code that will fetch some configuration values from the
I have an administrative account in Oracle 9i. I need to run some SELECT
I have some .sql files with thousands of INSERT statements in them and need
Is there a SQL query I can run (or some other way) that will
I have some sql that searches a db table for a number from a
I need to run some basic SQL code for a class assignment, but I'm
We need to generate reports that pull in lots of data, run some calculations
I'm running a SQL server and need to run some commands using the SELECT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.