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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:42:37+00:00 2026-05-23T09:42:37+00:00

I am following Ivan’s tutorial ( Adding order attribute to the orders grid in

  • 0

I am following Ivan’s tutorial (Adding order attribute to the orders grid in Magento 1.4.1) to add an extra column to the sales_order_grid table (the Shipping Description text) and it’s working except it’s not bring old data across from sales_flat_order to the new column in sales_order_grid.

My SQL install script adds the column correctly and because I’m using the same field name as in sales_flat_order I don’t think I need an observer, however the code to import all of the existing shipping description data into the shipping_description field isn’t running.

What I am doing wrong?

My SQL install script:

<?php
/**
 * Setup scripts, add new column and fulfills
 * its values to existing rows
 *
 */
/* @var $this Mage_Sales_Model_Mysql4_Setup */
$this->startSetup();

// Add column to grid table
$this->getConnection()->addColumn(
    $this->getTable('sales/order_grid'),
    'shipping_description',
    "varchar(255) not null default ''"
);

// Add key to table for this field,
// it will improve the speed of searching & sorting by the field
$this->getConnection()->addKey(
    $this->getTable('sales/order_grid'),
    'shipping_description',
    'shipping_description'
);


// fill existing rows with data
$select = $this->getConnection()->select();
$select->join(
    array('order'=>$this->getTable('sales/order')),
    $this->getConnection()->quoteInto('order.entity_id = order_grid.entity_id',''),
    array('shipping_description' => 'shipping_description')
);

$this->getConnection()->query(
    $select->crossUpdateFromSelect(
        array('order_grid' => $this->getTable('sales/order_grid'))
    )
);

$this->endSetup();

I am using Magento 1.5.1 Community Edition!

Thanks for any assistance!

  • 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-23T09:42:37+00:00Added an answer on May 23, 2026 at 9:42 am

    this should work:

    $select = $this->getConnection()->select();
    $select->join(
        array('order_shipping'=>$this->getTable('sales/order')),//alias=>table_name
        $this->getConnection()->quoteInto(
            'order_shipping.entity_id = order_grid.entity_id',
            Mage_Sales_Model_Quote_Address::TYPE_SHIPPING
        ),//join clause
        array('shipping_description' => 'shipping_description')//fields to get
    );
    $this->getConnection()->query(
        $select->crossUpdateFromSelect(
            array('order_grid' => $this->getTable('sales/order_grid'))
        )
    );
    

    If you want, take a look at my extension 🙂
    HTH

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

Sidebar

Related Questions

Following StockWatcher tutorial, http://code.google.com/webtoolkit/doc/latest/tutorial/debug.html When I run the app in debug mode, my Safari
Following situation: Parent: namespace Base; /** @Entity @Table(name=section) */ class Section extends Skeleton {
Following is the table and script of this table. DECLARE @temp TABLE (PPId INT,
Following on from my recent question on Large, Complex Objects as a Web Service
Following my question regarding a .NET YAML Library ... as there doesn't seem to
Following this question: Good crash reporting library in c# Is there any library like
Following Izb's question about Best binary XML format for JavaME , I'm looking for
Following on from this question what would be the best way to write a
Following techniques from 'Modern C++ Design', I am implementing a persistence library with various
Following up on this question, I'm working on a large Delphi 7 codebase which

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.