0

我看到了将下一个先前导航添加到产品页面前端的扩展和解决方案,但这不是我们需要的。

我们需要以下内容:

  1. Magento CE 1.7.0.2 - 管理面板->销售->订单

  2. 打开订单,以便您查看

  3. 在顶部有一个下一个和上一个按钮/链接以及其他按钮来管理订单。单击下一步将带您进入下一个连续订单。

此致,

乔治

4

1 回答 1

0

尝试创建一个重写的自定义模块Mage_Adminhtml_Block_Sales_Order_View

配置.xml:

<global>
    <blocks>
         <adminhtml>
            <rewrite>
                <sales_order_view>MageIgniter_NextBackButton_Block_Adminhtml_Sales_Order_View</sales_order_view>
            </rewrite>
        </adminhtml>
    </blocks>
 </global>

MageIgniter/NextPreviousButton/Block/Adminhtml/Sales/Order/View.php:

class MageIgniter_NextBackButton_Block_Adminhtml_Sales_Order_View extends Mage_Adminhtml_Block_Sales_Order_View {

  public function  __construct() {
     if($url = $this->getPreviousUrl()){
       $this->_addButton('previous_button', array(
           'label'     => Mage::helper('sales')->__('Previous'),
           'onclick'   => 'setLocation(\'' . $url . '\')',
           'class'     => 'go'
       ));
     }

     if($url = $this->getNextUrl()){
       $this->_addButton('next_button', array(
           'label'     => Mage::helper('sales')->__('Next'),
           'onclick'   => 'setLocation(\'' . $url . '\')',
           'class'     => 'go'
       ));
     }

     parent::__construct();
  }

  // to convert to magento orm
  //http://www.magentocommerce.com/answers/discussion/3752/Filter-Order-Collection-by-attribute1-OR-attribute2/p1
  public function  getNextUrl() {
       $current_order_id = $this->getOrder()->getId();
       // get $id from db
       SELECT * FROM foo WHERE id > $current_order_id ORDER BY id LIMIT 1;
       // if found return 
       $this->getUrl('*/sales_order/view', array('order_id'=>$id))
      //else return false - at last record
  }

  public function  getPreviousUrl() {
       $current_order_id = $this->getOrder()->getId();
       // get $id from db
       SELECT * FROM foo WHERE id < $current_order_id ORDER BY id LIMIT 1;

       // if found return 
       $this->getUrl('*/sales_order/view', array('order_id'=>$id))
      //else return false - at last record
  }

}

见/app/code/core/Mage/Adminhtml/Block/Sales/Order/View.php

阅读更多@如何在 Magento 管理面板中添加新按钮到订单视图?

于 2013-03-29T14:11:58.713 回答