magento -- 根據支付類型定製結賬成功頁麵
在Magento中,當訂單完成會有一張成功頁麵來確認訂單已經收到並顯示訂單編號。這會帶了一個問題,當你使用非即時支付方式(比如Check/Money Order)時,客戶需要知道這些支付方式的細節和步驟,完美的狀態是客戶一旦完成訂貨能立刻知道任何必要的付款信息。下麵會告訴你怎樣根據選擇的支付方式定製化訂單成功頁麵,用來顯示非即時支付方式的細節,確保客戶正確的完成支付過程。
我們會用Check/Money Order 這個支付方式來做演示,最開始我們需要新建一個ID為"money_order_msg"靜態區塊,內容為"Your order will be processed as soon as payment has been received. Please make cheques payable to ACME Inc."
導入這個區塊我們隻需要下麵這個模板文件
app/design/frontend/default/_your_theme_/template/checkout/success.phtml
自定義代碼最好插入到<div >標簽上麵:
<?php // Get the id of the order just made. $order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId()); // If the order was paid for by Check or Money Order, display the custom message if ($order->getPayment()->getMethod() == "checkmo") { echo $this->getLayout()->createBlock('cms/block')->setBlockId('money_order_msg')->toHtml(); } ?>
這段代碼會檢索訂單並檢查支付方式是否是"checkmo",如果使用的是 Check/Money Order支付方式,我們的新區塊就會放置到成功頁麵"Continue Shopping" 按鈕的上方。
原文地址:https://www.fontis.com.au/blog/magento/customise-magento-checkout-success-page-based-payment-type
最後更新:2017-04-02 04:26:02