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

  • Home
  • SEARCH
  • 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 6819199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:16:38+00:00 2026-05-26T21:16:38+00:00

I want to add customer comments to my order entity. Currently my setup script

  • 0

I want to add customer comments to my order entity. Currently my setup script looks like:

    <?php

$installer = $this;
/* @var $installer Mage_Sales_Model_Mysql4_Setup */

$installer->startSetup();

    $newFields = array(
        'k_customerordercomment' => array(
            'type'              => 'text',
            'label'                => 'Comments'
        ),
    );

    $entities = array('order');

    $setup = new Mage_Eav_Model_Entity_Setup('core_setup');

    foreach($newFields as $attributeName => $attributeDefs) {
        foreach ($entities as $entity) {
            $setup->addAttribute($entity, $attributeName, array(
                'position'             => 1,
                'type'              => $attributeDefs['type'],
                'label'                => $attributeDefs['label'],
                'global'            => 1,
                'visible'           => 1,
                'required'          => 0,
                'user_defined'      => 1,
                'searchable'        => 0,
                'filterable'        => 0,
                'comparable'        => 0,
                'visible_on_front'  => 1,
                'visible_in_advanced_search' => 0,
                'unique'            => 0,
                'is_configurable'   => 0,
                'position'          => 1,
            ));                
        }
    }



        $installer->getConnection()->addColumn(
        $installer->getTable('sales_flat_order'),
        'k_customerordercomment',
        'text NOT NULL DEFAULT ""'
    );

    $c = array (
        'backend_type'    => 'text',     // MySQL-Datatype
        'frontend_input'  => 'textarea', // Type of the HTML form element
        'is_global'       => '1',
        'is_visible'      => '1',
        'is_required'     => '0',
        'is_user_defined' => '0',
        'frontend_label'  => 'Customer Order Comment',
    );
    $setup->addAttribute('order', 'k_customerordercomment', $c);

    $installer->endSetup();

I get entries in eav_attribute and column added in sales_flat_order.
The problem is that I can’t set values of comments by setdata or setKCustomerordercomment

But if i set value in DB and then load order from database I can see entered value.

What is wrong?

Magento 1.6.

  • 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-05-26T21:16:39+00:00Added an answer on May 26, 2026 at 9:16 pm

    This is what worked for me, I don’t know why and how. But it works.

    <?php
    
    $installer = $this;
    /* @var $installer Mage_Sales_Model_Mysql4_Setup */
    
    $installer->startSetup();
    
    $newFields = array(
        'customerordercomment' => array(
            'type'              => 'text',
            'label'                => 'Comments'
        ),
    );
    
    $entities = array('order');
    
    $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
    
    foreach($newFields as $attributeName => $attributeDefs) {
        foreach ($entities as $entity) {
            $setup->addAttribute($entity, $attributeName, array(
                'position'             => 1,
                'type'              => $attributeDefs['type'],
                'label'                => $attributeDefs['label'],
                'global'            => 1,
                'visible'           => 1,
                'required'          => 0,
                'user_defined'      => 1,
                'searchable'        => 0,
                'filterable'        => 0,
                'comparable'        => 0,
                'visible_on_front'  => 1,
                'visible_in_advanced_search' => 0,
                'unique'            => 0,
                'is_configurable'   => 0,
                'position'          => 1,
            ));                
        }
    }
    
    
    
        $installer->getConnection()->addColumn(
        $installer->getTable('sales_flat_order'),
        'customerordercomment',
        'text NOT NULL DEFAULT ""'
    );
    
    $c = array (
      'backend_type'    => 'text',     // MySQL-Datatype
      'frontend_input'  => 'textarea', // Type of the HTML form element
      'is_global'       => '1',
      'is_visible'      => '1',
      'is_required'     => '0',
      'is_user_defined' => '0',
      'frontend_label'  => 'Customer Order Comment',
    );
    $setup->addAttribute('order', 'customerordercomment', $c);
    
    $installer->endSetup();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to add the customer's company name to new order email subject in
I want to add the jquery-form-validator to my customer's old CMS. This jqery form
I am using JRules to author business rules. I want to add comments to
I want to simply add a customer to Quickbooks Online from my .NET app.
I have a domain model that includes something like this: public class Customer :
I have two entity CUSTOMER and ORDER..there is one to many relation from CUSTOMER
Suppose that I've two controllers, good and customer and that I want add many
Here is the simple case. I have a Customer record defined like this: public
I have dbml with single table users i want add partial class for User
I have a website built with ASP.NET (3.5) and want add some level of

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.