Add 'Shipped' Status and make customer confirm receipt goods_PHP_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > PHP > Add 'Shipped' Status and make customer confirm receipt goods

Add 'Shipped' Status and make customer confirm receipt goods

 2014/5/7 11:22:54  kirenenko04  程序员俱乐部  我要评论(0)
  • 摘要:1.Fist,Addashippedstatusinbackend2.rewriteMage_Adminhtml_Sales_Order_ShipmentController<config><admin><routers><adminhtml><args><modules><Bysoft_Mysalesbefore="Mage_Adminhtml">Bysoft_Mysales<
  • 标签:

1. Fist, Add a shipped status in backend



?

2.rewrite Mage_Adminhtml_Sales_Order_ShipmentController

class="xml" name="code"><config>  
 <admin>
          <routers>
            <adminhtml>
                <args>
                    <modules>
                        <Bysoft_Mysales before="Mage_Adminhtml">Bysoft_Mysales</Bysoft_Mysales>
                    </modules>
                </args>
            </adminhtml>
          </routers>
      </admin>

?

<?php
include_once("Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php");
class Bysoft_Mysales_Sales_Order_ShipmentController extends Mage_Adminhtml_Sales_Order_ShipmentController {
	protected function _saveShipment($shipment)
	{
		$shipment->getOrder()->setIsInProcess(true);
	
		$order = $shipment->getOrder();
	
		$order = Mage::getModel('sales/order')->loadByIncrementId($order->getIncrementId());
		$state = 'processing';
		$status = 'shipped';
		$comment = 'Changing state to Processing and status to shipped Status';
		$isCustomerNotified = false;
		$order->setState($state, $status, $comment, $isCustomerNotified);
		$order->save();
	
		$transactionSave = Mage::getModel('core/resource_transaction')
		->addObject($shipment)
		->save();
	
		return $this;
	}
}

?3. add a confirm controller for frontend , make cusotmer to confirm the order

<config>
   <frontend>
        <routers>
            <mysales>
                <use>standard</use>
                <args>
                    <module>Bysoft_Mysales</module>
                    <frontName>mysales</frontName>
                </args>
            </mysales>
        </routers>  
    </frontend>

?

<?php
class Bysoft_Mysales_ConfirmController extends Mage_Core_Controller_Front_Action {
	public function saveAction() {
		$order_id = Mage::app()->getRequest()->getParam('order_id');
		if(Mage::getSingleton('customer/session')->isLoggedIn()) {
			$customerData = Mage::getSingleton('customer/session')->getCustomer();
			$customer_id = $customerData->getId();
			$order = Mage::getModel('sales/order')->load($order_id);
			if ( $order->getCustomerId() == $customer_id) {
				$order->setData('state', "complete");
				$order->setStatus("complete");
				$history = $order->addStatusHistoryComment('Order status to complete by customer confirm.', false);
				$history->setIsCustomerNotified(false);
				$order->save();
				$message = $this->__('You have confirmed the order.');
				Mage::getSingleton('core/session')->addSuccess($message);
				$this->_redirectReferer();
			} else {
				return ;
			}
		} else {
			return ;
		}				
	}
}

?

  • 大小: 103.1 KB
  • 大小: 103.1 KB
  • 查看图片附件
上一篇: 什么?所有网售彩票都是非法的 下一篇: 没有下一篇了!
  • 相关文章
发表评论
用户名: 匿名