Magento 1.9订单评论添加后端信息

时间:2018-10-16 09:28:02

标签: magento magento-1.9 backend

我正在尝试为客户添加一个框,以便对他们的订单发表评论。 我已经将它添加到了

  

/checkout/cart/cart.phtml

您可以看到我在这里添加了它

  <div class="cart-collaterals">
      <div class="row">
        <th><?php echo $this->__('Comments') ?></th>
      </div>
      <div class="row">
      <div class="col-xs-12 col-sm-12 col-md-6">

        <?php echo "Any special requirements regarding this order?"; ?>
        <!-- COmments box -->
        <td class="a-center">
  <textarea name="cart[<?php echo $_item->getId() ?>][comments]" rows="3" cols="20"><?php echo $_item->getItemcomment() ?></textarea>
  </td>
      </div>
    </div>
        <div class="row">
            <div class="col-xs-12 col-sm-12 col-md-4">
                <?php echo $this->getChildHtml('coupon') ?>
            </div>
            <div class="col-xs-12 col-sm-12 col-md-4">
                <?php echo $this->getChildHtml('checkout.cart.extra') ?>
                <?php if (!$this->getIsVirtual()): echo $this->getChildHtml('shipping'); endif; ?>
            </div>
            <div class="col-xs-12 col-sm-12 col-md-4">
                <div class="cart-totals">
                <span id='ajax_loadertotals' style='display:none'><!--<img src='<?php //echo $this->getSkinUrl('images/opc-ajax-loader.gif')?>'/>--><div class="loaderTotals">Loading...</div></span>
                    <div class="totals">
                        <?php echo $this->getChildHtml('totals'); ?>
                        <?php if(!$this->hasError()): ?>
                            <ul class="checkout-types">
                                <?php foreach ($this->getMethods('methods') as $method): ?>
                                    <?php if ($methodHtml = $this->getMethodHtml($method)): ?>
                                        <li><?php echo $methodHtml; ?></li>
                                    <?php endif; ?>
                                <?php endforeach; ?>
                            </ul>
                        <?php endif; ?>
                    </div>
                </div>
                <div id="shipping-info-link">
                  <a href="/checkout-shipping-details/" class="link-quickview" id="delivery-shipping-info">Delivery & Shipping Information</a>
                </div>
            </div>
        </div>
        <?php
echo $this->getLayout()->createBlock('giftcard/checkout_cart_giftcard')->setTemplate('mt/giftcard/checkout/cart/giftcard.phtml')->toHtml();
?>

                <?php echo $this->getChildHtml('crosssell') ?>


    </div>

现在我的问题在这里: 如何制作订单,以便我(销售人员)可以在后端看到它?

如果这样做更方便,我不介意将其更改为结帐页面。如果您能给我一些帮助,我将不胜感激。我环顾四周,但没发现有用的东西

谢谢

1 个答案:

答案 0 :(得分:0)

1)使用安装脚本在sales_flat_order表中添加自定义字段/属性,示例如下所示

$installer = $this;
$installer->startSetup();
$installer->getConnection()
          ->addColumn(
              $installer->getTable('sales/order'), 'cutom_comment', 'VARCHAR(150) NOT NULL'
          );

$installer->endSetup();

2)将字段添加到结帐页面

3)您可以使用事件“ checkout_type_onepage_save_order

4)您可以使用Mage::app()->getRequest()->getPost('custom_comment')

获取值

5)使用$order = $observer->getEvent()->getOrder();

获取订单详细信息

6)保存订单

$order->setCustomComment($comment);

7)为管理员添加自定义布局 为此ref

8)使用$order = $this->getOrder()

获取订单详细信息

9)通过$customComment = "$order->getCustomComment();"

获得价值