2012-02-13 19 views
1

ただ不思議 - http://www.mydomain.com/sales/order/print/order_id/48/表示Magentoのためのコメント(顧客prinable順)

私は編集する必要があるファイルが「見ることができます/public_html/app/design/frontend/default/mytemplate/template/sales/order/print.phtml "コメントを表示するには、どのコードを追加する必要があるのか​​不明です。

FYI:この拡張機能を使用して注文のコメントボックスを注文ページに表示します(http://www.magentocommerce.com/magento-connect/catalog/product/view/id/10860/)。注文コメントは注文電子メールに正常に表示されますが、顧客注文ページに表示する必要があります。事前にあなたの助けのための

感謝:)

+0

我々はMagentoの1.6コミュニティを使用していることも追加する必要があります;) – MWD

答えて

0

ねえ、このコードを追加してみてください、私はhaventははそれをテストしたが、私はそれはあなたのために働くだろう気持ちを持っている:

<?php $_history = $_order->getVisibleStatusHistory() ?> 
                <?php if (count($_history)): ?> 
                <div class="order-additional order-comments"> 
                 <dl class="order-about"> 
                  <?php foreach ($_history as $_historyItem): ?> 
                   <dd> 
                    <span class='lowcase'><?php echo $_historyItem->getComment()?></span> 
                   </dd> 
                  <?php endforeach; ?> 
                 </dl> 
                </div> 
                <?php endif?> 
+0

私はあなたのスニペットを試してみましたが、残念ながらそれはやりました仕事していません:( – MWD

4

最後のポストがgetVisibleStatusHistoryメソッドを使用しましたオーダーに入力された最初のコメントは決して表示されません。ステータス履歴を取得し、それをオーダオブジェクトに設定するには、いくつかの方法があります。

私たちはfront-edに表示されているコメントのすべてと、その注文が作成されたときに最初に入力されたコメントをリストしたいと言われています。あなたのフォーマットを<p>タグで置き換えました。

<?php $_history = $order->getAllStatusHistory(); ?> 
<?php $_buffer = array(); ?> 
<?php $_i=1; ?> 

<?php foreach ($_history as $_historyItem): ?> 
    <?php // Ignore the visibility for the first comment ?> 
    <?php if ($_historyItem->getData('is_visible_on_front') == 1 || $_i == count($_history)): ?> 
     <?php $_buffer[] = $_historyItem->getData('comment'); ?> 
    <?php endif; ?> 
    <?php $_i++; ?> 
<?php endforeach; ?> 

<?php if (count($_buffer) > 0): ?> 
    <p><?php echo implode($_buffer, '</p><p>'); ?></p> 
<?php endif ?> 
5

+1これはうまく答えました。完全版のための私自身のバージョンはここにあります:

$orders = Mage::getModel('sales/order') 
    ->getCollection() 
    ->addFieldToFilter('status',array('pending','processing')); 

foreach ($orders as $order) { 
    $orderComments = $order->getAllStatusHistory(); 

    foreach ($orderComments as $comment) { 
     $body = $comment->getData('comment'); 
     if (strpos(strtolower($body),'some text') !== false) { 
      // do something cool here... 
     } 
    } 
} 

あなたが望むように使用してください。それが役に立てば幸い。

2

あなたはMageMaven OrderCommentからオーデルのコメントを特に求めているように、これが最も簡単な解決策のようになります。

<p><?php echo nl2br($_order->getCustomerNote()); ?></p> 
+0

ありがとう、これは私が探していたものでした;) –

関連する問題