Magento CE 1.7.0.2 - 在ADMIN销售订单查看产品中添加下一个上一个

时间:2013-03-28 23:57:10

标签: magento magento-1.7

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

我们需要以下内容:

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

  2. 打开订单以便您查看

  3. 在顶部设置下一个和上一个按钮/链接,其他按钮用于管理订单。单击下一步将显示下一个连续订单。

  4. 最诚挚的问候,

    乔治

1 个答案:

答案 0 :(得分:0)

尝试创建重写Mage_Adminhtml_Block_Sales_Order_View

的自定义模块

<强> config.xml中:

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

<强> MageIgniter / NextPreviousButton /砌块/ Adminhtml /销售/订购/ 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

了解更多@ How to add new button to order view in Magento admin panel?