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 8762223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:28:18+00:00 2026-06-13T15:28:18+00:00

I have added a custom category attribute to my Magento installation with the following

  • 0

I have added a custom category attribute to my Magento installation with the following code:

<?php
//  initialize magento environment for 'default' store
    require_once 'app/Mage.php';
    Mage::app('default');

    echo "initialising";
    echo runAdd();
    echo "finishing";

function runAdd()
{
    $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
    // below code will add text attribute
    $setup->addAttribute('catalog_category', 'test_field', array(
        'group'         => 'General',
        'input'         => 'text',
        'type'          => 'varchar',
        'label'         => 'a new text field',
        'backend'       => '',
        'visible'       => 1,
        'required'      => 0,
        'user_defined'  => 1,
        'global'        => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
    ));
}

I am having great difficulty actually retrieving the value I have set in the back end. I have tried every variation of:

$_category = Mage::getModel('catalog/category')->load(1000);               
$data = $_category->getData();        
$atts= $_category->getAttributes();
var_dump($data );
var_dump($atts);

etc but am stuck.

Does anyone know how I’d retrieve this data?

  • 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-13T15:28:19+00:00Added an answer on June 13, 2026 at 3:28 pm

    You shouldn’t update DB in standalone scripts but you must use upgrade scripts …

    If you had, you wouldn’t had to instantiate manually the installer and wouldn’t have instantiate a bad one : you have to use Mage_Catalog_Model_Resource_Setup (or Mage_Catalog_Model_Resource_Eav_Mysql4_Setup depending on your magento version) because Mage_Catalog uses a custom Setup class configured in the config.xml :

    <resources>
        <catalog_setup>
            <setup>
                <module>Mage_Catalog</module>
                <class>Mage_Catalog_Model_Resource_Setup</class>
            </setup>
        </catalog_setup>
    </resources>
    

    I suggest you to adapt this in your module config.xml and use a install/upgrade script to modify your DB properly.

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

Sidebar

Related Questions

I have added custom attribute with the code my_price with Catalog Input Type for
I have added custom code in suffusion-subscription.php to change the image of a Facebook
I have a default ListView that i have added my custom views for the
In Silverlight 3.0 I have added a custom behavior to some UIElement in Code
I have added custom fields in products table in magento. I want to sort
I have added custom level in log4javascript. Using below code, log4javascript.Level[strLevelName] = new log4javascript.Level(nLevelValue,
I have an activity with 2 fragments. I have added custom animations for fragment
In one of the iPad Application, I am working I have added custom views
I have added a custom action to the CustomList type. For testing purposes I
I have an NSOperationQueue to which i have added my custom class's objects(inherits from

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.