【问题标题】:Magento CE 1.7.0.2 - Adding Next Previous in ADMIN sales order view productMagento CE 1.7.0.2 - 在 ADMIN 销售订单视图产品中添加 Next Previous
【发布时间】:2013-03-28 23:57:09
【问题描述】:

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

我们需要以下内容:

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

  2. 打开订单以便您查看

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

最好的问候,

乔治

【问题讨论】:

    标签: magento magento-1.7


    【解决方案1】:

    尝试创建一个自定义模块来重写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/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

    阅读更多@How to add new button to order view in Magento admin panel?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-07-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多