2

I have a custom report based on the tutorial at http://wrightcreativelabs.com/create-a-custom-magento-report-product-skus-in-new-orders/. The report is working well as is. Now I'm trying to add a customer comments column to the report. The customer comments are coming from the One Page Checkout extension. I have the column added with:

    $this->addColumn('comment', array(
        'header' => Mage::helper('reportneworders')->__('Special Instructions'),
        'align' => 'left',
        'sortable' => false,
        'index' => 'comment'
    ));

The problem is in the collection. The gift message works, but when the comment is added, the report is broken. I know I must be using the wrong id or reference to the comment.

    ->joinLeft(
            array('c' => 'order_comment'),
                  'c.order_comment = order_items.order_comment',
                  array(
                          'comment' => 'comment'
                  ))

    ->joinLeft(
            array('g' => 'gift_message'),
                  'g.gift_message_id = order_items.gift_message_id',
                  array(
                          'message' => 'message'
                  ))

The One Page Checkout textarea for the comment looks like this:

<textarea name="order-comment" id="order-comment"><?php echo trim(Mage::getSingleton('customer/session')->getOrderCustomerComment()) ?></textarea>

I appreciate any advice.

  • "The gift message works, but when the comment is added, the report is broken." what do you mean by broken? – David Manners Jan 6 '15 at 8:10
  • Maybe thats a little unclear. I mean, without the 'order_comment' joinLeft statement, the report works fine. When the joinLeft for 'order_comment' is added, the report doesn't load. – WordPress Mike Jan 6 '15 at 8:14
  • Do you get any error messages or logs? – David Manners Jan 6 '15 at 8:15
  • I'm getting " There has been an error processing your request." In the log its not clear where the error is. But I'm sure its related to a DB error resulting from trying to fetch the order comment improperly. – WordPress Mike Jan 6 '15 at 8:30
  • Have a look at magento.stackexchange.com/a/429/158 maybe you can get a more complete error message – David Manners Jan 6 '15 at 9:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.